Spaces:
Sleeping
Sleeping
Commit
·
fc0ebc0
1
Parent(s):
233c5fd
Updated prompts in business interaction
Browse files- my_agent/utils/initial_interaction.py +2 -28
- my_agent/utils/prompts.py +11 -1
- start.sh +0 -2
- vercel.json +0 -15
my_agent/utils/initial_interaction.py
CHANGED
|
@@ -6,7 +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 |
-
from .prompts import business_interaction_prompt
|
| 10 |
|
| 11 |
# Pydantic model for extracted business info
|
| 12 |
class DetailsFormatter(BaseModel):
|
|
@@ -47,25 +47,6 @@ class BusinessInteractionChatbot:
|
|
| 47 |
response = self.llm.invoke(messages)
|
| 48 |
return {"messages": [response]}
|
| 49 |
|
| 50 |
-
def _get_prompt_template(self):
|
| 51 |
-
return (
|
| 52 |
-
'''You are a business assistant who collects only valid and relevant data.
|
| 53 |
-
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.
|
| 54 |
-
|
| 55 |
-
We need these details:
|
| 56 |
-
1. Business Type (e.g., e-commerce, SaaS, consulting),
|
| 57 |
-
2. Platform(s) used (e.g., website, app, Instagram),
|
| 58 |
-
3. Target Audience (who are their customers or clients),
|
| 59 |
-
4. Business Goals (short-term or long-term objectives),
|
| 60 |
-
5. Offerings (products or services they provide),
|
| 61 |
-
6. Challenges faced (any current business problems or limitations).
|
| 62 |
-
|
| 63 |
-
Keep interacting until all valid details are collected.
|
| 64 |
-
|
| 65 |
-
VERY IMPORTANT: Once all valid details are received, say: '**Thanks for providing all your required business details.**'
|
| 66 |
-
'''
|
| 67 |
-
)
|
| 68 |
-
|
| 69 |
def chat(self, user_input: str):
|
| 70 |
self.messages.append({"role": "user", "content": user_input})
|
| 71 |
config = {"configurable": {"thread_id": "1"}}
|
|
@@ -78,14 +59,7 @@ VERY IMPORTANT: Once all valid details are received, say: '**Thanks for providin
|
|
| 78 |
return "Thanks for providing all your required business details" in latest_response
|
| 79 |
|
| 80 |
def extract_details(self):
|
| 81 |
-
template =
|
| 82 |
-
1. Business Type (e.g., e-commerce, SaaS, consulting),
|
| 83 |
-
2. Platform(s) used (e.g., website, app, Instagram),
|
| 84 |
-
3. Target Audience (who are their customers or clients),
|
| 85 |
-
4. Business Goals (short-term or long-term objectives),
|
| 86 |
-
5. Offerings (products or services they provide),
|
| 87 |
-
6. Challenges faced (any current business problems or limitations).
|
| 88 |
-
The conversation is:\n{business_state.interactions}'''
|
| 89 |
|
| 90 |
messages = [SystemMessage(content=template)]
|
| 91 |
response = self.llm.bind_tools([DetailsFormatter]).invoke(messages)
|
|
|
|
| 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 , details_extract_prompt
|
| 10 |
|
| 11 |
# Pydantic model for extracted business info
|
| 12 |
class DetailsFormatter(BaseModel):
|
|
|
|
| 47 |
response = self.llm.invoke(messages)
|
| 48 |
return {"messages": [response]}
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
def chat(self, user_input: str):
|
| 51 |
self.messages.append({"role": "user", "content": user_input})
|
| 52 |
config = {"configurable": {"thread_id": "1"}}
|
|
|
|
| 59 |
return "Thanks for providing all your required business details" in latest_response
|
| 60 |
|
| 61 |
def extract_details(self):
|
| 62 |
+
template = details_extract_prompt(business_state.interactions)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
messages = [SystemMessage(content=template)]
|
| 65 |
response = self.llm.bind_tools([DetailsFormatter]).invoke(messages)
|
my_agent/utils/prompts.py
CHANGED
|
@@ -76,4 +76,14 @@ We need these details:
|
|
| 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 |
-
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
'''
|
| 80 |
+
|
| 81 |
+
def details_extract_prompt(interactions):
|
| 82 |
+
return( f'''Extract the following details of the business from the conversation.
|
| 83 |
+
1. Business Type (e.g., e-commerce, SaaS, consulting),
|
| 84 |
+
2. Platform(s) used (e.g., website, app, Instagram),
|
| 85 |
+
3. Target Audience (who are their customers or clients),
|
| 86 |
+
4. Business Goals (short-term or long-term objectives),
|
| 87 |
+
5. Offerings (products or services they provide),
|
| 88 |
+
6. Challenges faced (any current business problems or limitations).
|
| 89 |
+
The conversation is:\n{interactions}''')
|
start.sh
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
uvicorn main:app --host 0.0.0.0 --port 10000
|
|
|
|
|
|
|
|
|
vercel.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"builds": [
|
| 3 |
-
{
|
| 4 |
-
"src": "main.py",
|
| 5 |
-
"use": "@vercel/python"
|
| 6 |
-
}
|
| 7 |
-
],
|
| 8 |
-
"routes": [
|
| 9 |
-
{
|
| 10 |
-
"src": "/(.*)",
|
| 11 |
-
"dest": "main.py"
|
| 12 |
-
}
|
| 13 |
-
]
|
| 14 |
-
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|