Enable Passing Custom HTTP Headers in generateText
and streamText
Tool Execution
#3465
Labels
generateText
and streamText
Tool Execution
#3465
Feature Description
This feature request proposes the ability to pass custom HTTP headers in
generateText
andstreamText
calls. Allowing developers to add arbitrary headers supports scenarios requiring authentication, tracking, or other custom headers needed for secure and flexible API interactions within tools.Example Implementation
The headers would be set in the
generateText
orstreamText
options and passed automatically to each tool’sexecute
function, if defined. Here’s a sample setup:Use Case
This feature is beneficial for applications that need to interact with third-party services requiring specific headers, such as API keys, OAuth tokens, or custom tracking information. It enhances the SDK’s flexibility, allowing developers to manage headers dynamically within a single
generateText
orstreamText
call. This is especially useful for complex applications using multiple authenticated API calls.Additional context
Currently, developers must manually handle headers within each tool’s
execute
function, which can lead to redundant code and maintenance challenges. By centralizing header configuration ingenerateText
andstreamText
, this feature would streamline the process of making authenticated or custom requests within tool executions.The text was updated successfully, but these errors were encountered: