ChatOpenAI
The ChatOpenAI node is a wrapper around OpenAI’s large language models that use the Chat endpoint. It provides an interface to interact with OpenAI’s chat models, such as GPT-3.5-turbo and GPT-4.
Node Details
- Name: chatOpenAI
- Type: ChatOpenAI
- Version: 7.0
- Category: Chat Models
Base Classes
- ChatOpenAI
- BaseChatModel
- BaseLanguageModel
- Runnable
Parameters
Credential
Parameters
Credential
- Type: openAIApi
- Required Fields: OpenAI API Key
Inputs
Inputs
-
Cache (optional)
- Type: BaseCache
- Description: Caching mechanism for API responses
-
Model Name
- Type: asyncOptions (dynamically loaded)
- Default: gpt-3.5-turbo
- Description: The specific OpenAI chat model to use
-
Temperature
- Type: number
- Default: 0.9
- Range: 0 to 1 (step 0.1)
- Description: Controls randomness in output generation
-
Max Tokens (optional)
- Type: number
- Description: Maximum number of tokens to generate
-
Top Probability (optional)
- Type: number
- Range: 0 to 1 (step 0.1)
- Description: Nucleus sampling parameter
-
Frequency Penalty (optional)
- Type: number
- Range: -2.0 to 2.0 (step 0.1)
- Description: Penalizes frequent tokens
-
Presence Penalty (optional)
- Type: number
- Range: -2.0 to 2.0 (step 0.1)
- Description: Penalizes new tokens based on presence in text
-
Timeout (optional)
- Type: number
- Description: API request timeout in milliseconds
-
BasePath (optional)
- Type: string
- Description: Custom base URL for API requests
-
Proxy Url (optional)
- Type: string
- Description: URL for proxy server
-
BaseOptions (optional)
- Type: json
- Description: Additional configuration options for API requests
-
Allow Image Uploads
- Type: boolean
- Default: false
- Description: Enables image upload capability, automatically switching to gpt-4-vision-preview when an image is uploaded
-
Image Resolution
- Type: options (low, high, auto)
- Default: low
- Description: Controls the resolution at which the model processes uploaded images
Functionality
The ChatOpenAI node initializes an instance of the OpenAI chat model with the specified parameters. It handles API authentication, request configuration, and optional features like image uploads for multimodal interactions.
Usage
This node is typically used in chains or agents that require natural language processing capabilities. It can be employed in various scenarios such as:
- Conversational AI applications
- Text generation tasks
- Language translation
- Code generation and analysis
- Question-answering systems
Special Features
- Dynamic model selection based on available OpenAI models
- Support for image uploads in compatible chains and agents
- Configurable image resolution for vision-based models
- Proxy support for network configurations
- Customizable base options for advanced API interactions
Output
The node outputs an initialized ChatOpenAI instance that can be used in subsequent nodes in the solution.
Was this page helpful?