-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathtry.py
More file actions
50 lines (37 loc) · 1.05 KB
/
try.py
File metadata and controls
50 lines (37 loc) · 1.05 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import sys
from mlx_use.llm.factory import LLMFactory
from mlx_use.llm.providers import LLMConfig, LLM
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import asyncio
from mlx_use import Agent
from mlx_use.controller.service import Controller
config = LLMConfig(
provider_name=LLM.OPENAI,
env_var="OPENAI_API_KEY",
params={"model": "gpt-4o"}
)
provider = LLMFactory.create_provider(config)
llm = provider.get_llm()
controller = Controller()
async def main():
agent_greeting = Agent(
task='Say "Hi there $whoami, What can I do for you today?"',
llm=llm,
controller=controller,
use_vision=False,
max_actions_per_step=1,
max_failures=5
)
await agent_greeting.run(max_steps=25)
task = input("Enter the task: ")
agent_task = Agent(
task=task,
llm=llm,
controller=controller,
use_vision=False,
max_actions_per_step=4,
max_failures=5
)
await agent_task.run(max_steps=25)
asyncio.run(main())