Skip to main content
This guide helps you get started with AI/ML API embedding models using LangChain. For detailed documentation on AimlapiEmbeddings features and configuration options, please refer to the API reference.

Overview

Integration details

Setup

To access AI/ML API embedding models you’ll need to create an account, get an API key, and install the langchain-aimlapi integration package.

Credentials

Head to aimlapi.com to sign up and generate an API key. Once you’ve done this set the AIMLAPI_API_KEY environment variable:
To enable automated tracing of your model calls, set your LangSmith API key:

Installation

The LangChain AI/ML API integration lives in the langchain-aimlapi package:

Instantiation

Now we can instantiate our embeddings model and perform embedding operations:

Indexing and Retrieval

Embedding models are often used in retrieval-augmented generation (RAG) flows. Below is how to index and retrieve data using the embeddings object we initialized above with InMemoryVectorStore.

Direct usage

You can directly call embed_query and embed_documents for custom embedding scenarios.

Embed single text

Embed multiple texts


API reference

For detailed documentation on AimlapiEmbeddings features and configuration options, please refer to the API reference.
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.