Skip to main content

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

Release files for langchain-openai-aipy 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-openai-aipy 0.3.9
File Size Uploaded
langchain_openai_aipy-0.3.9.tar.gz 54.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-openai-aipy 0.3.9
File Interpreter ABI Platform
langchain_openai_aipy-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 115.1 kB

Release files / langchain_openai_aipy-0.3.9.tar.gz

Download URL langchain_openai_aipy-0.3.9.tar.gz
Size 54.9 kB
Tags Source
SHA-256 checksum
How to use checksums
df10ddc575bff37e5666e02b7cfc0c2ced809e7a45ba85af8a77fe18794ab710
BLAKE2b-256 checksum
How to use checksums
1d7894d8bd499b65f75c54e5ef39ef8262ef256281b349e6325581d1ae834b63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release files / langchain_openai_aipy-0.3.9-py3-none-any.whl

Download URL langchain_openai_aipy-0.3.9-py3-none-any.whl
Size 60.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d365128883530b3f488da05e533e2f739c73494d8cb90cf3f05a9c903d2b787
BLAKE2b-256 checksum
How to use checksums
5f4208a9fda9605e3dabfad7f63c5f373a4a0f40f514bcf1bd845712c97c7819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page