Skip to content

Allow specifying RequestOptions as part of PromptBuilder #127

@felixarntz

Description

@felixarntz

While in #99 we implemented support for RequestOptions, we never enabled callers with a reasonable way to provide them. I don't think it's currently even possible to pass request options alongside a prompt that would be used for the eventual API request to the cloud provider.

Here's what I'm proposing:

  • expand PromptBuilder with a usingRequestOptions(RequestOptions $requestOptions): self method
  • expand ModelInterface with setRequestOptions(RequestOptions $requestOptions): void and getRequestOptions(): ?RequestOptions methods
  • update the provider implementations to call getRequestOptions() when constructing their API requests

By implementing this in ModelInterface and AbstractAiProvider, this is almost not even a breaking change. It technically is, if you're not using AbstractAiProvider. But we're so early in the lifecycle of this SDK, I doubt anyone is building custom providers yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions