mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-03 15:55:44 +00:00
Delete docs/extras/use_cases/cogniswitch_chain_usage.ipynb
This commit is contained in:
@@ -1,210 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "19062701",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Cogniswitch Chains\n",
|
||||
"\n",
|
||||
"**Use cogniswitch to have chat with your knowledge in just two steps**\n",
|
||||
"\n",
|
||||
"visit https://console.cogniswitch.ai:8443 to register.<br>\n",
|
||||
"\n",
|
||||
"**Registration steps:**\n",
|
||||
"- Signup with your email and verify your registration\n",
|
||||
"- You will get a mail with a platform token and oauth token for using the services.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"**step 1: Cogniswitch Store Chain:**<br>\n",
|
||||
"- Use your cogniswitch token, openAI API key, oauth token and your file or URL to run the chain. <br> \n",
|
||||
"- it will be processed and stored in your knowledge store. <br> \n",
|
||||
"- you can check the status of document processing in cogniswitch console. <br>\n",
|
||||
"\n",
|
||||
"**step 2: Cogniswitch Answer Chain:**<br>\n",
|
||||
"- Use your cogniswitch token, openAI API key, oauth token and your question to run the chain. <br>\n",
|
||||
"- You will get the answer from your knowledge as the response. <br>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1435b193",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Import necessary libraries"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "05df13dc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.chains.cogniswitch import CogniswitchAnswerChain\n",
|
||||
"from langchain.chains.cogniswitch import CogniswitchStoreChain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3476857f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Cogniswitch Store Chain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "320e02fc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Instantiate the Store chain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "89f58167",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cs_store = CogniswitchStoreChain()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "42c9890e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Run the chain with the cs token, openai token and either url or a file path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "5c6410e9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"response = cs_store.run({\"cs_token\": <Your cs token here>,\n",
|
||||
" \"OAI_token\": <your Openai API key here>,\n",
|
||||
" \"url\":\"https://cogniswitch.ai\",\n",
|
||||
" \"apiKey\": <your oauth token here>,\n",
|
||||
" })"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "794b4fba",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'data': {'knowledgeSourceId': 20, 'sourceType': 'https://cogniswitch.ai', 'sourceURL': None, 'sourceFileName': None, 'sourceName': None, 'sourceDescription': None, 'status': 'UPLOADED'}, 'list': None, 'message': \"We're processing your content & will send you an email on completion, hang tight!\", 'statusCode': 1000}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(response)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b5e9ca94",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Cogniswitch Answer Chain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c7d32067",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Instantiate the answer chain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "1365953e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cs_answer = CogniswitchAnswerChain()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0ba9aca9",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Run the chain with the cs token, openai token and the query"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "eb059787",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"resp = cs_answer.run({\"cs_token\": <Your cs token here>,\n",
|
||||
" \"query\":\"what is cogniswitch\",\n",
|
||||
" \"OAI_token\": <your Openai API key here>,\n",
|
||||
" \"apiKey\": <your oauth token here>,\n",
|
||||
" })"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "e73e963f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'data': {'answer': 'CogniSwitch is a technology developed by CogniSwitch Inc. It is designed to make Generative AI (Artificial Intelligence) reliable by utilizing enterprise knowledge. It auto-gathers and organizes knowledge from various sources, allowing experts to curate and visualize it before publication. The CogniSwitch API enables Gen AI applications to access this knowledge on-demand, ensuring reliability and eliminating hallucinations and bias.'}, 'list': None, 'message': None, 'statusCode': 1000}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(resp)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "fc5027e3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "langchain_repo",
|
||||
"language": "python",
|
||||
"name": "langchain_repo"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.17"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user