Spaces:
Sleeping
Sleeping
Commit
·
9ab03b1
1
Parent(s):
ee03825
updated state and retrieval process
Browse files
business_interaction_agent/utils/state.py
CHANGED
|
@@ -7,7 +7,7 @@ class State(BaseModel):
|
|
| 7 |
model_config = ConfigDict(arbitrary_types_allowed=True)
|
| 8 |
|
| 9 |
class StateUpdateFormatter(BaseModel):
|
| 10 |
-
business_type:
|
| 11 |
platform: str = Field(description="The platform used for the business. If updated, the new one.")
|
| 12 |
target_audience: str = Field(description="The target audience of the business. If updated, the new one.")
|
| 13 |
business_goals: str = Field(description="The business goals of the business. If updated, the new one.")
|
|
|
|
| 7 |
model_config = ConfigDict(arbitrary_types_allowed=True)
|
| 8 |
|
| 9 |
class StateUpdateFormatter(BaseModel):
|
| 10 |
+
business_type: str = Field(description="The type of the business. If updated, the new one.")
|
| 11 |
platform: str = Field(description="The platform used for the business. If updated, the new one.")
|
| 12 |
target_audience: str = Field(description="The target audience of the business. If updated, the new one.")
|
| 13 |
business_goals: str = Field(description="The business goals of the business. If updated, the new one.")
|
business_interaction_agent/utils/utils.py
CHANGED
|
@@ -27,8 +27,8 @@ def manual_retrieval(messages, business_details):
|
|
| 27 |
# === Load SentenceTransformer model ===
|
| 28 |
|
| 29 |
# === Encode the query and search ===
|
| 30 |
-
query_embedding = ST.encode(str(messages)
|
| 31 |
-
top_k=
|
| 32 |
distances, indices = index.search(query_embedding, top_k)
|
| 33 |
|
| 34 |
|
|
@@ -40,7 +40,7 @@ def manual_retrieval(messages, business_details):
|
|
| 40 |
'rank': i + 1,
|
| 41 |
'username': df.iloc[idx]['username'],
|
| 42 |
'story': df.iloc[idx]['story'],
|
| 43 |
-
'
|
| 44 |
'likesCount': df.iloc[idx]['likesCount'],
|
| 45 |
'commentCount': df.iloc[idx]['commentCount'],
|
| 46 |
}
|
|
@@ -48,8 +48,8 @@ def manual_retrieval(messages, business_details):
|
|
| 48 |
inner_list = []
|
| 49 |
inner_list.append(f"[{res['rank']}]. The influencer name is: **{res['username']}** — Likes: **{res['likesCount']}**, Comments: **{res['commentCount']}**")
|
| 50 |
inner_list.append(f"The story of that particular video is:\n{res['story']}")
|
| 51 |
-
inner_list.append(f"The branding or promotion done is:\n{res['
|
| 52 |
|
| 53 |
outer_list.append(inner_list)
|
| 54 |
-
|
| 55 |
return str(outer_list).strip()
|
|
|
|
| 27 |
# === Load SentenceTransformer model ===
|
| 28 |
|
| 29 |
# === Encode the query and search ===
|
| 30 |
+
query_embedding = ST.encode(str(messages)).reshape(1, -1).astype('float32')
|
| 31 |
+
top_k=7
|
| 32 |
distances, indices = index.search(query_embedding, top_k)
|
| 33 |
|
| 34 |
|
|
|
|
| 40 |
'rank': i + 1,
|
| 41 |
'username': df.iloc[idx]['username'],
|
| 42 |
'story': df.iloc[idx]['story'],
|
| 43 |
+
'visible_texts_or_brandings': df.iloc[idx]['visible_texts_or_brandings'],
|
| 44 |
'likesCount': df.iloc[idx]['likesCount'],
|
| 45 |
'commentCount': df.iloc[idx]['commentCount'],
|
| 46 |
}
|
|
|
|
| 48 |
inner_list = []
|
| 49 |
inner_list.append(f"[{res['rank']}]. The influencer name is: **{res['username']}** — Likes: **{res['likesCount']}**, Comments: **{res['commentCount']}**")
|
| 50 |
inner_list.append(f"The story of that particular video is:\n{res['story']}")
|
| 51 |
+
inner_list.append(f"The branding or promotion done is:\n{res['visible_texts_or_brandings']}")
|
| 52 |
|
| 53 |
outer_list.append(inner_list)
|
| 54 |
+
print('THE RETRIEVALS ARE:', outer_list)
|
| 55 |
return str(outer_list).strip()
|