Skip to content

Commit

Permalink
parameterization of temperature and max tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Letiiciadiniz committed Aug 6, 2024
1 parent f75395e commit bde9fad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions anthropic/actions/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <T>(v: T | undefined): v is T => v !== undefined;
Expand Down Expand Up @@ -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,
Expand All @@ -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 ?? "",
};

Expand All @@ -153,7 +155,7 @@ export default async function chat(
messages,
model,
max_tokens,
temperature: 0.5,
temperature,
stream: true,
};

Expand Down

0 comments on commit bde9fad

Please sign in to comment.