Vision
Portkey’s AI gateway supports vision models like GPT-4V by OpenAI, Gemini by Google and more.
What are vision models?
Vision models are artificial intelligence systems that combine both vision and language modalities to process images and natural language text. These models are typically trained on large image and text datasets with different structures based on the pre-training objective.
Vision Chat Completion Usage
Portkey supports the OpenAI signature to define messages with images as part of the API request. Images are made available to the model in two main ways: by passing a link to the image or by passing the base64 encoded image directly in the request.
Here’s an example using OpenAI’s gpt-4-vision-preview
model
API Reference
On completion, the request will get logged in the logs UI where any image inputs or outputs can be viewed. Portkey will automatically load the image URLs or the base64 images making for a great debugging experience with vision models.
Creating prompt templates for vision models
Portkey’s prompt library supports creating templates with image inputs. If the same image will be used in all prompt calls, you can save it as part of the template’s image URL itself. Or, if the image will be sent via the API as a variable, add a variable to the image link.
Supported Providers and Models
The following providers are supported for image generation with more providers getting added soon. Please raise a request or a PR to add model or provider to the AI gateway.
Provider | Models | Functions |
---|---|---|
OpenAI | gpt-4-vision-preview | Create Chat Completion |
Azure OpenAI | gpt-4-vision-preview | Create Chat Completion |
Gemini | gemini-1.0-pro-vision | Create Chat Completion |
Anthropic | claude-3-sonnet claude-3-haiku claude-3-opus | Create Chat Completion |
AWS Bedrock | anthropic.claude-3-sonnet anthropic.claude-3-haiku anthropic.claude-3-5-sonnet-20240620-v1:0 | Create Chat Completion |
Was this page helpful?