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

  1. Cache (optional)

    • Type: BaseCache
    • Description: Caching mechanism for API responses
  2. Model Name

    • Type: asyncOptions (dynamically loaded)
    • Default: gpt-3.5-turbo
    • Description: The specific OpenAI chat model to use
  3. Temperature

    • Type: number
    • Default: 0.9
    • Range: 0 to 1 (step 0.1)
    • Description: Controls randomness in output generation
  4. Max Tokens (optional)

    • Type: number
    • Description: Maximum number of tokens to generate
  5. Top Probability (optional)

    • Type: number
    • Range: 0 to 1 (step 0.1)
    • Description: Nucleus sampling parameter
  6. Frequency Penalty (optional)

    • Type: number
    • Range: -2.0 to 2.0 (step 0.1)
    • Description: Penalizes frequent tokens
  7. Presence Penalty (optional)

    • Type: number
    • Range: -2.0 to 2.0 (step 0.1)
    • Description: Penalizes new tokens based on presence in text
  8. Timeout (optional)

    • Type: number
    • Description: API request timeout in milliseconds
  9. BasePath (optional)

    • Type: string
    • Description: Custom base URL for API requests
  10. Proxy Url (optional)

    • Type: string
    • Description: URL for proxy server
  11. BaseOptions (optional)

    • Type: json
    • Description: Additional configuration options for API requests
  12. Allow Image Uploads

    • Type: boolean
    • Default: false
    • Description: Enables image upload capability, automatically switching to gpt-4-vision-preview when an image is uploaded
  13. 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.