Skip to content

Commit

Permalink
Minor fixes: Fix links, icons, reduce duplication, formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bonk1t committed Nov 29, 2024
1 parent b374a6f commit d275a71
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 137 deletions.
1 change: 1 addition & 0 deletions docs_new/advanced-features/azure-openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ceo = Agent(
model="azure-model-deployment-name"
)
```

</Step>

<Step title="Run Your Agency">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class SendMessageAPI(SendMessage):
This is very powerful, as you can even allow your agents to collaborate with agents outside your system. More on this is coming soon!

<Tip title="Contributing">
If you have any ideas for new communication flows, please either adjust this page in docs, or add your new send message tool in the `agency_swarm/tools/send_message` folder and open a PR!
If you have any ideas for new communication flows, please either adjust this page in docs, or add your new send
message tool in the `agency_swarm/tools/send_message` folder and open a PR!
</Tip>

**After implementing your own `SendMessage` tool**, simply pass it into the `send_message_tool_class` parameter when initializing the `Agency` class:
Expand Down
19 changes: 10 additions & 9 deletions docs_new/advanced-features/deployment-to-production.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ Simplify deployment by deploying your agents and tools together using our ready-
Leverage our Railway deployment template to quickly deploy your agency as a web service. Railway is a platform that simplifies deploying applications without the overhead of managing servers.

<Card
title="API Railway Template"
color="#F3A78B"
href="https://github.com/VRSEN/agency-swarm-api-railway-template"
icon="train"
iconType="duotone"
title="API Railway Template"
color="#F3A78B"
href="https://github.com/VRSEN/agency-swarm-api-railway-template"
icon="train"
iconType="duotone"
>
Click here to access the template and follow the instructions to get your agency deployed.
Click here to access the template and follow the instructions to get your agency deployed.
</Card>

Find more detailed instructions in the video below:
Expand All @@ -108,12 +108,13 @@ Find more detailed instructions in the video below:

<Accordion title="Option 2: Deploy Tools as Separate API Endpoints" defaultOpen={false}>

Alternatively, you can deploy your tools as separate API endpoints (e.g., serverless functions) and integrate them into your agents using [OpenAPI schemas](/advanced-features/openapi-schemas). This approach allows for greater scalability and modularity, especially if you plan to reuse tools across different agents or services.
Alternatively, you can deploy your tools as separate API endpoints (e.g., serverless functions) and integrate them into your agents using [OpenAPI schemas](/advanced-features/openapi-schemas). This method is ideal if you plan to reuse tools across different agents or services.

Deploying tools separately allows for greater flexibility and scalability. You can deploy individual tools as serverless functions on platforms like AWS Lambda, Google Cloud Functions, or Azure Functions. This approach provides on-demand scalability and cost efficiency. Alternatively, you can host your tools as custom API endpoints using frameworks like FastAPI or Flask and deploy them on platforms such as Heroku, DigitalOcean, Railway, or your own servers.
Deploying tools separately provides flexibility and scalability. You can deploy individual tools as serverless functions on platforms like AWS Lambda, Google Cloud Functions, or Azure Functions. This ensures on-demand scaling and cost efficiency. Alternatively, you can host your tools as custom API endpoints using frameworks like FastAPI or Flask and deploy them on platforms such as Heroku, DigitalOcean, Railway, or your own servers.

<Note>
When deploying tools separately, ensure proper authentication and secure communication between your agents and the tool APIs.
When deploying tools separately, ensure proper authentication and secure communication between your agents and the
tool APIs.
</Note>

</Accordion>
Expand Down
1 change: 1 addition & 0 deletions docs_new/advanced-features/few-shot-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ You can add few-shot examples to your agent either during initialization or afte
```

</Tab>

</Tabs>

## Crafting Effective Examples
Expand Down
42 changes: 28 additions & 14 deletions docs_new/advanced-features/open-source-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,27 @@ While OpenAI is generally recommended, there are situations where you might pref

<CardGroup>

<Card title="Astra Assistants API" icon="rocket" iconType="solid" href="https://github.com/datastax/astra-assistants-api">
The best and the easiest option for running Open Source models. Supports Assistants API V2. See example [notebook](https://github.com/VRSEN/agency-swarm/blob/main/notebooks/os_models_with_astra_assistants_api.ipynb).
<Card
title="Astra Assistants API"
icon="rocket"
iconType="solid"
href="https://github.com/datastax/astra-assistants-api"
>
The best and the easiest option for running Open Source models. Supports Assistants API V2. See example
[notebook](https://github.com/VRSEN/agency-swarm/blob/main/notebooks/os_models_with_astra_assistants_api.ipynb).
</Card>

<Card title="Open Assistant API" icon="users" iconType="solid" href="https://github.com/MLT-OSS/open-assistant-api">
Fully local, stable, and tested, but only supports Assistants V1. See example [here](https://github.com/VRSEN/agency-swarm-lab/tree/main/OpenSourceSwarm).
Fully local, stable, and tested, but only supports Assistants V1. See example
[here](https://github.com/VRSEN/agency-swarm-lab/tree/main/OpenSourceSwarm).
</Card>

<Card title="OpenOpenAI" icon="code" iconType="solid" href="https://github.com/transitive-bullshit/OpenOpenAI">
Unverified.
Unverified.
</Card>

<Card title="LiteLLM" icon="code" iconType="solid" href="https://github.com/BerriAI/litellm/issues/2842">
Assistants API Proxy in development.
Assistants API Proxy in development.
</Card>

</CardGroup>
Expand All @@ -33,8 +40,9 @@ Assistants API Proxy in development.
<Steps>

<Step title="1. Create an account on Astra Assistants API and obtain an API key." icon="user">
Open the [Astra Assistants API](https://astra.datastax.com/signup) and create an account. Once you have an account, you can obtain an API key by clicking on the "Generate Token" button.
![Astra Assistants API Example](https://firebasestorage.googleapis.com/v0/b/vrsen-ai/o/public%2Fgithub%2FScreenshot%202024-07-01%20at%208.19.00%E2%80%AFAM.png?alt=media&token=b4f1a7ad-3b77-40fa-a5da-866a4f1410bd)
Open the [Astra Assistants API](https://astra.datastax.com/signup) and create an account. Once you have an account,
you can obtain an API key by clicking on the "Generate Token" button. ![Astra Assistants API
Example](https://firebasestorage.googleapis.com/v0/b/vrsen-ai/o/public%2Fgithub%2FScreenshot%202024-07-01%20at%208.19.00%E2%80%AFAM.png?alt=media&token=b4f1a7ad-3b77-40fa-a5da-866a4f1410bd)
</Step>

<Step title="2. Add Astra DB Token to your .env file:" icon="file">
Expand All @@ -43,6 +51,7 @@ Copy the token from the file that starts with "AstraCS:" and paste it into your
```env
ASTRA_DB_APPLICATION_TOKEN=AstraCS:dsfkgn...
```

</Step>

<Step title="3. Add other model provider API keys to .env as well:" icon="key">
Expand All @@ -60,7 +69,7 @@ pip install astra-assistants-api gradio
```
</Step>

<Step title="5. Patch the OpenAI client:" icon="cogs">
<Step title="5. Patch the OpenAI client:" icon="code">
```python
from openai import OpenAI
from astra_assistants import patch
Expand Down Expand Up @@ -92,6 +101,7 @@ ceo = Agent(
files_folder="path/to/your/files"
)
```

</Step>

<Step title="7. Create an agency:" icon="people-arrows">
Expand All @@ -102,6 +112,7 @@ from agency_swarm import Agency

agency = Agency([ceo])
```

</Step>

<Step title="8. Start Gradio:" icon="play">
Expand All @@ -115,6 +126,7 @@ agency = Agency([ceo])

demo_gradio(agency)
```

</Step>

</Steps>
Expand All @@ -127,24 +139,24 @@ To use agency-swarm with any other projects that mimic the Assistants API, gener

<Steps>

<Step title="1. Install the previous version of agency-swarm as most projects are not yet compatible with streaming and Assistants V2:" icon="download">
<Step title="Install the previous version of agency-swarm as most projects are not yet compatible with streaming and Assistants V2:">
```bash
pip install agency-swarm==0.1.7
```
</Step>

<Step title="2. Switch out the OpenAI client:" icon="cogs">
<Step title="Switch out the OpenAI client:">
```python
import openai
from agency_swarm import set_openai_client

client = openai.OpenAI(api_key="whatever", base_url="http://127.0.0.1:8000/")
client = openai.OpenAI(api_key="your-api-key", base_url="http://127.0.0.1:8000/")

set_openai_client(client)
```
</Step>

<Step title="3. Set the model parameter:" icon="user">
<Step title="Set the model parameter:">
```python
from agency_swarm import Agent

Expand All @@ -154,9 +166,10 @@ ceo = Agent(
model='ollama/llama3'
)
```

</Step>

<Step title="4. Start Gradio:" icon="play">
<Step title="Start Gradio:">
To utilize your agency in Gradio, apply a specific non-streaming `demo_gradio` method from the [agency-swarm-lab](https://github.com/VRSEN/agency-swarm-lab/blob/main/OpenSourceSwarm/demo_gradio.py) repository:

```python
Expand All @@ -167,9 +180,10 @@ agency = Agency([ceo])

demo_gradio(agency)
```

</Step>

<Step title="5. For backend integrations, simply use:" icon="code">
<Step title="For backend integrations, simply use:">
```python
agency.get_completion("I am the CEO")
```
Expand Down
8 changes: 6 additions & 2 deletions docs_new/advanced-features/streaming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Agency Swarm supports streaming responses from language models, providing real-t
To stream the conversation between agents, you can use the `get_completion_stream` method with your event handler. The process follows a similar pattern to the [official OpenAI documentation](https://platform.openai.com/docs/api-reference/assistants-streaming).

<Note>
The main difference is that you must extend the `AgencyEventHandler` class, which provides two additional properties: `agent_name` and `recipient_agent_name`. These help identify the agents communicating with each other (see the `on_text_created` method below).
The main difference is that you must extend the `AgencyEventHandler` class, which provides two additional properties:
`agent_name` and `recipient_agent_name`. These help identify the agents communicating with each other (see the
`on_text_created` method below).
</Note>

```python
Expand Down Expand Up @@ -49,5 +51,7 @@ response = agency.get_completion_stream("I want you to build me a website", even
```

<Note>
The `on_all_streams_end` class method is called when all streams have ended. This is particularly important since your event handler might be called multiple times and possibly by multiple agents, unlike in the official OpenAI documentation.
The `on_all_streams_end` class method is called when all streams have ended. This is particularly important since your
event handler might be called multiple times and possibly by multiple agents, unlike in the official OpenAI
documentation.
</Note>
2 changes: 0 additions & 2 deletions docs_new/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def demo_gradio(self, height: int = 450, dark_mode: bool = True, **kwargs):

</CodeGroup>


## Agent Class

The Agent class is the core component of Agency Swarm that represents an AI assistant. Each agent has specific capabilities, tools, and can process files and instructions.
Expand Down Expand Up @@ -235,7 +234,6 @@ def add_shared_instructions(self, instructions: str):

</CodeGroup>


## BaseTool Class

The base class for creating custom tools that agents can use. Tools allow agents to perform specific actions or access external functionality.
Expand Down
Loading

0 comments on commit d275a71

Please sign in to comment.