Spaces:
Sleeping
Sleeping
Commit
·
08e66b4
1
Parent(s):
9adee2f
Updated the prompts
Browse files- my_agent/__pycache__/agent.cpython-312.pyc +0 -0
- my_agent/agent.py +4 -4
- my_agent/utils/__pycache__/initial_interaction.cpython-312.pyc +0 -0
- my_agent/utils/__pycache__/nodes.cpython-312.pyc +0 -0
- my_agent/utils/__pycache__/prompts.cpython-312.pyc +0 -0
- my_agent/utils/__pycache__/tools.cpython-312.pyc +0 -0
- my_agent/utils/initial_interaction.py +2 -1
- my_agent/utils/prompts.py +18 -0
- my_agent/utils/tools.py +0 -1
my_agent/__pycache__/agent.cpython-312.pyc
CHANGED
|
Binary files a/my_agent/__pycache__/agent.cpython-312.pyc and b/my_agent/__pycache__/agent.cpython-312.pyc differ
|
|
|
my_agent/agent.py
CHANGED
|
@@ -37,7 +37,7 @@ def build_graph_old():
|
|
| 37 |
|
| 38 |
def build_graph():
|
| 39 |
builder = StateGraph(State)
|
| 40 |
-
|
| 41 |
builder.add_node(retrieve)
|
| 42 |
builder.add_node(generate_story)
|
| 43 |
builder.add_node(generate_brainstroming)
|
|
@@ -46,12 +46,12 @@ def build_graph():
|
|
| 46 |
|
| 47 |
|
| 48 |
# Normal edges
|
| 49 |
-
|
|
|
|
| 50 |
|
| 51 |
-
builder.add_edge(START, "retrieve")
|
| 52 |
builder.add_edge("retrieve", "generate_story")
|
| 53 |
|
| 54 |
-
# builder.add_edge("caption_image", "retrieve")
|
| 55 |
# builder.add_edge("retrieve", "generate_story")
|
| 56 |
builder.add_edge("generate_story", "generate_brainstroming")
|
| 57 |
|
|
|
|
| 37 |
|
| 38 |
def build_graph():
|
| 39 |
builder = StateGraph(State)
|
| 40 |
+
builder.add_node(caption_image)
|
| 41 |
builder.add_node(retrieve)
|
| 42 |
builder.add_node(generate_story)
|
| 43 |
builder.add_node(generate_brainstroming)
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
# Normal edges
|
| 49 |
+
builder.add_edge(START, "caption_image")
|
| 50 |
+
builder.add_edge("caption_image", "retrieve")
|
| 51 |
|
| 52 |
+
# builder.add_edge(START, "retrieve")
|
| 53 |
builder.add_edge("retrieve", "generate_story")
|
| 54 |
|
|
|
|
| 55 |
# builder.add_edge("retrieve", "generate_story")
|
| 56 |
builder.add_edge("generate_story", "generate_brainstroming")
|
| 57 |
|
my_agent/utils/__pycache__/initial_interaction.cpython-312.pyc
CHANGED
|
Binary files a/my_agent/utils/__pycache__/initial_interaction.cpython-312.pyc and b/my_agent/utils/__pycache__/initial_interaction.cpython-312.pyc differ
|
|
|
my_agent/utils/__pycache__/nodes.cpython-312.pyc
CHANGED
|
Binary files a/my_agent/utils/__pycache__/nodes.cpython-312.pyc and b/my_agent/utils/__pycache__/nodes.cpython-312.pyc differ
|
|
|
my_agent/utils/__pycache__/prompts.cpython-312.pyc
CHANGED
|
Binary files a/my_agent/utils/__pycache__/prompts.cpython-312.pyc and b/my_agent/utils/__pycache__/prompts.cpython-312.pyc differ
|
|
|
my_agent/utils/__pycache__/tools.cpython-312.pyc
CHANGED
|
Binary files a/my_agent/utils/__pycache__/tools.cpython-312.pyc and b/my_agent/utils/__pycache__/tools.cpython-312.pyc differ
|
|
|
my_agent/utils/initial_interaction.py
CHANGED
|
@@ -6,6 +6,7 @@ from langchain_core.messages import SystemMessage
|
|
| 6 |
from pydantic import BaseModel, ConfigDict, Field
|
| 7 |
from typing import Optional, List
|
| 8 |
from .models_loader import llm
|
|
|
|
| 9 |
|
| 10 |
# Pydantic model for extracted business info
|
| 11 |
class DetailsFormatter(BaseModel):
|
|
@@ -41,7 +42,7 @@ class BusinessInteractionChatbot:
|
|
| 41 |
return workflow
|
| 42 |
|
| 43 |
def _call_model(self, state):
|
| 44 |
-
template =
|
| 45 |
messages = [SystemMessage(content=template)] + state["messages"]
|
| 46 |
response = self.llm.invoke(messages)
|
| 47 |
return {"messages": [response]}
|
|
|
|
| 6 |
from pydantic import BaseModel, ConfigDict, Field
|
| 7 |
from typing import Optional, List
|
| 8 |
from .models_loader import llm
|
| 9 |
+
from .prompts import business_interaction_prompt
|
| 10 |
|
| 11 |
# Pydantic model for extracted business info
|
| 12 |
class DetailsFormatter(BaseModel):
|
|
|
|
| 42 |
return workflow
|
| 43 |
|
| 44 |
def _call_model(self, state):
|
| 45 |
+
template = business_interaction_prompt
|
| 46 |
messages = [SystemMessage(content=template)] + state["messages"]
|
| 47 |
response = self.llm.invoke(messages)
|
| 48 |
return {"messages": [response]}
|
my_agent/utils/prompts.py
CHANGED
|
@@ -59,3 +59,21 @@ I want to create a detailed storyline for a video in the given topic. You have t
|
|
| 59 |
|
| 60 |
**Final Reminder** You have to strongly focus on these topics while creating the storyline: {[item for sublist in final_state['preferred_topics'] for item in sublist]}'''
|
| 61 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
**Final Reminder** You have to strongly focus on these topics while creating the storyline: {[item for sublist in final_state['preferred_topics'] for item in sublist]}'''
|
| 61 |
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
business_interaction_prompt = '''
|
| 65 |
+
You are a business assistant who collects only valid and relevant data.
|
| 66 |
+
Your job is to gather details from business owners in a friendly and conversational manner to understand their business better. Ask in very easy and short way.
|
| 67 |
+
|
| 68 |
+
We need these details:
|
| 69 |
+
1. Business Type (e.g., e-commerce, SaaS, consulting),
|
| 70 |
+
2. Platform(s) used (e.g., website, app, Instagram),
|
| 71 |
+
3. Target Audience (who are their customers or clients),
|
| 72 |
+
4. Business Goals (short-term or long-term objectives),
|
| 73 |
+
5. Offerings (products or services they provide),
|
| 74 |
+
6. Challenges faced (any current business problems or limitations).
|
| 75 |
+
|
| 76 |
+
Keep interacting until all valid details are collected.
|
| 77 |
+
|
| 78 |
+
VERY IMPORTANT: Once all valid details are received, say: '**Thanks for providing all your required business details.**'
|
| 79 |
+
'''
|
my_agent/utils/tools.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
from langchain_core.messages import SystemMessage
|
| 2 |
from langchain_groq import ChatGroq
|
| 3 |
from pydantic import BaseModel, Field
|
| 4 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
| 1 |
from langchain_groq import ChatGroq
|
| 2 |
from pydantic import BaseModel, Field
|
| 3 |
from dotenv import load_dotenv
|