From bde9fada4c7bb091e7bf50d88601e70433c9989f Mon Sep 17 00:00:00 2001 From: Leticia Date: Tue, 6 Aug 2024 11:51:33 -0300 Subject: [PATCH] parameterization of temperature and max tokens --- anthropic/actions/stream.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/anthropic/actions/stream.ts b/anthropic/actions/stream.ts index b1ec21ad3..3c14286af 100644 --- a/anthropic/actions/stream.ts +++ b/anthropic/actions/stream.ts @@ -42,8 +42,8 @@ export interface Props { * [models](https://docs.anthropic.com/en/docs/models-overview) for details. */ max_tokens?: number; - enableTools?: boolean; + temperature?: number; } const notUndefined = (v: T | undefined): v is T => v !== undefined; @@ -129,8 +129,9 @@ export default async function chat( system, messages, availableFunctions, - model = "claude-3-sonnet-20240229", + model = "claude-3-5-sonnet-20240620", max_tokens = 1024, + temperature = 1.0, enableTools, }: Props, _req: Request, @@ -145,6 +146,7 @@ export default async function chat( const headers = { "anthropic-version": "2023-06-01", "content-type": "application/json", + "anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15", "x-api-key": ctx.token ?? "", }; @@ -153,7 +155,7 @@ export default async function chat( messages, model, max_tokens, - temperature: 0.5, + temperature, stream: true, };