TitanTakeoffEmbed#

class langchain_community.embeddings.titan_takeoff.TitanTakeoffEmbed(base_url: str = 'http://localhost', port: int = 3000, mgmt_port: int = 3001, models: List[ReaderConfig] = [])[source]#

Interface with Takeoff Inference API for embedding models.

Use it to send embedding requests and to deploy embedding readers with Takeoff.

Examples

This is an example how to deploy an embedding model and send requests.

Initialize the Titan Takeoff embedding wrapper.

Parameters:
  • base_url (str, optional) – The base url where Takeoff Inference Server is

  • "http (listening. Defaults to) – //localhost”.

  • port (int, optional) – What port is Takeoff Inference API listening on.

  • 3000. (Defaults to) –

  • mgmt_port (int, optional) – What port is Takeoff Management API listening on.

  • 3001. (Defaults to) –

  • models (List[ReaderConfig], optional) – Any readers you’d like to spin up on.

  • []. (Defaults to) –

Raises:
  • ImportError – If you haven’t installed takeoff-client, you will get an

  • ImportError. To remedy run pip install 'takeoff-client==0.4.0'

Attributes

base_url

//localhost".

client

Takeoff Client Python SDK used to interact with Takeoff API

embed_consumer_groups

The consumer groups in Takeoff which contain embedding models

mgmt_port

The management port of the Titan Takeoff (Pro) server.

port

The port of the Titan Takeoff (Pro) server.

Methods

__init__([base_url, port, mgmt_port, models])

Initialize the Titan Takeoff embedding wrapper.

aembed_documents(texts)

Asynchronous Embed search docs.

aembed_query(text)

Asynchronous Embed query text.

embed_documents(texts[, consumer_group])

Embed documents.

embed_query(text[, consumer_group])

Embed query.

__init__(base_url: str = 'http://localhost', port: int = 3000, mgmt_port: int = 3001, models: List[ReaderConfig] = [])[source]#

Initialize the Titan Takeoff embedding wrapper.

Parameters:
  • base_url (str, optional) – The base url where Takeoff Inference Server is

  • "http (listening. Defaults to) – //localhost”.

  • port (int, optional) – What port is Takeoff Inference API listening on.

  • 3000. (Defaults to) –

  • mgmt_port (int, optional) – What port is Takeoff Management API listening on.

  • 3001. (Defaults to) –

  • models (List[ReaderConfig], optional) – Any readers you’d like to spin up on.

  • []. (Defaults to) –

Raises:
  • ImportError – If you haven’t installed takeoff-client, you will get an

  • ImportError. To remedy run pip install 'takeoff-client==0.4.0'

async aembed_documents(texts: List[str]) List[List[float]]#

Asynchronous Embed search docs.

Parameters:

texts (List[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

List[List[float]]

async aembed_query(text: str) List[float]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

List[float]

embed_documents(texts: List[str], consumer_group: str | None = None) List[List[float]][source]#

Embed documents.

Parameters:
  • texts (List[str]) – List of prompts/documents to embed

  • consumer_group (Optional[str], optional) – Consumer group to send request

  • None. (to containing embedding model. Defaults to) –

Returns:

List of embeddings

Return type:

List[List[float]]

embed_query(text: str, consumer_group: str | None = None) List[float][source]#

Embed query.

Parameters:
  • text (str) – Prompt/document to embed

  • consumer_group (Optional[str], optional) – Consumer group to send request

  • None. (to containing embedding model. Defaults to) –

Returns:

Embedding

Return type:

List[float]

Examples using TitanTakeoffEmbed