-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refined code and added some examples (#34)
* Allow loading of user-defined tools * Allow loading of user-defined tools, parallelize tasks using threads * refined code and added some examples * fix react * delete auth --------- Co-authored-by: Satan <liuxk2019@mail.sustech.edu.cn> Co-authored-by: Binfeng Xu <65674752+billxbf@users.noreply.github.com>
- Loading branch information
1 parent
d875099
commit f03c5fd
Showing
14 changed files
with
868 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from gentopia.assembler.agent_assembler import AgentAssembler | ||
from gentopia.output import enable_log | ||
from gentopia import chat | ||
|
||
if __name__ == '__main__': | ||
enable_log() | ||
assembler = AgentAssembler(file='configs/main.yaml') | ||
agent = assembler.get_agent() | ||
chat(agent, verbose=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from gentopia.assembler.agent_assembler import AgentAssembler | ||
from gentopia.output import enable_log | ||
from gentopia import chat | ||
|
||
if __name__ == '__main__': | ||
enable_log() | ||
assembler = AgentAssembler(file='configs/mathria.yaml') | ||
agent = assembler.get_agent() | ||
chat(agent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Agent Config | ||
name: !env AGENT_NAME | ||
type: openai | ||
version: 0.0.1 | ||
description: main agent leveraging OpenAI function call API. | ||
prompt_template: !prompt ZeroShotVanillaPrompt | ||
llm: | ||
model_name: gpt-4-0613 | ||
params: | ||
temperature: 0.0 | ||
top_p: 0.9 | ||
repetition_penalty: 1.0 | ||
max_tokens: 1024 | ||
target_tasks: | ||
- anything | ||
plugins: | ||
- name: google_search | ||
- name: web_page | ||
- !include sample_agent.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Agent Config | ||
name: main | ||
type: openai | ||
version: 0.0.1 | ||
description: main agent leveraging OpenAI function call API. | ||
prompt_template: !prompt ZeroShotVanillaPrompt | ||
llm: | ||
model_name: gpt-4-0613 | ||
params: | ||
temperature: 0.0 | ||
top_p: 0.9 | ||
repetition_penalty: 1.0 | ||
max_tokens: 1024 | ||
target_tasks: | ||
- anything | ||
plugins: | ||
- name: google_search | ||
- name: web_page | ||
- !include sample_agent.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Agent Config | ||
name: main | ||
type: openai | ||
version: 0.0.1 | ||
description: main agent leveraging OpenAI function call API. | ||
prompt_template: !prompt ZeroShotVanillaPrompt | ||
llm: | ||
model_name: gpt-4-0613 | ||
params: | ||
temperature: 0.0 | ||
top_p: 0.9 | ||
repetition_penalty: 1.0 | ||
max_tokens: 1024 | ||
target_tasks: | ||
- anything | ||
plugins: | ||
- name: google_search | ||
- name: web_page |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
from .assembler.agent_assembler import AgentAssembler | ||
import signal | ||
|
||
from .assembler.agent_assembler import AgentAssembler | ||
from .output import enable_log | ||
from .output.base_output import * | ||
from .output.console_output import ConsoleOutput | ||
|
||
|
||
def chat(agent, output = ConsoleOutput(), verbose = False, log_level = None, log_path = None): | ||
output.panel_print("[green]Welcome to Gentopia!", title="[blue]Gentopia") | ||
if verbose: | ||
output.panel_print(str(agent), title="[red]Agent") | ||
if log_level is not None: | ||
if not check_log(): | ||
enable_log( path=log_path, log_level=log_level) | ||
def handler(signum, frame): | ||
output.print("\n[red]Bye!") | ||
exit(0) | ||
|
||
signal.signal(signal.SIGINT, handler) | ||
|
||
while True: | ||
output.print("[green]User: ", end="") | ||
text = input() | ||
if text: | ||
response = agent.stream(text, output=output) | ||
else: | ||
response = agent.stream(output=output) | ||
|
||
output.done(_all=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters