Skip to main content

An integration package connecting OpenAI and LangChain

Project description

This project is a branch of langchain-openai on QPython.

langchain-openai

This package contains the LangChain integrations for OpenAI through their openai SDK.

Installation and Setup

  • Install the LangChain partner package
pip install langchain-openai
  • Get an OpenAI api key and set it as an environment variable (OPENAI_API_KEY)

Chat model

See a usage example.

from langchain_openai import ChatOpenAI

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureChatOpenAI

For a more detailed walkthrough of the Azure wrapper, see here

Text Embedding Model

See a usage example

from langchain_openai import OpenAIEmbeddings

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureOpenAIEmbeddings

For a more detailed walkthrough of the Azure wrapper, see here

LLM (Legacy)

LLM refers to the legacy text-completion models that preceded chat models. See a usage example.

from langchain_openai import OpenAI

If you are using a model hosted on Azure, you should use different wrapper for that:

from langchain_openai import AzureOpenAI

For a more detailed walkthrough of the Azure wrapper, see here

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_openai_aipy-0.3.9.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

langchain_openai_aipy-0.3.9-py3-none-any.whl (60.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_openai_aipy-0.3.9.tar.gz.

File metadata

  • Download URL: langchain_openai_aipy-0.3.9.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for langchain_openai_aipy-0.3.9.tar.gz
Algorithm Hash digest
SHA256 df10ddc575bff37e5666e02b7cfc0c2ced809e7a45ba85af8a77fe18794ab710
MD5 9f8b85135306d7222587db3ba6d7b111
BLAKE2b-256 1d7894d8bd499b65f75c54e5ef39ef8262ef256281b349e6325581d1ae834b63

See more details on using hashes here.

File details

Details for the file langchain_openai_aipy-0.3.9-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_openai_aipy-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1d365128883530b3f488da05e533e2f739c73494d8cb90cf3f05a9c903d2b787
MD5 46485751daf72efd3f54bacb4d144dc1
BLAKE2b-256 5f4208a9fda9605e3dabfad7f63c5f373a4a0f40f514bcf1bd845712c97c7819

See more details on using hashes here.

Supported by

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