Welcome to the Ollama Agent guide! This example will walk you through creating an Ollama agent and integrating it into your Multi-Agent Orchestrator System.
Let’s dive in!
📚Prerequisites:
Basic knowledge of TypeScript or Python
Familiarity with the Multi-Agent Orchestrator System
Now, let’s create our OllamaAgent class. This class extends the Agent abstract class from the Multi-Agent Orchestrator.
The process_request method must be implemented by the OllamaAgent
```typescript
import {
Agent,
AgentOptions,
ConversationMessage,
ParticipantRole,
Logger
} from "multi-agent-orchestrator";
import ollama from 'ollama'
```python
from typing import List, Dict, Optional, AsyncIterable, Any
from multi_agent_orchestrator.agents import Agent, AgentOptions
from multi_agent_orchestrator.types import ConversationMessage, ParticipantRole
from multi_agent_orchestrator.utils import Logger
import ollama
from dataclasses import dataclass
Now that we have our OllamaAgent, let’s add it to the Multi-Agent Orchestrator:
🔗 3. Add OllamaAgent to the orchestrator:
If you have used the quickstarter sample program, you can add the Ollama agent and run it:
```typescript
import { OllamaAgent } from "./ollamaAgent";
import { MultiAgentOrchestrator } from "multi-agent-orchestrator"
```python
from ollamaAgent import OllamaAgent, OllamaAgentOptions
from multi_agent_orchestrator.orchestrator import MultiAgentOrchestrator
And you are done!
🏃 4. Run Your Ollama Model Locally:
Before running your program, make sure to start the Ollama model locally:
If you haven’t downloaded the Llama 2 model yet, it will be downloaded automatically before running.
🎉 You’re All Set!
Congratulations! You’ve successfully integrated an Ollama agent into your Multi-Agent Orchestrator System. Now you can start summarizing text and leveraging the power of Llama 2 in your applications!