DriaAPIWrapper#

class langchain_community.utilities.dria_index.DriaAPIWrapper(api_key: str, contract_id: str | None = None, top_n: int = 10)[source]#

Wrapper around Dria API.

This wrapper facilitates interactions with Dria’s vector search and retrieval services, including creating knowledge bases, inserting data, and fetching search results.

Parameters:
  • api_key (str)

  • contract_id (str | None)

  • top_n (int)

api_key#

Your API key for accessing Dria.

contract_id#

The contract ID of the knowledge base to interact with.

top_n#

Number of top results to fetch for a search.

Methods

__init__(api_key[, contract_id, top_n])

create_knowledge_base(name, description, ...)

Create a new knowledge base.

insert_data(data)

Insert data into the knowledge base.

query_with_vector(vector)

Perform a vector-based query.

run(query)

Method to handle both text-based searches and vector-based queries.

search(query)

Perform a text-based search.

__init__(api_key: str, contract_id: str | None = None, top_n: int = 10)[source]#
Parameters:
  • api_key (str)

  • contract_id (str | None)

  • top_n (int)

create_knowledge_base(name: str, description: str, category: str, embedding: str) str[source]#

Create a new knowledge base.

Parameters:
  • name (str)

  • description (str)

  • category (str)

  • embedding (str)

Return type:

str

insert_data(data: List[Dict[str, Any]]) str[source]#

Insert data into the knowledge base.

Parameters:

data (List[Dict[str, Any]])

Return type:

str

query_with_vector(vector: List[float]) List[Dict[str, Any]][source]#

Perform a vector-based query.

Parameters:

vector (List[float])

Return type:

List[Dict[str, Any]]

run(query: str | List[float]) List[Dict[str, Any]] | None[source]#

Method to handle both text-based searches and vector-based queries.

Parameters:
  • query (str | List[float]) – A string for text-based search or a list of floats for

  • query. (vector-based)

Returns:

The search or query results from Dria.

Return type:

List[Dict[str, Any]] | None

search(query: str) List[Dict[str, Any]][source]#

Perform a text-based search.

Parameters:

query (str)

Return type:

List[Dict[str, Any]]