LLM agents with docker
1.0.0
觀看演示:https://www.youtube.com/watch?v=UGQMN2XDU54
This repository is based on the code from LangChain's Azure Container Apps Dynamic Sessions Data Analyst Notebook (https://github.com/langchain-ai/langchain/blob/master/cookbook/azure_container_apps_dynamic_sessions_data_analyst.ipynb), where an agent reads data from a PostgreSQL database, saves it in a CSV file, and executes code based on the CSV file, such as plotting a graph.
代碼的主要功能是它使用Azure容器應用程序動態會話在容器中執行代碼。
該項目用Docker代替了Azure容器應用程序動態會話。因此,當代理執行代碼時,它將創建一個Docker容器,執行代碼,然後刪除容器。這樣可以確保主機機器免受代理商的任意代碼。
代理體系結構如下:

執行execute_sql_query節點後,將數據保存為主機計算機上的CSV。然後,Docker容器只有閱讀的權限以訪問此CSV。如果繪製任何內容,則圖像將通過base64字符串傳遞回主機。
git clone https : // github . com / paulomuraroferreira / LLM - agents - with - docker . git
cd LLM - agents - with - docker$ pip install - e .另外,請確保您已安裝和運行Docker。
創建一個.env文件並填充以下環境變量:
OPENAI_API_KEY = your_openai_api_key
DATABASE_URL = your_postgres_url
LLM_MODEL = i am using 'gpt-4o'執行主腳本以初始化工作流並處理用戶查詢:
python main . py