Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import json
|
2 |
import operator
|
|
|
3 |
from operator import itemgetter
|
4 |
from typing import Annotated, Sequence, TypedDict
|
5 |
|
@@ -37,6 +38,7 @@ from langgraph.checkpoint.aiosqlite import AsyncSqliteSaver
|
|
37 |
from langgraph.prebuilt import ToolExecutor, ToolInvocation
|
38 |
from qdrant_client import QdrantClient
|
39 |
from qdrant_client.models import Distance, VectorParams
|
|
|
40 |
|
41 |
# GLOBAL SCOPE - ENTIRE APPLICATION HAS ACCESS TO VALUES SET IN THIS SCOPE #
|
42 |
# ---- ENV VARIABLES ---- #
|
@@ -139,7 +141,7 @@ def create_qa_chain(retriever):
|
|
139 |
|
140 |
@tool
|
141 |
async def rag_tool(question: str) -> str:
|
142 |
-
"""
|
143 |
# advanced_rag_prompt=ChatPromptTemplate.from_template(INSTRUCTION_PROMPT_TEMPLATE.format(user_query=question))
|
144 |
parent_document_retriever_qa_chain = create_qa_chain(parent_document_retriever)
|
145 |
response = await parent_document_retriever_qa_chain.ainvoke({"question": question})
|
@@ -391,11 +393,11 @@ def parse_output(input_state):
|
|
391 |
|
392 |
# Run the agent chain with the input
|
393 |
# messages=agent_chain.invoke({"question": mental_health_counseling_data['test'][14]['Context']})
|
394 |
-
|
395 |
# ---------------------------------------------------------------------------------------------------------
|
396 |
# DEPLOYMENT
|
397 |
# ---------------------------------------------------------------------------------------------------------
|
398 |
-
|
399 |
|
400 |
@cl.author_rename
|
401 |
def rename(original_author: str):
|
|
|
1 |
import json
|
2 |
import operator
|
3 |
+
import uuid
|
4 |
from operator import itemgetter
|
5 |
from typing import Annotated, Sequence, TypedDict
|
6 |
|
|
|
38 |
from langgraph.prebuilt import ToolExecutor, ToolInvocation
|
39 |
from qdrant_client import QdrantClient
|
40 |
from qdrant_client.models import Distance, VectorParams
|
41 |
+
from langchain_core.messages import HumanMessage
|
42 |
|
43 |
# GLOBAL SCOPE - ENTIRE APPLICATION HAS ACCESS TO VALUES SET IN THIS SCOPE #
|
44 |
# ---- ENV VARIABLES ---- #
|
|
|
141 |
|
142 |
@tool
|
143 |
async def rag_tool(question: str) -> str:
|
144 |
+
"""Only use this tool to retrieve research relevant information from the knowledge base."""
|
145 |
# advanced_rag_prompt=ChatPromptTemplate.from_template(INSTRUCTION_PROMPT_TEMPLATE.format(user_query=question))
|
146 |
parent_document_retriever_qa_chain = create_qa_chain(parent_document_retriever)
|
147 |
response = await parent_document_retriever_qa_chain.ainvoke({"question": question})
|
|
|
393 |
|
394 |
# Run the agent chain with the input
|
395 |
# messages=agent_chain.invoke({"question": mental_health_counseling_data['test'][14]['Context']})
|
396 |
+
|
397 |
# ---------------------------------------------------------------------------------------------------------
|
398 |
# DEPLOYMENT
|
399 |
# ---------------------------------------------------------------------------------------------------------
|
400 |
+
|
401 |
|
402 |
@cl.author_rename
|
403 |
def rename(original_author: str):
|