Skip to main content

An integration package connecting DeepInfra and LangChain

Project description

langchain-deepinfra

This package contains the LangChain integrations for DeepInfra through their APIs.

Installation and Setup

Install the LangChain partner package

pip install -U langchain-deepinfra

Get your DeepInfra api key from the DeepInfra Dashboard and set it as an environment variable (DEEPINFRA_API_TOKEN)

export DEEPINFRA_API_TOKEN=<api_key>

Chat Completions

This package contains the ChatDeepInfra class, which is the recommended way to interface with DeepInfra chat models.

from langchain_deepinfra import ChatDeepInfra

chat = ChatDeepInfra(model="meta-llama/Meta-Llama-3.1-8B-Instruct")
chat.invoke("Who is the first president of Indonesia?")

Embeddings

DeepInfraEmbeddings class exposes the DeepInfra embedding API.

from langchain_deepinfra import DeepInfraEmbeddings

embeddings = DeepInfraEmbeddings(model="BAAI/bge-base-en-v1.5")
embeddings.embed_query("Who is the first president of Indonesia?")

LLM

DeepInfra class exposes the DeepInfra LLM API.

from langchain_deepinfra import DeepInfra

llm = DeepInfra(model="meta-llama/Meta-Llama-3.1-8B-Instruct")
llm.invoke("Who is the first president of Indonesia?")

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_deepinfra-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

langchain_deepinfra-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_deepinfra-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Darwin/22.1.0

File hashes

Hashes for langchain_deepinfra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a694067fb0e84e11b32a2dd09208a56fc5d538142a6ef30e216026e2b2d7e489
MD5 ff6aa1df1b7626ec4bf39fb9a6f1fc90
BLAKE2b-256 457dc8d74827b0b22a79ce5405dcb19a50ece9e943056ff902945e1339e638e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_deepinfra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4efad593ce033a66528ff3ca6c38313c9f4f7f5137e2c1cd13abd5ad9be92de
MD5 c8e1bab8bb9154d3a04d364532cfc37d
BLAKE2b-256 8ab952dfc9fb60d2bf287d9fb5339bb64f1601fb9a95d855a7a94955f61042aa

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