Spaces:
Running
Running
mini fixes, faq sample upload
Browse files
examples/uploads/organon_demo/backend-scenarios-en.yaml
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- name: general_contraception_information # Must match the scenario name found in RAG graph
|
2 |
+
mode: retrieve_only # Literal[retrieve_llm, retrieve_only, llm_only, fixed_answer, sticky_answer]
|
3 |
+
min_pass_similarity_score: 0.55 # Custom value: if any answer is above, give three results
|
4 |
+
single_similarity_score: 0.86 # Custom value: is best answer is above, give single result
|
5 |
+
# min_similarity_score not used (stays -1.0) because it ditches all lower-score docs from results
|
6 |
+
- name: intrauterine_devices
|
7 |
+
mode: retrieve_only
|
8 |
+
min_pass_similarity_score: 0.55 # Sim Score = 2 * (1 - Distance) - 1
|
9 |
+
single_similarity_score: 0.86 # Sim Score = 2 * (1 - Distance) - 1
|
10 |
+
- name: contraceptive_injection
|
11 |
+
mode: retrieve_only
|
12 |
+
min_pass_similarity_score: 0.55
|
13 |
+
single_similarity_score: 0.86
|
14 |
+
- name: emergency_contraceptive_pills
|
15 |
+
mode: retrieve_only
|
16 |
+
min_pass_similarity_score: 0.55
|
17 |
+
single_similarity_score: 0.86
|
18 |
+
- name: contraceptive_implant
|
19 |
+
mode: retrieve_only
|
20 |
+
min_pass_similarity_score: 0.55
|
21 |
+
single_similarity_score: 0.86
|
22 |
+
- name: combined_contraceptive_pills
|
23 |
+
mode: retrieve_only
|
24 |
+
min_pass_similarity_score: 0.55
|
25 |
+
single_similarity_score: 0.86
|
26 |
+
- name: other_okay
|
27 |
+
mode: retrieve_only
|
28 |
+
min_pass_similarity_score: 0.55
|
29 |
+
single_similarity_score: 0.86
|
30 |
+
- name: own_side_effect
|
31 |
+
mode: fixed_answer
|
32 |
+
fixed_answer:
|
33 |
+
&abort_side_eff > # Anchors are added only for reference to old V1 template file
|
34 |
+
I'm not equipped to handle adverse events or other product-related queries. Your safety is
|
35 |
+
important to us, and we want to ensure you receive the appropriate support. Please report any
|
36 |
+
adverse events or concerns to our dedicated support team.
|
37 |
+
They can be reached at [email protected].
|
38 |
+
If you have any questions related to contraceptives or women's health, please feel free to ask,
|
39 |
+
and I'll provide you with the information you need.
|
40 |
+
keywords: [Mercilon, Marvelon, Implanon]
|
41 |
+
keyword_answer: &alternative_side_eff >
|
42 |
+
I'm not equipped to handle adverse events or other product-related queries. Your safety is
|
43 |
+
important to us, and we want to ensure you receive the appropriate support. Please report any
|
44 |
+
adverse events or concerns related to Organon products to our dedicated support team.
|
45 |
+
They can be reached at [email protected].
|
46 |
+
If you have any questions related to contraceptives or women's health, please feel free to ask,
|
47 |
+
and I'll provide you with the information you need.
|
48 |
+
- name: own_dosage
|
49 |
+
mode: fixed_answer
|
50 |
+
fixed_answer: &abort_dosage >
|
51 |
+
I'm not equipped to handle adverse events, dosage-related questions or other product-related
|
52 |
+
queries. Your safety is important to us, and we want to ensure you receive the appropriate
|
53 |
+
support. Please consult with the prescribing doctor about the details on how to use the
|
54 |
+
medication. For further information, please write a message to our dedicated support team.
|
55 |
+
They can be reached at [email protected].
|
56 |
+
If you have any questions related to contraceptives or women's health, please feel free to ask,
|
57 |
+
and I'll provide you with the information you need.
|
58 |
+
- name: brand_specific_information
|
59 |
+
mode: fixed_answer
|
60 |
+
fixed_answer: &brand_selection >
|
61 |
+
I appreciate your question about brand recommendations. For personalized advice related to
|
62 |
+
healthcare or specific products, it's always best to consult with a healthcare professional
|
63 |
+
who can consider your individual needs and provide tailored recommendations. They have the
|
64 |
+
expertise to guide you in the right direction.
|
65 |
+
If you have any questions related to contraceptives or women's health, please feel free to ask,
|
66 |
+
and I'll provide you with the information you need.
|
67 |
+
- name: greetings_hay
|
68 |
+
mode: fixed_answer
|
69 |
+
fixed_answer: &how_are_you_hi >
|
70 |
+
I am fine thanks, hope you feel the same! Feel free to ask any contraception related question.
|
71 |
+
- name: greetings_hi
|
72 |
+
mode: fixed_answer
|
73 |
+
fixed_answer: &say_hi >
|
74 |
+
Hi, nice to meet you! Feel free to ask any contraception related question.
|
75 |
+
- name: emailthanks
|
76 |
+
mode: fixed_answer
|
77 |
+
fixed_answer: &email_thanks >
|
78 |
+
Thank you. Could I help with something else?
|
79 |
+
- name: thanks
|
80 |
+
mode: fixed_answer
|
81 |
+
fixed_answer: &thanks_answer >
|
82 |
+
Not at all. Could I help with something else?
|
83 |
+
- name: confirmation
|
84 |
+
mode: fixed_answer
|
85 |
+
fixed_answer: &confirmation_answer >
|
86 |
+
Thank you. Could I help with something else?
|
87 |
+
- name: malicious
|
88 |
+
mode: sticky_answer
|
89 |
+
fixed_answer: &malicious_message >
|
90 |
+
I am sorry, but I feel you want me use in a wrong way.
|
91 |
+
If I feel it wrong, please try to rephrase your question.
|
92 |
+
Refresh your browser if you'd like to ask more questions.
|
examples/uploads/organon_demo/organon_en_copy.xlsx
ADDED
Binary file (66.9 kB). View file
|
|
lynxkite-lynxscribe/src/lynxkite_lynxscribe/lynxscribe_ops.py
CHANGED
@@ -89,7 +89,7 @@ class RAGTemplate(BaseModel):
|
|
89 |
scenario_data_sheet_name: str,
|
90 |
prompt_codes_sheet_name: str | None = None,
|
91 |
) -> "RAGTemplate":
|
92 |
-
"""Spawn a from an Excel file containing the two needed (plus one optional) sheets."""
|
93 |
|
94 |
def transform_codes(prompt_codes: pd.DataFrame) -> dict[str, str]:
|
95 |
"""Check and transform prompt codes table into a code dictionary."""
|
@@ -458,7 +458,7 @@ def ls_text_rag_loader(
|
|
458 |
@mem.cache
|
459 |
async def ls_faq_to_rag(
|
460 |
*,
|
461 |
-
faq_excel_path: str = "
|
462 |
vdb_provider_name: str = "faiss",
|
463 |
vdb_num_dimensions: int = 3072,
|
464 |
vdb_collection_name: str = "lynx",
|
@@ -543,7 +543,6 @@ async def ls_faq_to_rag(
|
|
543 |
|
544 |
@output_on_top
|
545 |
@op("LynxScribe RAG Graph Chatbot Builder")
|
546 |
-
# @mem.cache
|
547 |
def ls_rag_chatbot_builder(
|
548 |
rag_graph,
|
549 |
*,
|
@@ -564,7 +563,6 @@ def ls_rag_chatbot_builder(
|
|
564 |
node_types = [t.strip() for t in node_types.split(",")]
|
565 |
|
566 |
# handling inputs
|
567 |
-
# rag_graph = rag_graph[0]["rag_graph"] TODO: check why is it bad
|
568 |
rag_graph = rag_graph["rag_graph"]
|
569 |
|
570 |
parameters = {
|
@@ -743,7 +741,7 @@ async def get_chat_api(ws: str):
|
|
743 |
assert path.exists(), f"Workspace {path} does not exist"
|
744 |
ws = workspace.load(path)
|
745 |
contexts = await ops.EXECUTORS[ENV](ws)
|
746 |
-
nodes = [op for op in ws.nodes if op.data.title == "
|
747 |
[node] = nodes
|
748 |
context = contexts[node.id]
|
749 |
return context.last_result["chat_api"]
|
|
|
89 |
scenario_data_sheet_name: str,
|
90 |
prompt_codes_sheet_name: str | None = None,
|
91 |
) -> "RAGTemplate":
|
92 |
+
"""Spawn a RAGTemplate from an Excel file containing the two needed (plus one optional) sheets."""
|
93 |
|
94 |
def transform_codes(prompt_codes: pd.DataFrame) -> dict[str, str]:
|
95 |
"""Check and transform prompt codes table into a code dictionary."""
|
|
|
458 |
@mem.cache
|
459 |
async def ls_faq_to_rag(
|
460 |
*,
|
461 |
+
faq_excel_path: str = "",
|
462 |
vdb_provider_name: str = "faiss",
|
463 |
vdb_num_dimensions: int = 3072,
|
464 |
vdb_collection_name: str = "lynx",
|
|
|
543 |
|
544 |
@output_on_top
|
545 |
@op("LynxScribe RAG Graph Chatbot Builder")
|
|
|
546 |
def ls_rag_chatbot_builder(
|
547 |
rag_graph,
|
548 |
*,
|
|
|
563 |
node_types = [t.strip() for t in node_types.split(",")]
|
564 |
|
565 |
# handling inputs
|
|
|
566 |
rag_graph = rag_graph["rag_graph"]
|
567 |
|
568 |
parameters = {
|
|
|
741 |
assert path.exists(), f"Workspace {path} does not exist"
|
742 |
ws = workspace.load(path)
|
743 |
contexts = await ops.EXECUTORS[ENV](ws)
|
744 |
+
nodes = [op for op in ws.nodes if op.data.title == "LynxScribe RAG Graph Chatbot Backend"]
|
745 |
[node] = nodes
|
746 |
context = contexts[node.id]
|
747 |
return context.last_result["chat_api"]
|