Skip to content
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

Make it possible to provide a custom download implementation #3929

Open
Nemikolh opened this issue Nov 28, 2024 · 1 comment
Open

Make it possible to provide a custom download implementation #3929

Nemikolh opened this issue Nov 28, 2024 · 1 comment
Labels
ai/core enhancement New feature or request

Comments

@Nemikolh
Copy link

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

@Nemikolh Nemikolh added the enhancement New feature or request label Nov 28, 2024
@lgrammel
Copy link
Collaborator

lgrammel commented Dec 5, 2024

Looking at the code, I would prefer to just make the fetch function that is used for the download configurable. Would that work for your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants