From 3c6cd5a386a46f51243c4f97cf4a77272ef9b709 Mon Sep 17 00:00:00 2001 From: RussellLuo Date: Sun, 19 Jan 2025 14:03:59 +0800 Subject: [PATCH] Update README --- README.md | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index ee17f26..55a9000 100644 --- a/README.md +++ b/README.md @@ -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")), ), ) @@ -110,10 +103,7 @@ if __name__ == "__main__": Run the agent: ```bash -export MODEL_NAME= -export MODEL_API_BASE= -export MODEL_API_VERSION= -export MODEL_API_KEY= +export OPENAI_API_KEY="your-openai-key" python translator.py ``` @@ -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")), ), ) @@ -169,10 +152,7 @@ if __name__ == "__main__": Run the agent as a daemon: ```bash -export MODEL_NAME= -export MODEL_API_BASE= -export MODEL_API_VERSION= -export MODEL_API_KEY= +export OPENAI_API_KEY="your-openai-key" python translator.py ```