https://github.com/BeastByteAI/agent_dingo
A microframework for creating simple AI agents.
https://github.com/BeastByteAI/agent_dingo
Last synced: 11 months ago
JSON representation
A microframework for creating simple AI agents.
- Host: GitHub
- URL: https://github.com/BeastByteAI/agent_dingo
- Owner: BeastByteAI
- License: mit
- Created: 2023-06-23T10:59:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T02:03:08.000Z (almost 2 years ago)
- Last Synced: 2024-08-05T06:03:57.192Z (almost 2 years ago)
- Language: Python
- Homepage: https://beastbyte.ai/
- Size: 660 KB
- Stars: 79
- Watchers: 7
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Agent Dingo
A microframework for building LLM-powered pipelines and agents.
_Dingo_ is a compact LLM orchestration framework designed for straightforward development of production-ready LLM-powered applications. It combines simplicity with flexibility, allowing for the efficient construction of pipelines and agents, while maintaining a high level of control over the process.
## Support us 🤝
You can support the project in the following ways:
- ⭐ Star Dingo on GitHub (click the star button in the top right corner)
- 💡 Provide your feedback or propose ideas in the [issues](https://github.com/BeastByteAI/agent_dingo/issues) section or [Discord](https://discord.gg/YDAbwuWK7V)
- 📰 Post about Dingo on LinkedIn or other platforms
- 🔗 Check out our other projects: Scikit-LLM, Falcon
## Quick Start & Documentation 🚀
**Step 1:** Install `agent-dingo`
```bash
pip install agent-dingo
```
**Step 2:** Configure your OpenAI API key
```bash
export OPENAI_API_KEY=
```
**Step 3:** Build your pipeline
Example 1 (Linear Pipeline):
````python
from agent_dingo.llm.openai import OpenAI
from agent_dingo.core.blocks import PromptBuilder
from agent_dingo.core.message import UserMessage
from agent_dingo.core.state import ChatPrompt
# Model
gpt = OpenAI("gpt-3.5-turbo")
# Summary prompt block
summary_pb = PromptBuilder(
[UserMessage("Summarize the text in 10 words: ```{text}```.")]
)
# Translation prompt block
translation_pb = PromptBuilder(
[UserMessage("Translate the text into {language}: ```{summarized_text}```.")],
from_state=["summarized_text"],
)
# Pipeline
pipeline = summary_pb >> gpt >> translation_pb >> gpt
input_text = """
Dingo is an ancient lineage of dog found in Australia, exhibiting a lean and sturdy physique adapted for speed and endurance, dingoes feature a wedge-shaped skull and come in colorations like light ginger, black and tan, or creamy white. They share a close genetic relationship with the New Guinea singing dog, diverging early from the domestic dog lineage. Dingoes typically form packs composed of a mated pair and their offspring, indicating social structures that have persisted through their history, dating back approximately 3,500 years in Australia.
"""
output = pipeline.run(text = input_text, language = "french")
print(output)
````
Example 2 (Agent):
```python
from agent_dingo.agent import Agent
from agent_dingo.llm.openai import OpenAI
import requests
llm = OpenAI(model="gpt-3.5-turbo")
agent = Agent(llm, max_function_calls=3)
@agent.function
def get_temperature(city: str) -> str:
"""Retrieves the current temperature in a city.
Parameters
----------
city : str
The city to get the temperature for.
Returns
-------
str
String representation of the json response from the weather api.
"""
base_url = "https://api.openweathermap.org/data/2.5/weather"
params = {
"q": city,
"appid": "",
"units": "metric"
}
response = requests.get(base_url, params=params)
data = response.json()
return str(data)
pipeline = agent.as_pipeline()
```
For a more detailed overview and additional examples, please refer to the **[documentation](https://dingo.beastbyte.ai/)**.