mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
fix ImageContentItem to take base64 string as image.data (#909)
# What does this PR do? - Discussion in https://github.com/meta-llama/llama-stack/pull/906#discussion_r1936260819 - image.data should accept base64 string as input instead of binary bytes, change prompt_adapter to account for that. ## Test Plan ``` pytest -v tests/client-sdk/inference/test_inference.py ``` with test in https://github.com/meta-llama/llama-stack/pull/906 ## Sources Please link relevant resources if necessary. ## Before submitting - [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). - [ ] Ran pre-commit to handle lint / formatting issues. - [ ] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), Pull Request section? - [ ] Updated relevant documentation. - [ ] Wrote necessary unit or integration tests.
This commit is contained in:
parent
7fe2592795
commit
94051cfe9e
5 changed files with 85 additions and 31 deletions
|
@ -2439,27 +2439,32 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"const": "image",
|
||||
"default": "image"
|
||||
"default": "image",
|
||||
"description": "Discriminator type of the content item. Always \"image\""
|
||||
},
|
||||
"image": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": {
|
||||
"$ref": "#/components/schemas/URL"
|
||||
"$ref": "#/components/schemas/URL",
|
||||
"description": "A URL of the image or data URL in the format of data:image/{type};base64,{data}. Note that URL could have length limits."
|
||||
},
|
||||
"data": {
|
||||
"type": "string",
|
||||
"contentEncoding": "base64"
|
||||
"contentEncoding": "base64",
|
||||
"description": "base64 encoded image data as string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Image as a base64 encoded string or an URL"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"type",
|
||||
"image"
|
||||
]
|
||||
],
|
||||
"title": "A image content item"
|
||||
},
|
||||
"InterleavedContent": {
|
||||
"oneOf": [
|
||||
|
@ -2647,17 +2652,20 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"const": "text",
|
||||
"default": "text"
|
||||
"default": "text",
|
||||
"description": "Discriminator type of the content item. Always \"text\""
|
||||
},
|
||||
"text": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Text content"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"type",
|
||||
"text"
|
||||
]
|
||||
],
|
||||
"title": "A text content item"
|
||||
},
|
||||
"ToolCall": {
|
||||
"type": "object",
|
||||
|
|
|
@ -1466,19 +1466,28 @@ components:
|
|||
type: string
|
||||
const: image
|
||||
default: image
|
||||
description: >-
|
||||
Discriminator type of the content item. Always "image"
|
||||
image:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
$ref: '#/components/schemas/URL'
|
||||
description: >-
|
||||
A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
||||
Note that URL could have length limits.
|
||||
data:
|
||||
type: string
|
||||
contentEncoding: base64
|
||||
description: base64 encoded image data as string
|
||||
additionalProperties: false
|
||||
description: >-
|
||||
Image as a base64 encoded string or an URL
|
||||
additionalProperties: false
|
||||
required:
|
||||
- type
|
||||
- image
|
||||
title: A image content item
|
||||
InterleavedContent:
|
||||
oneOf:
|
||||
- type: string
|
||||
|
@ -1598,12 +1607,16 @@ components:
|
|||
type: string
|
||||
const: text
|
||||
default: text
|
||||
description: >-
|
||||
Discriminator type of the content item. Always "text"
|
||||
text:
|
||||
type: string
|
||||
description: Text content
|
||||
additionalProperties: false
|
||||
required:
|
||||
- type
|
||||
- text
|
||||
title: A text content item
|
||||
ToolCall:
|
||||
type: object
|
||||
properties:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue