Question about to how to mix chat history and KM filters #925
-
@dluc I already asked a similar question before, but there has been no response so far, so let me make a differently worded attempt. Imagine a scenario where user is uploading product related documents to KM, i.e. when calling ImportDocumentAsync, I set a tag productId on the documents uploaded. Now when the user wants to chat, we force user to first select a product from a dropdown so we can apply the productId filter. In the code, I have a system prompt that reads something like
The user can ask something like "Tell me the main features of product 'xxx'", in which case they will successfully get the features from the product docs. But then the user says, "Compose a sales email to a hospital administrator". This is where my issue is. I am unable to code this scenario, which includes chat history, KM filter and SK.
In the code below, where to fit the args variable? Or is there a different/better way to handle this? Any help will is most appreciated.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @bancroftway looks like you need an "intent detection" step before calling KM.
Step 2 is what I call "intent detection", and you can implement it using LLM Function Calling, e.g. passing to an LLM "case 1" and "case 2" as functions, asking to make a choice. This is likely about building an Agent who can have a conversation (chat history) and select plugins when necessary. In one call it can generate a chat answer or tell your app to call flowchart TD
classDef wrap text-wrap width:200px;
A["Define agent with 1 plugin:<br>Answer questions about<br>a product<br>given the product ID"]:::wrap
B["User talks to the agent"]:::wrap
C["Agent decides whether it<br>can chat or needs<br>the plugin.<br>Agent extracts product ID<br>from user input"]:::wrap
D["Agent decides to<br>use the plugin?"]:::wrap
E["Agent generates a response"]:::wrap
F["App calls plugin,<br>passing the product ID<br>chosen by the agent"]:::wrap
G["Plugin returns an answer"]:::wrap
H["Show answer"]:::wrap
A --> B
B --> C
C --> D
D -->|No| E
D -->|Yes| F
F --> G
E --> H
G --> H
H --> B
|
Beta Was this translation helpful? Give feedback.
Hi @bancroftway looks like you need an "intent detection" step before calling KM.
Let's take it from a person-to-person conversation,
A
is the end user,B
is a person from customer support:A
says somethingB
analyzes the message: is the user asking (case 1) a question about a product, or (case 2) something elseStep 2 is what I call "intent detection", and you can implement it using LLM Function Calling, e.g. passing to an LLM "case 1" and "case 2" as functions, asking to make a choice.
This is likely about building an Agent who can have a conversation (ch…