> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure AI Search

> Search Azure AI Search knowledge bases with text, vector, or hybrid search

## Overview

The Azure AI Search tool lets you search external knowledge bases backed by Azure AI Search that are registered in your Jinba Flow workspace. It supports text (keyword), vector (semantic), and hybrid search.

## Key Features

* `AZURE_AI_SEARCH`
  * Search an Azure AI Search external knowledge base registered in your workspace.
  * Key inputs: `query` (search query string), `externalKbId` (the external knowledge base to search, selectable from your workspace), and `indexName` (the index within that knowledge base).
  * Choose the search method with `searchType`: `text` (keyword search), `vector` (semantic search), or `hybrid` (text + vector, the default).
  * Control result volume with `answerTotal` (number of documents to reference for answers, default 5, max 1000), `vectorRetrievalCount` (number of vector search results for hybrid search, default 5, max 1000), and `skip` (pagination offset).
  * Narrow results with `filter` (an OData filter expression) and `select` (fields to return).
  * Results include `id`, `score`, `content`, `filename`, a direct `downloadUrl` for the source file, and `metadata`, plus `count` and `totalResults`.

## Authentication

The tool calls the Jinba Flow API on your behalf, so it is configured with a **Jinba Flow Workspace API Token** (`token` config) rather than an Azure credential. The Azure AI Search connection itself is managed on the external knowledge base registered in your workspace.

**Note**: Treat API tokens as sensitive information and never commit them to public repositories.

## Usage Examples

### Example: Hybrid Search over a Knowledge Base

```yaml theme={null}
- id: search_kb
  tool: AZURE_AI_SEARCH
  config:
    - name: token
      value: "{{secrets.JINBA_WORKSPACE_TOKEN}}"
  input:
    - name: externalKbId
      value: "YOUR_EXTERNAL_KB_ID"
    - name: indexName
      value: "product-manuals"
    - name: query
      value: "How do I reset the device to factory settings?"
    - name: searchType
      value: hybrid
    - name: answerTotal
      value: 5
```

### Example: Filtered Search Feeding an LLM Answer

```yaml theme={null}
- id: search_docs
  tool: AZURE_AI_SEARCH
  config:
    - name: token
      value: "{{secrets.JINBA_WORKSPACE_TOKEN}}"
  input:
    - name: externalKbId
      value: "YOUR_EXTERNAL_KB_ID"
    - name: indexName
      value: "support-articles"
    - name: query
      value: "warranty policy for enterprise plans"
    - name: searchType
      value: text
    - name: filter
      value: "category eq 'policy'"

- id: generate_answer
  tool: OPENAI_INVOKE
  input:
    - name: prompt
      value: |
        Answer the question using only the context below.

        Context:
        {{steps.search_docs.result.results[0].content}}

        Question: What is the warranty policy for enterprise plans?
```

## Notes

* The external knowledge base and its indexes must be registered in your workspace beforehand; `externalKbId` and `indexName` are selected from those registrations.
* `answerTotal` and `vectorRetrievalCount` are capped at 1000.
* When passing `select` as a string, it must be a JSON array (e.g., `'["title", "content"]'`).
* The tool runs in the context of a workspace; execution fails with an error if no workspace context is available.
