fix(Anthropic): only pass properties defined by API reference in payload (#938)

This commit is contained in:
Danny Avila 2023-09-13 15:23:29 -04:00 committed by GitHub
parent e4843c4680
commit 81bda112d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -268,14 +268,25 @@ class AnthropicClient extends BaseClient {
}; };
let text = ''; let text = '';
const { model, stream, maxOutputTokens, ...rest } = this.modelOptions; const {
stream,
model,
temperature,
maxOutputTokens,
stop: stop_sequences,
topP: top_p,
topK: top_k,
} = this.modelOptions;
const requestOptions = { const requestOptions = {
prompt: payload, prompt: payload,
model, model,
stream: stream || true, stream: stream || true,
max_tokens_to_sample: maxOutputTokens || 1500, max_tokens_to_sample: maxOutputTokens || 1500,
stop_sequences,
temperature,
metadata, metadata,
...rest, top_p,
top_k,
}; };
if (this.options.debug) { if (this.options.debug) {
console.log('AnthropicClient: requestOptions'); console.log('AnthropicClient: requestOptions');