-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat (ai/core): add experimental generateImage function #4056
Conversation
import { GeneratedImage, GenerateImageResult } from './generate-image-result'; | ||
|
||
/** | ||
Embed a value using an embedding model. The type of the value is defined by the embedding model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has old content, need to update
`generateImage` accepts an optional `headers` parameter of type `Record<string, string>` | ||
that you can use to add custom headers to the image generation request. | ||
|
||
```ts highlight={"7"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it might be intended to highlight 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 should be correct (headers) but i'll double check when deployed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 7 shows as expected
}, | ||
{ | ||
name: 'headers', | ||
type: 'Record<string, string>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR-wide: should this be the set of types Resolvable allows? If so, update docs/code in some manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, when we introduce resolvable more broadly we need to update this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered while reading:
- what format(s) are produced
- how does token usage work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- no token usage
- format is currently open, we can just add on-the-fly mimetype detection if people ask
headers?: Record<string, string | undefined>; | ||
}): PromiseLike<{ | ||
/** | ||
Generated images as base64 encoded strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want some representation of what the binary format is, or to mention briefly in a doc comment if there is only one currently and no field specifier is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you mean the image type, we can auto-detect this later using magic bytes if needed
Fixes #2524
Tasks