Knowledge context
SWE now enables you to boost your application by creating a connect your pre-created knowledge base within Superwise application. For setup and indexing guidance, refer to pre-created Knowledge. This integration enhances your application's responsiveness and enriches user experience
Using the UI
Step 1: Add the Knowledge Context
Click on the "+ Context" button, and then SW Knowledge"
Step 2: Configure the Context
- Assign a meaningful name to the context.
- Select your pre created knowledge

Using the SDK
You can find the complete creation flow of the "AI Assistant Retrieval" application here. This SDK code snippet pertains to the creation of the Knowledge context within this flow.
from superwise_api.models.tool.tool import ToolConfigKnowledge, OpenAIEmbeddingModel, OpenAIEmbeddingModelVersion, UrlKnowledgeMetadata
from superwise_api.models.context.context import ContextDef
knowledge_context = ContextDef(
name='Context name',
config=ToolConfigKnowledge(
knowledge_id='Knowledge ID',
knowledge_metadata=UrlKnowledgeMetadata(url='URL', max_depth='MAX_DEPTH'),
embedding_model=OpenAIEmbeddingModel(version=OpenAIEmbeddingModelVersion.TEXT_EMBEDDING_ADA_002, api_key="Open AI key")
)
)
Updated 3 months ago