vision
endpoint, you can analyze single or multiple images with a prompt. Palmyra Vision allows you to ask questions about an image, generate captions, compare images, and more.
.env
file with the name WRITER_API_KEY
.POST /v1/vision
Parameter | Type | Description |
---|---|---|
model | string | The model to use for the analysis. Must be palmyra-vision . |
prompt | string | The prompt to use for the analysis. The prompt must include the names of the images you’re analyzing, referencing them as {{name}} . For example: What's the difference between the image {{image_1}} and the image {{image_2}}? |
variables | array | An array of image variables with a name and file_id . |
variables[].name | string | The name of the image. You must use the same name in the prompt, referencing it as {{name}} . |
variables[].file_id | string | The File ID of the uploaded image. The maximum allowed file size is 7MB. You must upload the image to Writer before passing it to the Vision endpoint. Learn how to upload images below. |
data
field that contains the analysis results as a string.
vision
endpoint.
{{name}}
, where name
is the name you provided in the variables
array. For example: Extract the text from the image {{name}}.
If you include files in the variables
array that you don’t include in the prompt, the API returns an error.
The following code sample shows the API call to extract text from an image.