|
12 | 12 |
|
13 | 13 | from gentopia.model.param_model import HuggingfaceParamModel
|
14 | 14 | from gentopia.output import enable_log
|
| 15 | +from gentopia import chat |
15 | 16 | from gentopia.output.console_output import ConsoleOutput
|
16 | 17 |
|
17 | 18 | import logging
|
@@ -47,38 +48,37 @@ def print_tree(obj, indent=0):
|
47 | 48 | print_tree(item, indent + 1)
|
48 | 49 |
|
49 | 50 |
|
50 |
| -def ask(agent): |
51 |
| - out = ConsoleOutput() |
52 |
| - |
53 |
| - def handler(signum, frame): |
54 |
| - out.print("\n[red]Bye!") |
55 |
| - exit(0) |
56 |
| - |
57 |
| - signal.signal(signal.SIGINT, handler) |
58 |
| - while True: |
59 |
| - out.print("[green]User: ", end="") |
60 |
| - text = input() |
61 |
| - if text: |
62 |
| - response = agent.stream(text, output=out) |
63 |
| - else: |
64 |
| - response = agent.stream(output=out) |
65 |
| - |
66 |
| - out.done(_all=True) |
67 |
| - print("\n") |
| 51 | +# def ask(agent, output = ConsoleOutput()): |
| 52 | +# |
| 53 | +# def handler(signum, frame): |
| 54 | +# output.print("\n[red]Bye!") |
| 55 | +# exit(0) |
| 56 | +# |
| 57 | +# signal.signal(signal.SIGINT, handler) |
| 58 | +# while True: |
| 59 | +# output.print("[green]User: ", end="") |
| 60 | +# text = input() |
| 61 | +# if text: |
| 62 | +# response = agent.stream(text, output=output) |
| 63 | +# else: |
| 64 | +# response = agent.stream(output=output) |
| 65 | +# |
| 66 | +# output.done(_all=True) |
| 67 | + # print("\n") |
68 | 68 |
|
69 | 69 |
|
70 | 70 | if __name__ == '__main__':
|
71 | 71 | # mp.set_start_method('spawn', force=True)# calculate sqrt(10), and then calculate sqrt(100)
|
72 | 72 | # config = Config.load('main.yaml') # then tell me what is GIL in python
|
73 | 73 | # print(config)calculate sqrt(10),then tell me what is GIL in python, and then calculate sqrt(100)
|
74 | 74 | # exit(0)give me some sentences in markdown format
|
75 |
| - enable_log(log_level='debug') |
| 75 | + enable_log(log_level='info') |
76 | 76 |
|
77 | 77 | assembler = AgentAssembler(file='configs/mathria.yaml')
|
78 | 78 |
|
79 | 79 | # # assembler.manager = LocalLLMManager()
|
80 | 80 | agent = assembler.get_agent()
|
81 |
| - ask(agent) |
| 81 | + chat(agent) |
82 | 82 | #
|
83 | 83 | # print(agent)
|
84 | 84 | # x = " What is Trump's current age raised to the 0.43 power?"
|
|
0 commit comments