curl --request GET \
--url https://davinci-app.com/api/v2/projects/{projectId}/chats/{chatId}/messages/{messageId}/images/{index} \
--header 'Authorization: Bearer <token>'import os
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
transcript = client.chats.messages(project_id, chat_id)
for entry in transcript.messages:
for image in entry.images or []:
picture = client.chats.message_image(
project_id, chat_id, entry.message_id, image.index
)
print(picture.mime_type, len(picture.data))
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const transcript = await client.chats.messages(projectId, chatId);
for (const entry of transcript.messages) {
for (const image of entry.images ?? []) {
const { mimeType, bytes } = await client.chats.messageImage(
projectId, chatId, entry.messageId!, image.index,
);
console.log(mimeType, bytes.byteLength);
}
}
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://davinci-app.com/api/v2/projects/{projectId}/chats/{chatId}/messages/{messageId}/images/{index}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Fetch an image sent with a prompt
The bytes of one image a prompt carried, as the model was given it — so
possibly downscaled from what was sent. A transcript lists each prompt’s
images by index, mimeType and byteSize; this returns one of them.
A prompt’s images never change, so the response can be cached for good.
Use the transcript’s chatId, including for transcripts read through
listAgentMessages.
curl --request GET \
--url https://davinci-app.com/api/v2/projects/{projectId}/chats/{chatId}/messages/{messageId}/images/{index} \
--header 'Authorization: Bearer <token>'import os
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
transcript = client.chats.messages(project_id, chat_id)
for entry in transcript.messages:
for image in entry.images or []:
picture = client.chats.message_image(
project_id, chat_id, entry.message_id, image.index
)
print(picture.mime_type, len(picture.data))
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const transcript = await client.chats.messages(projectId, chatId);
for (const entry of transcript.messages) {
for (const image of entry.images ?? []) {
const { mimeType, bytes } = await client.chats.messageImage(
projectId, chatId, entry.messageId!, image.index,
);
console.log(mimeType, bytes.byteLength);
}
}
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://davinci-app.com/api/v2/projects/{projectId}/chats/{chatId}/messages/{messageId}/images/{index}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Authorizations
Personal access token. The scopes granted at issuance determine both which
operations the key may call and the ceiling on the resource permissions it
can exercise. Each scope family is a ladder: projects:manage implies
projects:write and projects:read; cards:manage implies cards:write
and cards:read; and teams:manage implies teams:write and teams:read.
These are named API capability bundles, not blanket domain roles:
manage exposes only the permissions enumerated for that scope and never
bypasses the acting user's current role-based access.
Path Parameters
Response
The image bytes, typed by Content-Type.
The response is of type file.