Skip to content

Manage HttpClient timeout #127

@Renrhaf

Description

@Renrhaf

Some model queries can take a long time, it would be nice to be able to manage the HttpClient options one way or the other : either by passing down a custom HttpClient instance, or to allow options to be passed from the agent call directly.

final readonly class ModelClient implements ModelClientInterface
{
    ....

    public function request(Model $model, array|string $payload, array $options = []): ResponseInterface
    {
        return $this->httpClient->request('POST', 'https://api.mistral.ai/v1/chat/completions', [
            'auth_bearer' => $this->apiKey,
            'headers' => [
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => array_merge($options, $payload),
            'timeout' => 600,
            'max_duration' => 600,
        ]);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew featureRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions