-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick.py
More file actions
33 lines (23 loc) · 844 Bytes
/
quick.py
File metadata and controls
33 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pathlib import Path
from tinygent.cli.utils import discover_and_register_components
from tinygent.core.factory import build_agent
from tinygent.logging import setup_logger
logger = setup_logger('debug')
def main():
parent_path = Path(__file__).parent
# Discover and register tools and middleware from main.py
discover_and_register_components(str(parent_path / 'main.py'))
agent = build_agent(
'react',
llm='openai:gpt-4o-mini',
tools=['get_best_destination'],
memory='buffer',
middleware=['react_tool_tracker', 'tool_limiter'],
)
result = agent.run(
'What is the best travel destination and what is the weather like there?'
)
logger.info('[RESULT] %s', result)
logger.info('[AGENT SUMMARY] %s', str(agent))
if __name__ == '__main__':
main()