Skip to content

Make it possible to provide a custom download implementation #3929

Open
@Nemikolh

Description

Feature Description

Hey! Thanks a ton for the super nice package! 🙌

I was wondering if the ability to customize downloadImplementations could be exposed to streamText via an option.

It seems that the feature is almost there! 👀 I noticed that convertToLanguageModelPrompt can accept a custom downloadImplementation:

export async function convertToLanguageModelPrompt({
prompt,
modelSupportsImageUrls = true,
modelSupportsUrl = () => false,
downloadImplementation = download,
}: {

So essentially, have this

const promptMessages = await convertToLanguageModelPrompt({
prompt: {
type: promptFormat,
system: initialPrompt.system,
messages: stepInputMessages,
},
modelSupportsImageUrls: model.supportsImageUrls,
modelSupportsUrl: model.supportsUrl,
});

also provide that option.

Would it be something that we could add to support?

Use Cases

This would make it possible to:

  • Get images from somewhere else, not necessarily by making a fetch call. E.g., from an R2 bucket in Cloudflare
  • Transform the URL

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions