Spaces:
Sleeping
Sleeping
Upload 65 files
Browse files- src/agents/rag_agent_template/__pycache__/flow.cpython-311.pyc +0 -0
- src/agents/rag_agent_template/__pycache__/func.cpython-311.pyc +0 -0
- src/agents/rag_agent_template/__pycache__/prompt.cpython-311.pyc +0 -0
- src/apis/interfaces/__pycache__/file_processing_interface.cpython-311.pyc +0 -0
- src/apis/models/__pycache__/bot_models.cpython-311.pyc +0 -0
- src/apis/routers/__pycache__/rag_agent_template.cpython-311.pyc +0 -0
- src/apis/routers/rag_agent_template.py +33 -0
- src/config/__pycache__/llm.cpython-311.pyc +0 -0
- src/config/llm.py +10 -5
- src/utils/__pycache__/logger.cpython-311.pyc +0 -0
src/agents/rag_agent_template/__pycache__/flow.cpython-311.pyc
CHANGED
|
Binary files a/src/agents/rag_agent_template/__pycache__/flow.cpython-311.pyc and b/src/agents/rag_agent_template/__pycache__/flow.cpython-311.pyc differ
|
|
|
src/agents/rag_agent_template/__pycache__/func.cpython-311.pyc
CHANGED
|
Binary files a/src/agents/rag_agent_template/__pycache__/func.cpython-311.pyc and b/src/agents/rag_agent_template/__pycache__/func.cpython-311.pyc differ
|
|
|
src/agents/rag_agent_template/__pycache__/prompt.cpython-311.pyc
CHANGED
|
Binary files a/src/agents/rag_agent_template/__pycache__/prompt.cpython-311.pyc and b/src/agents/rag_agent_template/__pycache__/prompt.cpython-311.pyc differ
|
|
|
src/apis/interfaces/__pycache__/file_processing_interface.cpython-311.pyc
CHANGED
|
Binary files a/src/apis/interfaces/__pycache__/file_processing_interface.cpython-311.pyc and b/src/apis/interfaces/__pycache__/file_processing_interface.cpython-311.pyc differ
|
|
|
src/apis/models/__pycache__/bot_models.cpython-311.pyc
CHANGED
|
Binary files a/src/apis/models/__pycache__/bot_models.cpython-311.pyc and b/src/apis/models/__pycache__/bot_models.cpython-311.pyc differ
|
|
|
src/apis/routers/__pycache__/rag_agent_template.cpython-311.pyc
CHANGED
|
Binary files a/src/apis/routers/__pycache__/rag_agent_template.cpython-311.pyc and b/src/apis/routers/__pycache__/rag_agent_template.cpython-311.pyc differ
|
|
|
src/apis/routers/rag_agent_template.py
CHANGED
|
@@ -297,3 +297,36 @@ async def update_chatbot(chatbot_id: str, update_data: ChatbotUpdateRequest):
|
|
| 297 |
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
| 298 |
content={"error": f"Failed to update chatbot: {str(e)}"},
|
| 299 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
| 298 |
content={"error": f"Failed to update chatbot: {str(e)}"},
|
| 299 |
)
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
@router.delete("/chatbots/{chatbot_id}")
|
| 303 |
+
async def delete_chatbot(chatbot_id: str):
|
| 304 |
+
try:
|
| 305 |
+
existing_chatbot = await bot_crud.find_by_id(chatbot_id)
|
| 306 |
+
|
| 307 |
+
if not existing_chatbot:
|
| 308 |
+
return JSONResponse(
|
| 309 |
+
status_code=status.HTTP_404_NOT_FOUND,
|
| 310 |
+
content={"error": f"Chatbot with ID {chatbot_id} not found"},
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
deleted = await bot_crud.delete({"_id": ObjectId(chatbot_id)})
|
| 314 |
+
|
| 315 |
+
if not deleted:
|
| 316 |
+
return JSONResponse(
|
| 317 |
+
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
| 318 |
+
content={"error": "Failed to delete chatbot"},
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
logger.info(f"Deleted chatbot with ID: {chatbot_id}")
|
| 322 |
+
return JSONResponse(
|
| 323 |
+
status_code=status.HTTP_200_OK,
|
| 324 |
+
content={"message": "Chatbot deleted successfully"},
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
+
except Exception as e:
|
| 328 |
+
logger.error(f"Error deleting chatbot: {str(e)}")
|
| 329 |
+
return JSONResponse(
|
| 330 |
+
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
| 331 |
+
content={"error": f"Failed to delete chatbot: {str(e)}"},
|
| 332 |
+
)
|
src/config/__pycache__/llm.cpython-311.pyc
CHANGED
|
Binary files a/src/config/__pycache__/llm.cpython-311.pyc and b/src/config/__pycache__/llm.cpython-311.pyc differ
|
|
|
src/config/llm.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 2 |
from langchain_google_genai.embeddings import GoogleGenerativeAIEmbeddings
|
|
|
|
| 3 |
|
| 4 |
llm_2_0 = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=1, max_retries=2)
|
| 5 |
|
|
@@ -7,17 +8,21 @@ llm_2_5_flash_preview = ChatGoogleGenerativeAI(
|
|
| 7 |
model="gemini-2.5-flash-preview-05-20", temperature=1, max_retries=2
|
| 8 |
)
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
embeddings = GoogleGenerativeAIEmbeddings(model="models/text-embedding-004")
|
| 11 |
|
|
|
|
| 12 |
# Add this function for dynamic model selection
|
| 13 |
def get_llm(model_name: str, **kwargs):
|
| 14 |
if model_name == "gemini-2.0-flash":
|
| 15 |
return ChatGoogleGenerativeAI(
|
| 16 |
model="gemini-2.0-flash", temperature=0.1, max_retries=2, **kwargs
|
| 17 |
)
|
| 18 |
-
elif model_name == "
|
| 19 |
-
return
|
| 20 |
-
|
| 21 |
-
)
|
| 22 |
else:
|
| 23 |
-
raise ValueError(f"
|
|
|
|
| 1 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 2 |
from langchain_google_genai.embeddings import GoogleGenerativeAIEmbeddings
|
| 3 |
+
from langchain_openai import ChatOpenAI
|
| 4 |
|
| 5 |
llm_2_0 = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=1, max_retries=2)
|
| 6 |
|
|
|
|
| 8 |
model="gemini-2.5-flash-preview-05-20", temperature=1, max_retries=2
|
| 9 |
)
|
| 10 |
|
| 11 |
+
llm_4o_mini = ChatOpenAI(model="gpt-4o-mini")
|
| 12 |
+
llm_4o = ChatOpenAI(model="gpt-4o")
|
| 13 |
+
|
| 14 |
embeddings = GoogleGenerativeAIEmbeddings(model="models/text-embedding-004")
|
| 15 |
|
| 16 |
+
|
| 17 |
# Add this function for dynamic model selection
|
| 18 |
def get_llm(model_name: str, **kwargs):
|
| 19 |
if model_name == "gemini-2.0-flash":
|
| 20 |
return ChatGoogleGenerativeAI(
|
| 21 |
model="gemini-2.0-flash", temperature=0.1, max_retries=2, **kwargs
|
| 22 |
)
|
| 23 |
+
elif model_name == "gpt-4o-mini":
|
| 24 |
+
return ChatOpenAI(model="gpt-4o-mini", **kwargs)
|
| 25 |
+
elif model_name == "gpt-4o":
|
| 26 |
+
return ChatOpenAI(model="gpt-4o", **kwargs)
|
| 27 |
else:
|
| 28 |
+
raise ValueError(f"Unknown model: {model_name}")
|
src/utils/__pycache__/logger.cpython-311.pyc
CHANGED
|
Binary files a/src/utils/__pycache__/logger.cpython-311.pyc and b/src/utils/__pycache__/logger.cpython-311.pyc differ
|
|
|