You can use the chat completion endpoint with LangChain’s ChatOpenAI LLM under two lines of code change.

In model_kwargs, you can pass in any OpenAI parameters.

To use Keywords AI parameters, you can specify an extra_body object within model_kwargs. In the above example, customer_identifier is the Keywords AI parameter. These parameters will take precedence over the OpenAI parameters if they are conflicting.