Skip to main content

llama-index packs cogniswitch_agent integration

Project description

Cogniswitch LlamaPack

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 a few simple steps

visit https://www.cogniswitch.ai/developer.

Registration:

  • Signup with your email and verify your registration
  • You will get a mail with a platform token and OAuth token for using the services.

Step 1: Download the CogniSwitch Llama pack:

  • Download the CogniswitchAgentPack either with the llama-cli or import using the code.

Step 2: Instantiate the CogniswitchAgentPack:

  • Instantiate the cogniswitch agent pack with all the credentials.

Step 3: Cogniswitch Store data:

  • Make the call to the agent by giving the file path or url to the agent input.
  • The agent will pick the tool and use the file/url and it will be processed and stored in your knowledge store.
  • You can check the status of document processing with a call to the agent. Alternatively you can also check in cogniswitch console.

Step 4: Cogniswitch Answer:

  • Make the call to the agent by giving query as agent input.
  • You will get the answer from your knowledge as the response.

CLI Usage

You can download llamapacks directly using llamaindex-cli, which comes installed with the llama-index python package:

llamaindex-cli download-llamapack CogniswitchAgentPack --download-dir ./cs_pack

Code Usage

import warnings

warnings.filterwarnings("ignore")
from llama_index.core.llama_packs import CogniswitchAgentPack
import os


### Cogniswitch Credentials and OpenAI token
# os.environ["OPENAI_API_KEY"] = <your openai token>
# cogniswitch_tool_args = {
#   "cs_token":<your cogniswitch platform token>,
#   "apiKey":<your cogniswitch apikey>
# }

cogniswitch_agent_pack = CogniswitchAgentPack(cogniswitch_tool_args)

From here, you can use the pack, or inspect and modify the pack in ./cs_pack.

The run() function is a light wrapper around agent.chat().

Use the cogniswitch agent for storing data in cogniswitch with a single call

response = cogniswitch_agent_pack.run(
    "Upload this URL- https://cogniswitch.ai/developer"
)

Use the cogniswitch agent to know the status of the document with a call

response = cogniswitch_agent_pack.run(
    "Tell me the status of https://cogniswitch.ai/developer"
)

Use the cogniswitch agent for answering with a single call

response = cogniswitch_agent_pack.run(
    "Answer the question- Tell me about cogniswitch"
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page