Optional
fields: ChatOpenAIFieldsOptional
configuration: ClientOptions & LegacyOpenAIInputOptional
kwargs: Partial<CallOptions>Optional
config: ChatOpenAIStructuredOutputMethodOptions<false>Optional
config: ChatOpenAIStructuredOutputMethodOptions<true>
Wrapper around OpenAI large language models that use the Chat endpoint.
To use you should have the
OPENAI_API_KEY
environment variable set.To use with Azure you should have the:
AZURE_OPENAI_API_KEY
,AZURE_OPENAI_API_INSTANCE_NAME
,AZURE_OPENAI_API_DEPLOYMENT_NAME
andAZURE_OPENAI_API_VERSION
environment variables set.AZURE_OPENAI_BASE_PATH
is optional and will overrideAZURE_OPENAI_API_INSTANCE_NAME
if you need to use a custom endpoint.Remarks
Any parameters that are valid to be passed to
openai.createChatCompletion
can be passed through modelKwargs, even if not explicitly available on this class.Example