Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellLuo committed Jan 19, 2025
1 parent 2b2fd29 commit 3c6cd5a
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,12 @@ from coagent.agents import StreamChatAgent, ChatMessage, ModelClient
from coagent.core import AgentSpec, new, set_stderr_logger
from coagent.runtimes import LocalRuntime

client = ModelClient(
model=os.getenv("MODEL_NAME"),
api_base=os.getenv("MODEL_API_BASE"),
api_version=os.getenv("MODEL_API_VERSION"),
api_key=os.getenv("MODEL_API_KEY"),
)

translator = AgentSpec(
"translator",
new(
StreamChatAgent,
system="You are a professional translator that can translate Chinese to English.",
client=client,
client=ModelClient(model="openai/gpt-4o", api_key=os.getenv("OPENAI_API_KEY")),
),
)

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

```bash
export MODEL_NAME=<YOUR_MODEL_NAME>
export MODEL_API_BASE=<YOUR_MODEL_API_BASE>
export MODEL_API_VERSION=<YOUR_MODEL_API_VERSION>
export MODEL_API_KEY=<YOUR_MODEL_API_KEY>
export OPENAI_API_KEY="your-openai-key"
python translator.py
```

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

client = ModelClient(
model=os.getenv("MODEL_NAME"),
api_base=os.getenv("MODEL_API_BASE"),
api_version=os.getenv("MODEL_API_VERSION"),
api_key=os.getenv("MODEL_API_KEY"),
)

translator = AgentSpec(
"translator",
new(
StreamChatAgent,
system="You are a professional translator that can translate Chinese to English.",
client=client,
client=ModelClient(model="openai/gpt-4o", api_key=os.getenv("OPENAI_API_KEY")),
),
)

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

```bash
export MODEL_NAME=<YOUR_MODEL_NAME>
export MODEL_API_BASE=<YOUR_MODEL_API_BASE>
export MODEL_API_VERSION=<YOUR_MODEL_API_VERSION>
export MODEL_API_KEY=<YOUR_MODEL_API_KEY>
export OPENAI_API_KEY="your-openai-key"
python translator.py
```

Expand Down

0 comments on commit 3c6cd5a

Please sign in to comment.