Skip to content

Commit 3c6cd5a

Browse files
committed
Update README
1 parent 2b2fd29 commit 3c6cd5a

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

README.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,12 @@ from coagent.agents import StreamChatAgent, ChatMessage, ModelClient
7373
from coagent.core import AgentSpec, new, set_stderr_logger
7474
from coagent.runtimes import LocalRuntime
7575

76-
client = ModelClient(
77-
model=os.getenv("MODEL_NAME"),
78-
api_base=os.getenv("MODEL_API_BASE"),
79-
api_version=os.getenv("MODEL_API_VERSION"),
80-
api_key=os.getenv("MODEL_API_KEY"),
81-
)
82-
8376
translator = AgentSpec(
8477
"translator",
8578
new(
8679
StreamChatAgent,
8780
system="You are a professional translator that can translate Chinese to English.",
88-
client=client,
81+
client=ModelClient(model="openai/gpt-4o", api_key=os.getenv("OPENAI_API_KEY")),
8982
),
9083
)
9184

@@ -110,10 +103,7 @@ if __name__ == "__main__":
110103
Run the agent:
111104

112105
```bash
113-
export MODEL_NAME=<YOUR_MODEL_NAME>
114-
export MODEL_API_BASE=<YOUR_MODEL_API_BASE>
115-
export MODEL_API_VERSION=<YOUR_MODEL_API_VERSION>
116-
export MODEL_API_KEY=<YOUR_MODEL_API_KEY>
106+
export OPENAI_API_KEY="your-openai-key"
117107
python translator.py
118108
```
119109

@@ -138,19 +128,12 @@ from coagent.agents import StreamChatAgent, ModelClient
138128
from coagent.core import AgentSpec, idle_loop, new, set_stderr_logger
139129
from coagent.runtimes import NATSRuntime
140130

141-
client = ModelClient(
142-
model=os.getenv("MODEL_NAME"),
143-
api_base=os.getenv("MODEL_API_BASE"),
144-
api_version=os.getenv("MODEL_API_VERSION"),
145-
api_key=os.getenv("MODEL_API_KEY"),
146-
)
147-
148131
translator = AgentSpec(
149132
"translator",
150133
new(
151134
StreamChatAgent,
152135
system="You are a professional translator that can translate Chinese to English.",
153-
client=client,
136+
client=ModelClient(model="openai/gpt-4o", api_key=os.getenv("OPENAI_API_KEY")),
154137
),
155138
)
156139

@@ -169,10 +152,7 @@ if __name__ == "__main__":
169152
Run the agent as a daemon:
170153

171154
```bash
172-
export MODEL_NAME=<YOUR_MODEL_NAME>
173-
export MODEL_API_BASE=<YOUR_MODEL_API_BASE>
174-
export MODEL_API_VERSION=<YOUR_MODEL_API_VERSION>
175-
export MODEL_API_KEY=<YOUR_MODEL_API_KEY>
155+
export OPENAI_API_KEY="your-openai-key"
176156
python translator.py
177157
```
178158

0 commit comments

Comments
 (0)