dotnet / dotnet/extensions

How can we represent AIContent that's not entirely in memory?

Open
#6,683 1 comment 1 reaction 0 assignees View on GitHub
api-suggestion area-ai enhancement
Dominant language
C#
Stars
3.2k
Forks
894
Avg merge
1d 12h
Merged PRs (30d)
23

Description

DataContent can only be backed with a ReadOnlyMemory, we should also have type that can be backed with a stream so that we don't have to store large content in memory.

Ideally this type could support a stream without ever loading the entire contents to the stream (eg: as an internal Uri representation, or string representation, or fully buffered)

We should decide if such a representation would require a seeable stream, or if it could be made "one shot" where we wrap a non-seekable stream that would only ever be consumed once - either by copying out to another stream, or converting to some other AIContent like as a DataContent, or maybe a seekable version.

This seems similar to https://learn.microsoft.com/en-us/dotnet/api/system.net.http.streamcontent?view=net-8.0 vs https://learn.microsoft.com/en-us/dotnet/api/system.net.http.bytearraycontent?view=net-8.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.