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框架在實踐中的工作方式。