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]]