Commit ·
25ae4fb
1
Parent(s): bcc42e1
updated agent again
Browse files
agent.py
CHANGED
|
@@ -189,13 +189,10 @@ def build_graph(provider: str = "groq"):
|
|
| 189 |
|
| 190 |
def retriever(state: MessagesState):
|
| 191 |
"""Retriever node"""
|
| 192 |
-
print(f"[Retriever] Input: {state['messages'][0].content}")
|
| 193 |
similar_question = vector_store.similarity_search(state["messages"][0].content)
|
| 194 |
-
print(f"[Retriever] similar_question: {similar_question}")
|
| 195 |
example_msg = HumanMessage(
|
| 196 |
content=f"Here I provide a similar question and answer for reference: \n\n{similar_question[0].page_content}",
|
| 197 |
)
|
| 198 |
-
print(f"[Retriever] Response: {example_msg}")
|
| 199 |
return {"messages": [sys_msg] + state["messages"] + [example_msg]}
|
| 200 |
|
| 201 |
builder = StateGraph(MessagesState)
|
|
|
|
| 189 |
|
| 190 |
def retriever(state: MessagesState):
|
| 191 |
"""Retriever node"""
|
|
|
|
| 192 |
similar_question = vector_store.similarity_search(state["messages"][0].content)
|
|
|
|
| 193 |
example_msg = HumanMessage(
|
| 194 |
content=f"Here I provide a similar question and answer for reference: \n\n{similar_question[0].page_content}",
|
| 195 |
)
|
|
|
|
| 196 |
return {"messages": [sys_msg] + state["messages"] + [example_msg]}
|
| 197 |
|
| 198 |
builder = StateGraph(MessagesState)
|
app.py
CHANGED
|
@@ -164,11 +164,9 @@ with gr.Blocks() as demo:
|
|
| 164 |
gr.Markdown(
|
| 165 |
"""
|
| 166 |
**Instructions:**
|
| 167 |
-
|
| 168 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 169 |
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 170 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 171 |
-
|
| 172 |
---
|
| 173 |
**Disclaimers:**
|
| 174 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
|
|
|
| 164 |
gr.Markdown(
|
| 165 |
"""
|
| 166 |
**Instructions:**
|
|
|
|
| 167 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 168 |
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 169 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
|
|
|
| 170 |
---
|
| 171 |
**Disclaimers:**
|
| 172 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|