Creating a Knowledge Base
Use the+ button in a chosen Project and select Knowledge Base > Internal.
Press Create Knowledge, the following modal will appear:

Adding a source
You are then taken to the source management page. A source represents a document that is loaded within your Knowledge Base. This document’s information will then be used when referencing and querying the Knowledge Base. Documents needs to be loaded ahead of time so that they can be parsed and cut into chunks. Language models will then use the loaded information as source for answering user queries. To load a new source, select the Add Source button. Here you can add any document of the following format: TXT, PDF, DOCX, CSV, XML.
Chunk Settings and Strategies
Chunks are portions of a source document loaded within a Knowledge Base. When adding a new source to a Knowledge Base, you can decide how this source’s information will be chunked. Larger chunks will hold more relevant information but will imply more token use when sent to a model, impacting the generation cost.Token
Token
| Parameter | Description | Default |
|---|---|---|
chunk_size | Maximum tokens per chunk | 512 |
chunk_overlap | Number of tokens to overlap between chunks | 0 |
Sentence
Sentence
| Parameter | Description | Default |
|---|---|---|
chunk_size | Maximum tokens per chunk | 512 |
chunk_overlap | Number of overlapping tokens between chunks | 0 |
min_sentences_per_chunk | Minimum number of sentences per chunk | 1 |
Recursive
Recursive
| Parameter | Description | Default |
|---|---|---|
chunk_size | Maximum tokens per chunk | 512 |
separators | Hierarchy of separators to use | ["\n\n", "\n", " ", ""] |
min_characters_per_chunk | Minimum characters allowed per chunk | 24 |
Semantic
Semantic
| Parameter | Description | Default |
|---|---|---|
chunk_size | Maximum tokens per chunk | 512 |
embedding_model | Embedding model for similarity (required) | - |
dimensions | Number of dimensions for embedding output | - |
threshold | Similarity threshold (0-1) or “auto" | "auto” |
mode | Chunking mode: “window” or “sentence" | "window” |
similarity_window | Window size for similarity comparison | 1 |
Agentic
Agentic
| Parameter | Description | Default |
|---|---|---|
model | LLM model to use for chunking (required) | - |
chunk_size | Maximum tokens per chunk | 1024 |
candidate_size | Size of candidate splits for LLM evaluation | 128 |
min_characters_per_chunk | Minimum characters allowed per chunk | 24 |
Fast
Fast
| Parameter | Description | Default |
|---|---|---|
target_size | Target chunk size in bytes | 4096 |
delimiters | Single-byte delimiters to split on (e.g., "\n.?!") | "\n.?" |
pattern | Multi-byte pattern for splitting (e.g., "▁" for SentencePiece) | - |
prefix | Attach delimiter to start of next chunk | false |
consecutive | Split at START of consecutive delimiter runs | false |
forward_fallback | Search forward if no delimiter found backward | false |
| Use Case | Recommended Strategy |
|---|---|
| Large files (>1MB) | Fast - 2x faster, 3x less memory |
| RAG with precise tokens | Token or Recursive |
| Semantic search | Semantic |
| Complex document understanding | Agentic |
| General purpose | Recursive |
Default
Default
Advanced
Advanced
Data Cleanup
You can choose to modify the data loaded within your sources, this can be great to clean the chunks or anonymize data. To activate each cleanup, simply toggle on the option within the data cleanup panel.
Summary and Cost Estimation
Once your document has been processed, the following summary will be displayed:
Retrieval Settings
You can configure these options on the Knowledge Settings page. Each option will yield different results, depending on your needs.Search Methods
Vector Search
Vector Search
Keyword Search
Keyword Search
Hybrid Search
Hybrid Search
Search Parameters
All previous search types can be configured with the following parameters:Chunk limit
Chunk limit
Threshold
Threshold
Reranking
Reranking invokes a model that analyzes your initial query and the result fetched by the Knowledge Base search. This model then scores the similarity of the chunks returned with the user query, then scores and ranks the chunks accordingly. This ensures the results is the most relevant for your query.
Knowledge Settings
By choosing the Knowledge Settings button, you can configure the following settings.Embedding Models
Here, you can configure which llm model to use to query the Knowledge Base. Your configuration here is similar to any model configuration within Playground, Experiment, Deployment, and Agent and includes the usual parameters
Agentic RAG

- Document Grading, which ensures relevant chunks are retrieved.
- Query Refinement, improving the query if needed.
Example: Query Refinement
Example: Query Refinement
is my suitcase too big? is reformulated to luggage size requirements and restrictions for carry-on and checked baggage
Chunk Metadata
Each chunk in a Knowledge Base can carry a metadata object: a set of key-value pairs that describe the chunk’s origin, topic, or any custom attribute relevant to your use case. Metadata lets you store all your content in a single Knowledge Base while still scoping retrieval to exactly the right subset of chunks at query time. For example, you can tag each chunk with aclient, source, or topic field, then pass a filter at search time to return only the chunks that match.
Common use cases:
- Multi-tenant RAG: tag chunks by
client_idto isolate results per customer. - Source filtering: filter by
filetypeorsourceto restrict results to PDFs, support tickets, or a specific data feed. - Topic scoping: tag chunks by
topicorcategoryand filter queries to stay on a single subject.
Editing Chunk Metadata
Open a chunk from the datasource view to access the Edit Chunk panel. The panel has three sections:- Text: the chunk content.
- Metadata: a JSON editor pre-filled with the current metadata, or
{}if none has been set. - Enabled: toggle to enable or disable the chunk.
- Valid JSON syntax, otherwise an error is shown.
- All values must be strings, numbers, or booleans. Nested arrays or objects are not supported.

Metadata Filtering in Search
Pass afilter object to the search API to restrict results to chunks whose metadata matches the specified conditions. See Knowledge Base via the API for examples.
Searching a Knowledge Base
Once your Knowledge Base is populated, you can query it in four ways.Test via the Studio
Test via the Studio

Integrate to a Deployment
Integrate to a Deployment
- Open the Deployment’s configuration and go to Knowledge Bases.
- Select Knowledge Base and choose your Knowledge Base.
- Set the query type:
- Last User Message: the user’s latest message is used as the search query automatically.
- Query: use a predefined query. You can make it dynamic with an input variable such as
{{query}}.
- Reference the retrieved chunks in your prompt with the
{{knowledge_base_key}}syntax. If not explicitly referenced, the chunks are appended to the end of the system message.
Integrate to an Agent
Integrate to an Agent
query_knowledge_base tool automatically.- In the Agent configuration, go to the Context section and click Add context.
- Select your Knowledge Base.
- In the Agent’s Instructions, explicitly tell it to use the Knowledge Base. For example:
“First useretrieve_knowledge_basesto see what knowledge sources are available, then usequery_knowledge_baseto find relevant information before answering.”
Search via the API
Search via the API
Connecting an External Knowledge Base
To connect to an external Knowledge Base, choose the+ button on the desired Project.


| Field | Description | Example |
|---|---|---|
| Key | Unique Identifier, alphanumeric with hyphens/underscore | external_kb |
| Description | Description | External Knowledge Base |
| Name | Display Name | External Knowledge Base Name |
| API URL | URL to search knowledge base, must be HTTPS | https://api.example.org/search |
| API Key | Authentication API key to the previously API URL. Orq will use Bearer Authentication Header to call your API. | <API_KEY> |
Authorization: Bearer <API_KEY> header when calling your endpoint.API Payloads
Here are example payloads for request and response expected from your API.Request Payload
Request Payload
Response Payload
Response Payload
Example Implementation for an External API
We’ve created example implementation for External Knowledge Base API.Python Implementation
An Example Python Server for External Knowledge Base
Python Implementation
An Example Python Server for External Knowledge Base
Get the Code
Node.js Implementation
An Example Node Server for External Knowledge Base
Node.js Implementation
An Example Node Server for External Knowledge Base
Get the Code
Integrating Vector Database Providers
We support providers like Weaviate and Pinecone, as both platforms expose REST APIs that conform to the expected payload format documented above. Integration ExamplesCommon Errors and Troubleshooting
| Scenario | Error Message |
|---|---|
| HTTP instead of HTTPS | ”External knowledge base URL must use HTTPS protocol” |
| Local/private IP | ”External knowledge base URL cannot point to local network” |
| API unreachable | ”Failed to verify external knowledge base connectivity” |
| API timeout (>50s) | “External API request timed out” |
- Verify your API endpoint is publicly accessible via HTTPS
- Check your API logs for incoming requests from orq.ai IP addresses
- Verify your firewall/security groups allow inbound HTTPS traffic
- Verify the API key is correct and has not expired
- Check that your API expects Bearer authentication in the
Authorizationheader - Confirm your API key has the necessary permissions to perform searches
- Verify your API returns the expected response format (see Response Payload above)
- Check that
scores.search_scorevalues are between 0 and 1 - Test with different
thresholdvalues (lower threshold = more results) - If using reranking, ensure both
search_scoreandrerank_scoreare provided - Verify your external vector database has sufficient indexed documents
- Monitor your external API response times
- Consider implementing caching for frequently searched queries
- Optimize your vector database indexes
- Check if your external API is rate limiting requests
Configuring your External Knowledge Base
- Agentic RAG, to handle knowledge base search refinement with an agent, through orq.ai’s system.
- Search retrieval parameters, Chunk Limit, Search Threshold
- Reranking Models
- Use it just like any other Knowledge Base, to learn more see Using a Knowledge Base in a Prompt.
- Your knowledge base can also be used with Agents, see using Knowledge Bases with Agent.
- Your API will be called at runtime when the model needs to perform a search.
Retrieval Logs
When Using a Knowledge Base in a Prompt within Playground, Experiment, Deployment, or Agent, logs are generated and will transparently contain details of how Knowledge Bases were accessed. To find logs, head to the Logs tabs within the module you’re in, then select one log to open the detail panel for one log entry. The following panel will open.