Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added WatsonX Customization and Advanced NeuralSeek Features #17

Merged
merged 8 commits into from
Nov 2, 2023
19 changes: 17 additions & 2 deletions docs/3-Create/Prepare/Core Components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ title: Core Components
1. [Create WatsonX custom extension](#3-create-watsonx-custom-extension)
1. [Configure WA action to integrate WatsonX Search using Watson Discovery](#4-configure-wa-action-to-integrate-watsonx-search-using-watson-discovery)
1. [Setup Watson Assistant](#3-setup-watson-assistant)
1. [WatsonX Customization](#customize-watsonx-actions)
1. [WatsonX Customization](#4-watsonx-customization)
- Add source link to response
- Configure model response by customizing prompt

Expand Down Expand Up @@ -99,7 +99,7 @@ title: Core Components
1. We can customize the preview background to match any organization homepage by "Change background" -> "Enter Url" option -> "Continue" -> Enter website url.

------------------------
### 4. WatsonX Customization<a name="wx-customization"></a>
### 4. WatsonX Customization<a name="4-watsonx-customization"></a>
#### Add source link to response
1. To add source link to the response, We need to configure two actions.
1. Navigate to "Seach" action
Expand All @@ -111,6 +111,17 @@ title: Core Components
- In step 10, in bottom of the 'Assistant says' text box, type
`For more information, click $source_url`, Enter.
- Save, and Close.

#### Filter confidence score from Watson Discovery
1. To access the confidence score of source link from watson discovery, we used expression such as`${step_474_result_2}.body.results[0].result_metadata.confidence`
1. We recommend setting a variable `confidence_score` to be used as a filter
1. Navigate to "Seach" action
- step 5, click "set new value" within the set variable values section.
- click "New session variable" from the dropdown, input Name `confidence_score`, select `Number` for Type, click "Apply".
- in the text box after 'To', select "Expression" from dropdown, and input for example `${step_474_result_2}.body.results[0].result_metadata.confidence`. Click "Apply".
- Save, and Close.
2. We could start setting conditions using `confidence_score` variable.

#### Configure model response by customizing prompt
1. When a user prompt Watson Assistant with keywords such as "answer in bullet points", we would like the model to output in bullet points format. This requires additional configuration in the "Generate Answer" actions.
1. Navigate to "Generate Answer" action
Expand All @@ -126,6 +137,10 @@ title: Core Components
("<s>[INST] <<SYS>>\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Be brief in your answers. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don’t know the answer to a question, please don’t share false information.\n<</SYS>>\n\nGenerate the next agent response in bullet points by answering the question. You are provided several documents with titles. If the answer comes from different documents please mention all possibilities and use the titles of documents to separate between topics or domains. If you cannot base your answer on the given documents, please state that you do not have an answer.\n\n").concat(${passages}).concat("\n\n").concat(${query_text}).concat("[/INST]")```
- ![Customize WatsonX Prompt](https://github.com/ibm-client-engineering/solution-ithelpdesk-watsonx/tree/main/docs/3-Create/Customize_WatsonX_Prompt.png)

#### Inactivity timeout
- In Watson Assistant, navigate to Environments.
- Click on the "Settings" icon next to Draft environment
- Navigate to "Inactivity timeout" to set the timeout limit
------------------------
## References
- [Language Model Conversational Search starter kit](https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/extensions/starter-kits/language-model-conversational-search)
Expand Down
29 changes: 28 additions & 1 deletion docs/3-Create/Prepare/Optional/Lendyr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,31 @@
id: solution-prepare-optional-lendyr
sidebar_position: 1
title: Lendyr
---
---
### Update serviceInstanceID and integrationID to connect to Watson Assistant
- In Watson Assistant, navigate to Integrations, and click "Open" for Web Chat, click "Confirm".
- Navigate to Embed tab and find the IDs for the following changes
- Use serviceInstanceID in `demoConstants.ts`. Change the `serviceInstanceID` for const DEMO_ASSISTANT
- Use integrationID in `enviornmentVariables.ts`. Change the `DEMO_ASSISTANT_INTEGRATION_ID` for case EnvironmentType.DEVELOPMENT

### Steps to Deployment
- In IBM Cloud, initiate a Kubernetes Services
- VPC
- In Kubernetes Services, Create a Namespace and Ingress
- Create a Namespace, e.g. `watson-assistant-<clinent-name>`
- Ingress is a outside connection that takes you inside to a pod or a service
- Ingress is like a load balancer and where we map DNS entry to URL, and will forward any matching
- URL and SSL certificate
- Create a link in a domain that you own
- Attach the SSL Certificate
- note: the certificate should be good for 90 days
- Export the certificate as a secret into the Kubernetes Cluster
- Build Docker File
- Configure Github Repo hosting
- Build CI/CD Pipeline (Travis, Github Actions,...)
- Travis File
- set branches

### IBM Cloud CLI
- Refer to [Getting started with the IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cli-getting-started)
-
15 changes: 15 additions & 0 deletions docs/3-Create/Prepare/Optional/NeuralSeek.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ title: NeuralSeek
- [Lite-WatsonX](#setup-NS-watsonx)
- [Create NeuralSeek custom extension](#create-neuralseek-custom-extension)
- [Create WA action to trigger NeuralSeek Search](#create-wa-action-to-trigger-neuralseek-search)
- [NeuralSeek Advanced Features](#neuralseek-advanced-features)

### Setup NeuralSeek and integrate with Watson Discovery<a name="setup-NS-lite"></a>

Expand Down Expand Up @@ -77,5 +78,19 @@ credentials for LLM
1. "New Step". In the "And then" section, select "go to a subaction" -> select "NeuralSeek Search" in the dropdown options -> "Apply".
1. "Save" and "Close"

### NeuralSeek Advanced Features<a name="neuralseek-advanced-features"></a>
- Enabled **Topic Continuity** through setting up session_id in WA: in the action step where we call out to use NeuralSeek extension, set parameters `user_session.system.session` To Expression `$system.session_id`
- Prompt Engineering:
1. Enabled **Consistent Answer Format** in through
- Within NeuralSeek: navitage to Configure > prompt engineering > Enabled
- Enter `When possible, answer the question in bulleted list form.`
2. Lower variance
- Enabled **Searching in different collections**
- in the Watson Assistant action step where we call out to use NeuralSeek extension, set parameters *options.filter* To `collection_id:"<collection-id>"`
- collection-id could be found in Watson Discovery: navigate to a collection and copy the url after `collections/`
- Enable **multilingual capability**: set parameters *options.language*
- Spanish: `es`
- Match input: `xx`

### References
- [Integrate NeuralSeek with Watson Assistant and Watson Discovery](https://developer.ibm.com/tutorials/integrate-neuralseek-with-watson-assistant-and-watson-discovery/)
Loading