Skip to main content

An integration package connecting Aimlapi and LangChain

Project description

langchain-aimlapi

This package contains the LangChain integration with Aimlapi. AI/ML API provides over 300 models including Deepseek, Gemini and ChatGPT. All models are served with enterprise-grade rate limits and uptimes via Aimlapi.

Installation

pip install -U langchain-aimlapi

Configure credentials by setting the environment variable:

  • AIMLAPI_API_KEY – your AI/ML API key

Available modules

The package exports the following classes:

  • ChatAimlapi – chat completion model
  • AimlapiLLM – text completion model
  • AimlapiEmbeddings – embeddings
  • AimlapiImageModel – image generation
  • AimlapiVideoModel – video generation
  • AIMLAPI_HEADERS – default request headers

All classes provide both synchronous and asynchronous APIs. See the docs/ folder for complete examples.

Chat Models

ChatAimlapi class exposes chat models from Aimlapi.

from langchain_aimlapi import ChatAimlapi

llm = ChatAimlapi()
llm.invoke("Sing a ballad of LangChain.")

Embeddings

AimlapiEmbeddings class exposes embeddings from Aimlapi.

from langchain_aimlapi import AimlapiEmbeddings

embeddings = AimlapiEmbeddings()
embeddings.embed_query("What is the meaning of life?")

LLMs

AimlapiLLM class exposes LLMs from Aimlapi.

from langchain_aimlapi import AimlapiLLM

llm = AimlapiLLM()
llm.invoke("The meaning of life is")

Image Generation

AimlapiImageModel generates images from prompts.

from langchain_aimlapi import AimlapiImageModel

img = AimlapiImageModel(
    model="stable-diffusion-v3-medium",
    size="512x512",
    n=1,
)
img.invoke("A serene mountain lake at sunset")

Video Generation

AimlapiVideoModel generates short videos from prompts.

from langchain_aimlapi import AimlapiVideoModel

vid = AimlapiVideoModel(
    model="veo2",
)
vid.invoke("A timelapse of city lights at night")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_aimlapi-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_aimlapi-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_aimlapi-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_aimlapi-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Windows/11

File hashes

Hashes for langchain_aimlapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dc87dcefd6512466a7fa16a6d5ce372de98337e68c3a38f97d4c03da3d9d4212
MD5 b4e3cd8b43aeb84a51704da59dc7226a
BLAKE2b-256 275e88c2e6a9183222d04c5120c13e4a6d11ae0238bfd9d0d2565fb8b8420fd7

See more details on using hashes here.

File details

Details for the file langchain_aimlapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_aimlapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Windows/11

File hashes

Hashes for langchain_aimlapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a2f59838dd7275c03248270418b62208063c9a46e9de6763da8e50b3ed73da3
MD5 e2eaf7d349e94c67b775e0a5ef05c730
BLAKE2b-256 1da3f725551a1ca19046f746ea72d8092b560db5f221df0f553c46135f2d309d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page