Skip to main content

OpenAI

Bundles contain custom components that support specific third-party integrations with Langflow.

This page describes the components that are available in the OpenAI bundle.

For more information about OpenAI features and functionality used by OpenAI components, see the OpenAI documentation.

OpenAI text generation

The OpenAI component generates text using OpenAI's language models.

It provides access to the same OpenAI models that are available in the core Language Model component, but the OpenAI component provides additional parameters for customizing the request to the OpenAI API.

It can output either a Model Response (Message) or a Language Model (LanguageModel).

Use the Language Model output when you want to use a specific OpenAI model configuration as the LLM for another LLM-driven component, such as a Language Model or Smart Function component.

For more information, see Language Model components.

OpenAI text generation parameters

Many OpenAI component input parameters are hidden by default in the visual editor. You can toggle parameters through the Controls in the component's header menu.

NameTypeDescription
api_keySecretStringInput parameter. Your OpenAI API Key.
modelStringInput parameter. The name of the OpenAI model to use. Options include "gpt-3.5-turbo" and "gpt-4".
max_tokensIntegerInput parameter. The maximum number of tokens to generate. Set to 0 for unlimited tokens.
temperatureFloatInput parameter. Controls randomness in the output. Range: [0.0, 1.0]. Default: 0.7.
top_pFloatInput parameter. Controls the nucleus sampling. Range: [0.0, 1.0]. Default: 1.0.
frequency_penaltyFloatInput parameter. Controls the frequency penalty. Range: [0.0, 2.0]. Default: 0.0.
presence_penaltyFloatInput parameter. Controls the presence penalty. Range: [0.0, 2.0]. Default: 0.0.

OpenAI Embeddings

The OpenAI Embeddings component uses OpenAI embedding models for embedding generation.

It provides access to the same OpenAI models that are available in the core Embedding Model component, but the OpenAI Embeddings component provides additional parameters for customizing the request to the OpenAI embedding API.

For more information about using embedding model components in flows, see Embedding Model components.

OpenAI Embeddings parameters

Many OpenAI Embeddings component input parameters are hidden by default in the visual editor. You can toggle parameters through the Controls in the component's header menu.

NameTypeDescription
OpenAI API KeyStringInput parameter. The API key to use for accessing the OpenAI API.
Default HeadersDictInput parameter. The default headers for the HTTP requests.
Default QueryNestedDictInput parameter. The default query parameters for the HTTP requests.
Allowed SpecialListInput parameter. The special tokens allowed for processing. Default: [].
Disallowed SpecialListInput parameter. The special tokens disallowed for processing. Default: ["all"].
Chunk SizeIntegerInput parameter. The chunk size for processing. Default: 1000.
ClientAnyInput parameter. The HTTP client for making requests.
DeploymentStringInput parameter. The deployment name for the model. Default: text-embedding-3-small.
Embedding Context LengthIntegerInput parameter. The length of embedding context. Default: 8191.
Max RetriesIntegerInput parameter. The maximum number of retries for failed requests. Default: 6.
ModelStringInput parameter. The name of the model to use. Default: text-embedding-3-small.
Model KwargsNestedDictInput parameter. Additional keyword arguments for the model.
OpenAI API BaseStringInput parameter. The base URL of the OpenAI API.
OpenAI API TypeStringInput parameter. The type of the OpenAI API.
OpenAI API VersionStringInput parameter. The version of the OpenAI API.
OpenAI OrganizationStringInput parameter. The organization associated with the API key.
OpenAI ProxyStringInput parameter. The proxy server for the requests.
Request TimeoutFloatInput parameter. The timeout for the HTTP requests.
Show Progress BarBooleanInput parameter. Whether to show a progress bar for processing. Default: False.
Skip EmptyBooleanInput parameter. Whether to skip empty inputs. Default: False.
TikToken EnableBooleanInput parameter. Whether to enable TikToken. Default: True.
TikToken Model NameStringInput parameter. The name of the TikToken model.

See also

Search