Skip to main content

Availability

RAG and datasource services are available to plugins that run in AI Studio. Studio plugins can build their own document ingestion and semantic search with these calls. The plugin controls chunking, embedding generation and storage. For example, a plugin can ingest a GitHub repository or a Confluence space with its own chunking strategy. The calls are functions of the ai_studio_sdk package. For the scope of each call, refer to Scopes.

Core RAG APIs

GenerateEmbedding

Generate embeddings for text chunks without storing them.
Expandable
Required Scope: datasources.embeddings Use Case: Custom chunking workflows where you generate embeddings first, then decide what to store.

StoreDocuments

Store pre-computed embeddings in the vector store without regenerating them.
Expandable
Required Scope: datasources.embeddings Use Case: Complete control over embeddings - use custom models, external services, or cached embeddings. Supported Vector Stores:
  • Pinecone, PGVector, Chroma (v0.2.5 or later) and Weaviate
  • Qdrant, with the Qdrant SDK installed
  • Redis, with RediSearch configured

ProcessAndStoreDocuments

Convenience method that generates embeddings and stores in one step.
Expandable
Required Scope: datasources.embeddings Use Case: Simplified workflow when you don’t need to inspect or cache embeddings.

QueryDatasource

Semantic search using a text query (embedding generated automatically).
Expandable
Required Scope: datasources.query Use Case: Standard semantic search - plugin provides text, system handles embedding.

QueryDatasourceByVector

Semantic search using a pre-computed embedding vector.
Expandable
Required Scope: datasources.query Use Case: Advanced workflows with custom query embeddings or hybrid search strategies. Supported Vector Stores: the same stores as StoreDocuments.

Complete Custom Ingestion Example

Building a GitHub repository documentation ingestion plugin:
Expandable

Datasource Configuration

For RAG APIs to work, datasources must be configured with: Embedder Configuration:
  • EmbedVendor: Embedder provider ("openai", "ollama", "vertex", "googleai")
  • EmbedModel: Model name (for example, "text-embedding-3-small" for OpenAI or "nomic-embed-text" for Ollama)
  • EmbedAPIKey: API key if required by embedder
  • EmbedUrl: Embedder endpoint URL
Vector Store Configuration:
  • DBSourceType: Vector store type ("pinecone", "chroma", "pgvector", "qdrant", "redis", "weaviate")
  • DBConnString: Connection URL for vector store
  • DBConnAPIKey: API key if required
  • DBName: Collection/namespace/table name
Important: Set EmbedModel to the model name, for example "text-embedding-3-small". Do not set it to the vendor name.

RAG Workflow Patterns

Pattern 1: Generate and Store Separately

Best for: Custom chunking algorithms, caching embeddings, using external embedding services.

Pattern 2: Process and Store in One Call

Best for: Simple ingestion when you don’t need to inspect or cache embeddings.
Best for: Advanced search strategies, query expansion, multi-vector search.

Datasource Management APIs

For managing datasources programmatically:
Expandable
Required Scopes: datasources.read (list/get/search), datasources.write (create/update/delete)

Error Handling

Expandable
Common Errors:
  • "datasource does not have embedder configured" - Set EmbedVendor/EmbedModel/EmbedAPIKey
  • "datasource does not have vector store configured" - Set DBSourceType/DBConnString/DBName
  • "failed to generate embeddings with openai/openai" - Set EmbedModel to the model name. Do not set it to the vendor.
  • "vector store connection failed" - Ensure vector store is running and accessible

Advanced Datasource Operations

These operations provide fine-grained control over vector store data through metadata filtering and namespace management.

Delete Documents by Metadata

Delete specific documents from vector stores using metadata filters:
Expandable
Parameters:
  • metadataFilter: map of metadata key-value pairs to match
  • filterMode: "AND" (all conditions must match) or "OR" (any condition matches)
  • dryRun: if true, returns count without deleting
Returns: Number of documents deleted (or would be deleted if dry-run) Scope Required: datasources.write

Query by Metadata Only

Query documents using only metadata filters (no vector similarity):
Expandable
Parameters:
  • metadataFilter: metadata key-value pairs to match
  • filterMode: "AND" or "OR"
  • limit: max results per page (1-100, default: 10)
  • offset: pagination offset
Returns: Array of results and total count (for pagination) Scope Required: datasources.query

List Namespaces

List all namespaces/collections in a vector store:
Returns: Array of namespace info with document counts Scope Required: datasources.read Note: Document count may be -1 if not supported by the vector store.

Delete Namespace

Delete an entire namespace/collection (bulk operation):
Parameters:
  • namespace: namespace/collection name to delete
  • confirm: must be true to proceed (safety check)
Scope Required: datasources.write Warning: This is a destructive operation that deletes all documents in the namespace. Use with caution. Supported Vector Stores:
  • Chroma, PGVector, Pinecone and Weaviate support all these operations.
  • Redis does not fully support delete and query by metadata.
  • Qdrant supports namespace management only.