docs: Update openai README.md (#29146)

This commit is contained in:
Bagatur 2025-01-10 17:24:16 -08:00 committed by GitHub
parent 0a54aedb85
commit 5c2fbb5b86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,22 +10,6 @@ pip install langchain-openai
``` ```
- Get an OpenAI api key and set it as an environment variable (`OPENAI_API_KEY`) - Get an OpenAI api key and set it as an environment variable (`OPENAI_API_KEY`)
## LLM
See a [usage example](http://python.langchain.com/docs/integrations/llms/openai).
```python
from langchain_openai import OpenAI
```
If you are using a model hosted on `Azure`, you should use different wrapper for that:
```python
from langchain_openai import AzureOpenAI
```
For a more detailed walkthrough of the `Azure` wrapper, see [here](http://python.langchain.com/docs/integrations/llms/azure_openai)
## Chat model ## Chat model
See a [usage example](http://python.langchain.com/docs/integrations/chat/openai). See a [usage example](http://python.langchain.com/docs/integrations/chat/openai).
@ -54,3 +38,18 @@ If you are using a model hosted on `Azure`, you should use different wrapper for
from langchain_openai import AzureOpenAIEmbeddings from langchain_openai import AzureOpenAIEmbeddings
``` ```
For a more detailed walkthrough of the `Azure` wrapper, see [here](https://python.langchain.com/docs/integrations/text_embedding/azureopenai) For a more detailed walkthrough of the `Azure` wrapper, see [here](https://python.langchain.com/docs/integrations/text_embedding/azureopenai)
## LLM (Legacy)
LLM refers to the legacy text-completion models that preceded chat models. See a [usage example](http://python.langchain.com/docs/integrations/llms/openai).
```python
from langchain_openai import OpenAI
```
If you are using a model hosted on `Azure`, you should use different wrapper for that:
```python
from langchain_openai import AzureOpenAI
```
For a more detailed walkthrough of the `Azure` wrapper, see [here](http://python.langchain.com/docs/integrations/llms/azure_openai)