ChatOpenAI
interface.
base_url
as PORTKEY_GATEWAY_URL
default_headers
to consume the headers needed by Portkey using the createHeaders
helper method.ChatOpenAI
model in Langchain
provider
. Portkey will also start logging all the requests in your account that makes debugging extremely simple.
claude-3-opus-20240229
model.
Portkey supports Virtual Keys which are an easy way to store and manage API keys in a secure vault. Let’s try using a Virtual Key to make LLM calls. You can navigate to the Virtual Keys tab in Portkey and create a new key for Anthropic.
The virtual_key
parameter sets the authentication and provider for the AI provider being used. In our case we’re using the Anthropic Virtual key.
Notice that the api_key
can be left blank as that authentication won’t be used.
ChatOpenAI
class making it a single interface to call any provider and any model.
gpt-4
and claude-opus
50:50 to test the two large models. The gateway configuration for this would look like the following:
gpt-4
and claude-3-opus-20240229
in the ratio of the defined weights.
You can find more config examples here.
ChatOpenAI
class to use the AI Gateway as above.