multi agent llm
1.0.0
欢迎来到基于LLM的多代理存储库!该存储库提供了尖端的技术和方法,用于利用大型语言模型(LLMS)使用多代理体系结构来执行各种任务。这包括由Agnostiq Inc.开发的方法以及其他最先进的方法。该存储库旨在模块化且易于使用,可以快速实验,并谨慎使用它来生产目的。
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
}
| 方法 | 描述 |
|---|---|
| Aiot | 自主迭代(Aiot)(Aiot)会根据对话的不断发展的状态动态适应其推理路径,而不会产生最终被丢弃的其他探索思想。快速示例 |
| Giot | 指导的思想迭代(Giot)迫使LLM继续迭代预定义的步骤,从而确保对推理路径进行彻底的探索。快速示例 |
该存储库还包含思想案例迭代的结果。您可以找到相关的实验设置,数据集和结果。该文件夹包含各种任务的结果。随意探索这些文件夹以重现实验或更深入地了解Aiot和Giot框架在实践中的工作方式。