-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (ai/core): enhance generateImage, add initial Fireworks image su…
…pport. (#4266) Co-authored-by: Lars Grammel <[email protected]>
- Loading branch information
Showing
27 changed files
with
935 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@ai-sdk/google-vertex': patch | ||
'@ai-sdk/openai': patch | ||
'ai': patch | ||
--- | ||
|
||
feat (ai/core): add aspectRatio and seed options to generateImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@ai-sdk/provider': patch | ||
--- | ||
|
||
feat (provider): add message option to UnsupportedFunctionalityError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@ai-sdk/fireworks': patch | ||
'@ai-sdk/provider-utils': patch | ||
--- | ||
|
||
feat (provider/fireworks): Add image model support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dotenv/config'; | ||
import { fireworks } from '@ai-sdk/fireworks'; | ||
import { experimental_generateImage as generateImage } from 'ai'; | ||
import fs from 'fs'; | ||
|
||
async function main() { | ||
const { image } = await generateImage({ | ||
model: fireworks.image('accounts/fireworks/models/flux-1-dev-fp8'), | ||
prompt: 'A burrito launched through a tunnel', | ||
aspectRatio: '4:3', | ||
seed: 0, // 0 is random seed for this model | ||
providerOptions: { | ||
fireworks: { | ||
// https://fireworks.ai/models/fireworks/flux-1-dev-fp8/playground | ||
guidance_scale: 10, | ||
num_inference_steps: 10, | ||
}, | ||
}, | ||
}); | ||
|
||
const filename = `image-${Date.now()}.png`; | ||
fs.writeFileSync(filename, image.uint8Array); | ||
console.log(`Image saved to ${filename}`); | ||
} | ||
|
||
main().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.