Skip to content

Latest commit

 

History

History
500 lines (332 loc) · 28.7 KB

File metadata and controls

500 lines (332 loc) · 28.7 KB

Beta.Rag.SearchIndexes

Overview

Available Operations

register

Register (or re-register) a search index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.register(name="<value>", index={
        "type": "vespa",
        "k8s_cluster": "<value>",
        "k8s_namespace": "<value>",
        "vespa_instance_name": "<value>",
        "vespa_version": "<value>",
        "schemas": [
            {
                "name": "<value>",
                "fields": [],
                "sd": "<value>",
            },
        ],
        "query_url": "https://shiny-range.com/",
    }, status="offline")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
name str ✔️ N/A
index models.RegisterSearchIndexRequestIndexIndex ✔️ N/A
status Optional[models.RegisterSearchIndexRequestIndexStatus] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.RegisterSearchIndexResponseIndex

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_index_summaries

Fetch summary view of all indexes available to a user

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.get_index_summaries()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

List[models.GetSearchIndexSummaryResponseIndex]

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

unregister

Delete all information about an index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.unregister(index_id="0e59f390-f2e4-428e-a81c-c9c2f2ced09e")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

update_index_metrics

Update the metrics for a given index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.update_index_metrics(index_id="cb562a81-38ce-49a7-86ec-592676de32a8", request_body={
        "status": "online",
        "document_count": 864436,
        "schema_metrics": [
            {
                "name": "<value>",
                "document_count": 109412,
            },
        ],
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
request_body models.MetricsData ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get_index_detail

Get a detailed view of the stored data for a single index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.get_index_detail(index_id="f6ffec01-1f00-47ec-bf94-a08bdc049edc")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetSearchIndexDetailResponseIndex

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

set_index_summary

Update the summary field for an index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.set_index_summary(index_id="e77375ab-1284-42f3-9224-d42f3c120e57", summary="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
summary str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_index_schema_detail

Get a detailed view of the stored information for a schema

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.get_index_schema_detail(index_id="af850b81-3290-4f41-83af-f0d2ac1b070d", schema_id="fc2825a7-a8ef-4bec-9729-f7486e8327cb")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
schema_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetSearchIndexSchemaDetailResponseSchemaModel

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

set_schema_summary

Update the summary field for an index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.set_schema_summary(index_id="1a7d0662-5542-453a-8120-6e22a4fa6187", schema_id="bb5f0528-b652-4c47-81eb-574cb5c442a5", summary="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
schema_id str ✔️ N/A
summary str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_index_schema_file

Get Index Schema File

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.get_index_schema_file(index_id="252c6de5-4c9b-43b5-8c30-54524a59cb57", schema_id="93166e46-2e3c-4b20-b9a5-8607304372d2")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
schema_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetSearchIndexSchemaSDFileResponseSDFile

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

document_lookup

Fetch stored information about a retrievable element stored in an index

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.document_lookup(index_id="77308a24-2d8e-4392-9ab4-38770b2bb993", schema_id="1fe735e7-4ec0-4264-b715-12a944fe2b87", document_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
schema_id str ✔️ N/A
document_id str ✔️ the native ID in the underlying index
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VespaGetRetrievableResponseRetrievable

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

documents_fetch

Fetch a few stored retrievable elements from the index/schema

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.rag.search_indexes.documents_fetch(index_id="7c9f7007-1a54-48fd-b6da-93e91f31f6aa", schema_id="7eb7703c-1b80-4ecc-8a8b-288b43e1f30e")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
index_id str ✔️ N/A
schema_id str ✔️ N/A
group_id OptionalNullable[str] Only retrieve from this group
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

List[models.VespaGetRetrievableResponseRetrievable]

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*