llama-index-integrations/tools/llama-index-tools-cogniswitch/README.md
Use CogniSwitch to build production ready applications that can consume, organize and retrieve knowledge flawlessly. Using the framework of your choice, in this case LlamaIndex, CogniSwitch helps alleviate the stress of decision making when it comes to, choosing the right storage and retrieval formats. It also eradicates reliability issues and hallucinations when it comes to responses that are generated. Get started by interacting with your knowledge in just three simple steps
visit https://www.cogniswitch.ai/developer.
Registration:
Step 1: Instantiate the Cogniswitch ToolSpec:
Step 2: Instantiate the Agent:
Step 3: Cogniswitch Store data:
Step 4: Cogniswitch Answer:
import warnings
warnings.filterwarnings("ignore")
import os
from llama_index.tools.cogniswitch import CogniswitchToolSpec
from llama_index.core.agent import ReActAgent
# os.environ["OPENAI_API_KEY"] = <your openai token>
# cs_token = <your cogniswitch platform token>
# oauth_token = <your cogniswitch apikey>
toolspec = CogniswitchToolSpec(cs_token=cs_token, apiKey=oauth_token)
tool_lst = toolspec.to_tool_list()
agent = ReActAgent.from_tools(tool_lst)
store_response = agent.chat(
"""
https://cogniswitch.ai/developer
this site is about cogniswitch website for developers.
"""
)
print(store_response)
{'data': {'knowledgeSourceId': 43, 'sourceType': 'https://cogniswitch.ai/developer', 'sourceURL': None, 'sourceFileName': None, 'sourceName': 'Cogniswitch dev', 'sourceDescription': 'This is a cogniswitch website for developers.', 'status': 'UPLOADED'}, 'list': None, 'message': "We're processing your content & will send you an email on completion, hang tight!", 'statusCode': 1000}
response = agent.chat("Tell me the status of Cogniswitch Developer Website")
print(response)
The document "Cogniswitch Developer Website" is currently being processed.
answer_response = agent.chat("tell me about cogniswitch")
print(answer_response)
{'data': {'answer': 'CogniSwitch is a technology platform that enhances the reliability of Generative AI applications for enterprises. It does this by gathering and organizing knowledge from documented sources, eliminating hallucinations and bias in AI responses. The platform uses AI to automatically gather and organize knowledge, which can then be reviewed and curated by experts before being published. The CogniSwitch API enables Gen AI applications to access this knowledge as needed, ensuring reliability. It is specifically designed to complement Generative AI and offers customized solutions for different business functions within an enterprise.'}, 'list': None, 'message': None, 'statusCode': 1000}
The tool is designed to store data and retrieve answers based on the knowledge provided. check out the link for examples.