Skip to content

Commit

Permalink
feat: make agent plural
Browse files Browse the repository at this point in the history
  • Loading branch information
k11kirky committed Oct 24, 2024
1 parent 36b86d8 commit 4057601
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ After initializing a new project, your project directory will look like this:

```
my_project/
├── agent/
├── agents/
│ ├── example_agent.py
├── docker/
│ ├── Dockerfile
Expand Down Expand Up @@ -224,24 +224,24 @@ This ensures that AgentServe will be installed when setting up the project in th

#### 3. Create an agents Directory

Create a new directory called agent in the root of your project. This is where your agent classes will reside.
Create a new directory called agents in the root of your project. This is where your agent classes will reside.

```bash
mkdir agent
mkdir agents
```

#### 4. Implement Your Agent Class

Inside the directory, create a new Python file for your agent. For example, my_agent.py:

```bash
touch agent/my_agent.py
touch agents/my_agent.py
```

Open agent/my_agent.py and implement your agent by subclassing Agent from agentserve:

```python
# agent/my_agent.py
# agents/my_agent.py
from agentserve import Agent

class MyAgent(Agent):
Expand All @@ -267,7 +267,7 @@ Open main.py and set up the AgentServer:

```python
from agentserve import AgentServer
from agent.my_agent import MyAgent
from agents.my_agent import MyAgent

agent_server = AgentServer(MyAgent)
app = agent_server.app
Expand Down
12 changes: 6 additions & 6 deletions agentserve/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
# Mapping of framework choices to their respective agent import and class names
FRAMEWORKS = {
'openai': {
'agent_import': 'from agent.example_openai_agent import ExampleAgent',
'agent_import': 'from agents.example_openai_agent import ExampleAgent',
'agent_class': 'ExampleAgent',
'agent_template_filename': 'example_openai_agent.py.tpl'
},
'langchain': {
'agent_import': 'from agent.example_langchain_agent import ExampleAgent',
'agent_import': 'from agents.example_langchain_agent import ExampleAgent',
'agent_class': 'ExampleAgent',
'agent_template_filename': 'example_langchain_agent.py.tpl'
},
'llama': {
'agent_import': 'from agent.example_llama_agent import ExampleAgent',
'agent_import': 'from agents.example_llama_agent import ExampleAgent',
'agent_class': 'ExampleAgent',
'agent_template_filename': 'example_llamaindex_agent.py.tpl'
},
'blank': {
'agent_import': 'from agent.example_agent import ExampleAgent',
'agent_import': 'from agents.example_agent import ExampleAgent',
'agent_class': 'ExampleAgent',
'agent_template_filename': 'example_agent.py.tpl'
}
Expand Down Expand Up @@ -75,8 +75,8 @@ def init(project_name, framework):

# Copy agent template to agents directory
agent_template_filename = FRAMEWORKS[framework]['agent_template_filename']
agent_src_path = TEMPLATES_DIR / 'agent' / agent_template_filename
agent_dst_path = project_path / 'agent' / agent_template_filename[:-4] # Remove '.tpl' extension
agent_src_path = TEMPLATES_DIR / 'agents' / agent_template_filename
agent_dst_path = project_path / 'agents' / agent_template_filename[:-4] # Remove '.tpl' extension
shutil.copyfile(agent_src_path, agent_dst_path)

# Copy .env template
Expand Down

0 comments on commit 4057601

Please sign in to comment.