langchain.embeddings.octoai_embeddings.OctoAIEmbeddings¶

class langchain.embeddings.octoai_embeddings.OctoAIEmbeddings(*, endpoint_url: Optional[str] = None, model_kwargs: Optional[dict] = None, octoai_api_token: Optional[str] = None, embed_instruction: str = 'Represent this input: ', query_instruction: str = 'Represent the question for retrieving similar documents: ')[source]¶

Bases: BaseModel, Embeddings

OctoAI Compute Service embedding models.

The environment variable OCTOAI_API_TOKEN should be set with your API token, or it can be passed as a named parameter to the constructor.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param embed_instruction: str = 'Represent this input: '¶

Instruction to use for embedding documents.

param endpoint_url: Optional[str] = None¶

Endpoint URL to use.

param model_kwargs: Optional[dict] = None¶

Keyword arguments to pass to the model.

param octoai_api_token: Optional[str] = None¶

OCTOAI API Token

param query_instruction: str = 'Represent the question for retrieving similar documents: '¶

Instruction to use for embedding query.

embed_documents(texts: List[str]) List[List[float]][source]¶

Compute document embeddings using an OctoAI instruct model.

embed_query(text: str) List[float][source]¶

Compute query embedding using an OctoAI instruct model.

validator validate_environment  »  all fields[source]¶

Ensure that the API key and python package exist in environment.

model Config[source]¶

Bases: object

Configuration for this pydantic object.

extra = 'forbid'¶