From 0e809d1f11fabdbb04b6c5831b6474bdece3f48d Mon Sep 17 00:00:00 2001 From: JordanDalton Date: Wed, 24 Jan 2024 14:51:07 +0000 Subject: [PATCH 1/2] Fix styling --- src/Requests/CreateCompletionRequest.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Requests/CreateCompletionRequest.php b/src/Requests/CreateCompletionRequest.php index 0f0d214..84ac104 100644 --- a/src/Requests/CreateCompletionRequest.php +++ b/src/Requests/CreateCompletionRequest.php @@ -14,15 +14,15 @@ class CreateCompletionRequest extends Request implements HasBody protected Method $method = Method::POST; /** - * @param string $prompt The model that will complete your prompt. - * @param string $model The prompt that you want Claude to complete. - * @param int $max_tokens_to_sample The maximum number of tokens to generate before stopping. - * @param array $stop_sequences Sequences that will cause the model to stop generating completion text. - * @param int $temperature Amount of randomness injected into the response. - * @param float $top_p Use nucleus sampling. - * @param int $top_k Only sample from the top K options for each subsequent token. - * @param array $metadata An object describing metadata about the request. - * @param bool $stream Whether to incrementally stream the response using server-sent events. + * @param string $prompt The model that will complete your prompt. + * @param string $model The prompt that you want Claude to complete. + * @param int $max_tokens_to_sample The maximum number of tokens to generate before stopping. + * @param array $stop_sequences Sequences that will cause the model to stop generating completion text. + * @param int $temperature Amount of randomness injected into the response. + * @param float $top_p Use nucleus sampling. + * @param int $top_k Only sample from the top K options for each subsequent token. + * @param array $metadata An object describing metadata about the request. + * @param bool $stream Whether to incrementally stream the response using server-sent events. */ public function __construct( public readonly string $prompt = "\n\nHuman:Say Hi\n\nAssistant:", @@ -45,7 +45,7 @@ public function resolveEndpoint(): string public function defaultBody(): array { - if(! isset($metadata['user_id'])) { + if (! isset($metadata['user_id'])) { $metadata['user_id'] = uniqid(); } From 3b9ee313d30349b74a876b3990aac0e1274f2102 Mon Sep 17 00:00:00 2001 From: JordanDalton Date: Wed, 24 Jan 2024 14:54:02 +0000 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84161f1..901674b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `anthropic-sdk-php` will be documented in this file. +## Added default metadata support. - 2024-01-24 + +Claude is requiring user_id as part of the meta data. + ## v.1.0 - 2023-10-01 Version 1 release. Enjoy!