Toggle Menu
Prev Up Next

# `langchain_community.utilities.dria_index`.DriaAPIWrapper

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

  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 (Optional[str]) –

    - 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: Optional[str] = None, top_n: int = 10)
    Parameters

      - api_key (str) –

      - contract_id (Optional[str]) –

      - top_n (int) –

  create_knowledge_base(name: str, description: str, category: str, embedding: str) → str

    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

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

    Perform a vector-based query.

    Parameters

      vector (List[float]) –

    Return type

      List[Dict[str, Any]]

  run(query: Union[str, List[float]]) → Optional[List[Dict[str, Any]]]

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

    Parameters

      - query (Union[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

      Optional[List[Dict[str, Any]]]

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

    Perform a text-based search.

    Parameters

      query (str) –

    Return type

      List[Dict[str, Any]]