Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio import ChatMessage
|
|
|
|
| 3 |
from groq import Groq
|
| 4 |
import requests
|
| 5 |
import uvicorn
|
| 6 |
import os
|
| 7 |
import mysql.connector
|
|
|
|
| 8 |
|
| 9 |
from autogen import AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager
|
| 10 |
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
|
| 11 |
-
#from pathlib import Path
|
| 12 |
-
#from typing import Annotated
|
| 13 |
|
| 14 |
# MySQLに接続
|
| 15 |
conn = mysql.connector.connect(
|
|
@@ -94,32 +94,35 @@ async def autogen(qry: str):
|
|
| 94 |
},
|
| 95 |
)
|
| 96 |
|
|
|
|
| 97 |
# Create user proxy agent RetrieveUserProxyAgent(
|
| 98 |
ragproxyagent = RetrieveUserProxyAgent(
|
| 99 |
name="ragproxyagent",
|
| 100 |
human_input_mode="NEVER",
|
| 101 |
max_consecutive_auto_reply=3,
|
| 102 |
-
retrieve_config={
|
| 103 |
"task": "qa",
|
| 104 |
"docs_path": [
|
| 105 |
"https://www.ryhintl.com/hunting.md"
|
| 106 |
],
|
| 107 |
"chunk_token_size": 2000,
|
| 108 |
"model": config_list[0]["model"],
|
| 109 |
-
"vector_db": "
|
| 110 |
-
"collection_name": "
|
| 111 |
-
"db_config": {
|
| 112 |
-
"connection_string": "
|
| 113 |
-
"
|
| 114 |
-
"
|
| 115 |
-
"
|
| 116 |
-
"
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
"get_or_create": True, # set to False if you don't want to reuse an existing collection
|
| 119 |
"overwrite": True, # set to True if you want to overwrite an existing collection, each overwrite will force a index creation and reupload of documents
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
)
|
| 123 |
|
| 124 |
|
| 125 |
# Create a group chat between all agents
|
|
@@ -275,4 +278,4 @@ with gr.Blocks(js=js,title="人材スカウトのガイドライン") as llm:
|
|
| 275 |
)
|
| 276 |
|
| 277 |
if __name__ == "__main__":
|
| 278 |
-
llm.launch(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio import ChatMessage
|
| 3 |
+
#from crewai.tools import tool, BaseTool
|
| 4 |
from groq import Groq
|
| 5 |
import requests
|
| 6 |
import uvicorn
|
| 7 |
import os
|
| 8 |
import mysql.connector
|
| 9 |
+
from qdrant_client import QdrantClient
|
| 10 |
|
| 11 |
from autogen import AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager
|
| 12 |
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# MySQLに接続
|
| 15 |
conn = mysql.connector.connect(
|
|
|
|
| 94 |
},
|
| 95 |
)
|
| 96 |
|
| 97 |
+
client = QdrantClient(url="https://02cbe366-829e-43a6-adf5-3b712a886c21.us-west-1-0.aws.cloud.qdrant.io", api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3MiOiJtIn0.hWu5_qKaYHUhuMAjUScqw1R_1kkXiidv337wuGKcu9o")
|
| 98 |
# Create user proxy agent RetrieveUserProxyAgent(
|
| 99 |
ragproxyagent = RetrieveUserProxyAgent(
|
| 100 |
name="ragproxyagent",
|
| 101 |
human_input_mode="NEVER",
|
| 102 |
max_consecutive_auto_reply=3,
|
| 103 |
+
retrieve_config = {
|
| 104 |
"task": "qa",
|
| 105 |
"docs_path": [
|
| 106 |
"https://www.ryhintl.com/hunting.md"
|
| 107 |
],
|
| 108 |
"chunk_token_size": 2000,
|
| 109 |
"model": config_list[0]["model"],
|
| 110 |
+
"vector_db": "qdrant", # Qdrant Cloud database
|
| 111 |
+
"collection_name": "scouter_base",
|
| 112 |
+
#"db_config": {
|
| 113 |
+
#"connection_string": "https://02cbe366-829e-43a6-adf5-3b712a886c21.us-west-1-0.aws.cloud.qdrant.io", # Qdrant Cloud connection string
|
| 114 |
+
#"api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3MiOiJtIn0.hWu5_qKaYHUhuMAjUScqw1R_1kkXiidv337wuGKcu9o", # Qdrant Cloud API key
|
| 115 |
+
#"database_name": "human_database", # Qdrant Cloud database (if applicable)
|
| 116 |
+
#"index_name": "scout_index",
|
| 117 |
+
#"wait_until_index_ready": 120.0, # Setting to wait 120 seconds or until index is constructed before querying
|
| 118 |
+
#"wait_until_document_ready": 120.0, # Setting to wait 120 seconds or until document is properly indexed after insertion/update
|
| 119 |
+
#},
|
| 120 |
+
"db_config": {"client": client},
|
| 121 |
"get_or_create": True, # set to False if you don't want to reuse an existing collection
|
| 122 |
"overwrite": True, # set to True if you want to overwrite an existing collection, each overwrite will force a index creation and reupload of documents
|
| 123 |
+
},
|
| 124 |
+
code_execution_config=False, # set to False if you don't want to execute the code
|
| 125 |
+
)
|
| 126 |
|
| 127 |
|
| 128 |
# Create a group chat between all agents
|
|
|
|
| 278 |
)
|
| 279 |
|
| 280 |
if __name__ == "__main__":
|
| 281 |
+
llm.launch()
|