mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
919ebcc596
**Description**: CogniSwitch focusses on making GenAI usage more reliable. It abstracts out the complexity & decision making required for tuning processing, storage & retrieval. Using simple APIs documents / URLs can be processed into a Knowledge Graph that can then be used to answer questions. **Dependencies**: No dependencies. Just network calls & API key required **Tag maintainer**: @hwchase17 **Twitter handle**: https://github.com/CogniSwitch **Documentation**: Please check `docs/docs/integrations/toolkits/cogniswitch.ipynb` **Tests**: The usual tool & toolkits tests using `test_imports.py` PR has passed linting and testing before this submission. --------- Co-authored-by: Saicharan Sridhara <145636106+saiCogniswitch@users.noreply.github.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from typing import List
|
|
|
|
from langchain_community.agent_toolkits.base import BaseToolkit
|
|
from langchain_community.tools import BaseTool
|
|
from langchain_community.tools.cogniswitch.tool import (
|
|
CogniswitchKnowledgeRequest,
|
|
CogniswitchKnowledgeSourceFile,
|
|
CogniswitchKnowledgeSourceURL,
|
|
CogniswitchKnowledgeStatus,
|
|
)
|
|
|
|
|
|
class CogniswitchToolkit(BaseToolkit):
|
|
"""
|
|
Toolkit for CogniSwitch.
|
|
|
|
Use the toolkit to get all the tools present in the cogniswitch and
|
|
use them to interact with your knowledge
|
|
"""
|
|
|
|
cs_token: str # cogniswitch token
|
|
OAI_token: str # OpenAI API token
|
|
apiKey: str # Cogniswitch OAuth token
|
|
|
|
def get_tools(self) -> List[BaseTool]:
|
|
"""Get the tools in the toolkit."""
|
|
return [
|
|
CogniswitchKnowledgeStatus(
|
|
cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey
|
|
),
|
|
CogniswitchKnowledgeRequest(
|
|
cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey
|
|
),
|
|
CogniswitchKnowledgeSourceFile(
|
|
cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey
|
|
),
|
|
CogniswitchKnowledgeSourceURL(
|
|
cs_token=self.cs_token, OAI_token=self.OAI_token, apiKey=self.apiKey
|
|
),
|
|
]
|