Bem-vindo ao repositório multi-agente baseado em LLM! Esse repositório fornece uma implementação enxuta de técnicas e métodos de ponta para alavancar modelos de grandes idiomas (LLMS) com arquiteturas multi-agentes para várias tarefas. Isso inclui métodos desenvolvidos pela Agnostiq Inc., bem como outros métodos de última geração. O repositório foi projetado para ser modular e fácil de usar, permitindo experimentação rápida e use -o com cautela para fins de produção.
pip install -U multi-agent-llm import os ; os . environ [ 'OPENAI_API_KEY' ] = "your_openai_api_key"
from multi_agent_llm import OpenAILLM , AIOT
from pydantic import BaseModel , Field
llm = OpenAILLM ( model_name = "gpt-4o-mini" ) # Currently we only have wrapper for OpenAI, but it can be easily extended to other LLMs
# Define the answer schema
class QueryAnswer ( BaseModel ):
explanation : str = Field ( description = "Explanation of the answer" )
answer : str = Field ( description = "Final Answer" )
# Initialize AIOT with the LLM and run a sample query
aiot = AIOT ( llm = llm , iterations = 2 , answer_schema = QueryAnswer )
result = aiot . run ( "How many R's are there in the word 'Strawberry'?" )
print ( result ) Discussion Result
-----------------
How many R's are there in the word 'Strawberry'?
Thought Process:
Iteration 1:
IDA: Let's break down the word 'Strawberry'. First, count the letters in the word and then specifically look for the letter 'R'. Remember to pay attention to uppercase and lowercase letters, but focus primarily on the letter 'R'. How many instances of 'R' do you find?
LLMA:
{
explanation: The word 'Strawberry' contains a total of three instances of the letter 'R'. This includes two uppercase 'R's and one lowercase 'r'. Therefore, when counting the letter 'R' in both forms, we find that there are 3 occurrences in total.
answer: 3
}
Final Answer:
{
explanation: The word 'Strawberry' contains a total of three instances of the letter 'R'. This includes two uppercase 'R's and one lowercase 'r'. Therefore, when counting the letter 'R' in both forms, we find that there are 3 occurrences in total.
answer: 3
}
| Método | Descrição |
|---|---|
| Aiot | A iteração autônoma de pensamento (AIOT) adapta dinamicamente seus caminhos de raciocínio com base no estado em evolução da conversa sem gerar pensamentos explorativos alternativos que são descartados. Exemplo rápido |
| Giot | A iteração guiada de pensamento (GIOT) força o LLM a continuar iterando para um número predefinido de etapas, garantindo uma exploração completa dos caminhos de raciocínio. Exemplo rápido |
Este repositório também contém os resultados para a iteração do pensamento em papel. Você pode encontrar as configurações experimentais, conjuntos de dados e resultados experimentais relevantes. A pasta contém resultados de várias tarefas. Sinta -se à vontade para explorar essas pastas para reproduzir os experimentos ou obter uma compreensão mais profunda de como as estruturas AIOT e GIOT funcionam na prática.