You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Lack of Support for Passing Arbitrary Extra Metadata in API Requests
Description:
The current Vercel AI SDK does not support passing arbitrary extra metadata into the body of the API request neither in and of the providers or the streamText, and generateText methods. This is problematic when integrating with proxies requiring specific settings.
Workaround:
I created a custom provider, openai-provider-metadata-extension-vercel-ai-sdk, to address this limitation. It allows arbitrary metadata to be included in API requests, providing greater flexibility and customization.
Example:
const openai = createOpenAI({
baseURL: 'https://api.openai.com/v1',
apiKey: 'YOUR_API_KEY',
extraMetadata: {
customField1: 'value1',
customField2: 'value2',
// Include any additional metadata fields as needed
},
});
By leveraging this custom OpenAI provider, developers can easily extend the capabilities of the Vercel AI SDK and include arbitrary metadata in their API requests. This opens up new possibilities for customization, tracking, analytics, and more, empowering developers to build more advanced and tailored applications with the Vercel AI SDK.
Proposed Solution:
Add support for extra metadata fields in the streamText and generateText methods. Additionally, I could contribute the modified providers along with these improvements to ensure seamless metadata handling.
Contribution Offer:
I have implemented these modifications for my use case and am willing to submit a pull request with the necessary changes. If the absence of this feature was intentional, please let me know.
Impact:
Enhancing the SDK with this feature will increase its flexibility and adaptability, benefiting various integration scenarios and use cases.
I look forward to your feedback and am ready to collaborate on this improvement.
Use Case
Proxy Integration: Enable developers to include proxy-specific settings directly in API requests.
Custom Analytics: Allow for the inclusion of analytics metadata for tracking request performance.
Feature Flags: Pass feature flags or experimental settings to the API without altering the core request structure.
User Context: Include user-specific metadata for personalized responses from the API.
Extended Logging: Add additional logging information to requests for better debugging and monitoring.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Feature Description
Issue: Lack of Support for Passing Arbitrary Extra Metadata in API Requests
Description:
The current Vercel AI SDK does not support passing arbitrary extra metadata into the body of the API request neither in and of the
providers
or thestreamText
, andgenerateText
methods. This is problematic when integrating with proxies requiring specific settings.Workaround:
I created a custom provider,
openai-provider-metadata-extension-vercel-ai-sdk
, to address this limitation. It allows arbitrary metadata to be included in API requests, providing greater flexibility and customization.Example:
By leveraging this custom OpenAI provider, developers can easily extend the capabilities of the Vercel AI SDK and include arbitrary metadata in their API requests. This opens up new possibilities for customization, tracking, analytics, and more, empowering developers to build more advanced and tailored applications with the Vercel AI SDK.
Proposed Solution:
Add support for extra metadata fields in the
streamText
andgenerateText
methods. Additionally, I could contribute the modified providers along with these improvements to ensure seamless metadata handling.Contribution Offer:
I have implemented these modifications for my use case and am willing to submit a pull request with the necessary changes. If the absence of this feature was intentional, please let me know.
Impact:
Enhancing the SDK with this feature will increase its flexibility and adaptability, benefiting various integration scenarios and use cases.
I look forward to your feedback and am ready to collaborate on this improvement.
Use Case
Proxy Integration: Enable developers to include proxy-specific settings directly in API requests.
Custom Analytics: Allow for the inclusion of analytics metadata for tracking request performance.
Feature Flags: Pass feature flags or experimental settings to the API without altering the core request structure.
User Context: Include user-specific metadata for personalized responses from the API.
Extended Logging: Add additional logging information to requests for better debugging and monitoring.
Additional context
No response
The text was updated successfully, but these errors were encountered: