Portkey adds core production capabilities to any Langchain app.
ChatOpenAI
interface.baseURL
as PORTKEY_GATEWAY_URL
defaultHeaders
to consume the headers needed by Portkey using the createHeaders
helper method.virtualKey
parameter sets the authentication and provider for the AI provider being used. In our case we’re using the Mistral Virtual key.
apiKey
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.
OpenAIEmbeddings
class. Let’s try to create an embedding using OpenAI’s embedding model
config
in our requests being made from langchain.
gpt-4
and claude-3-opus-20240229
in the ratio of the defined weights.
You can find more config examples here.
ChatOpenAI
model and we’d be able to use all the benefits of the AI gateway as shown above.
Also, Portkey would capture the logs from the agent API calls giving us full visibility.