sigoden / aichat

All-in-one AI CLI tool featuring Chat-REPL, Shell Assistant, RAG, AI tools & agents, with access to OpenAI, Claude, Gemini, Ollama, Groq, and more.
Apache License 2.0
3.85k stars 260 forks source link

Bedrock Claude model invocation gives error: "extraneous key [stream] is not permitted" #543

Closed rolfwilms closed 3 months ago

rolfwilms commented 3 months ago

Describe the bug Invoking any AWS Bedrock Claude model gives the following error:

Failed to get answer

Caused by: Malformed input request: #: subject must not be valid against schema {"required":["messages"]}#: extraneous key [stream] is not permitted, please reformat your input and try again.

To Reproduce Configure Bedrock, select an AWS Bedrock Claude model, e.g. Sonnet, then run any query,

Expected behavior Expecting a model response, not an error.

Configuration

model claude:claude-3-haiku-20240307 max_output_tokens 4096 (current model) temperature 1 top_p - function_calling false compress_threshold 100000 dry_run false save true save_session - highlight true light_theme false wrap no wrap_code false auto_copy false keybindings emacs prelude config_file C:\Users\rwilms\AppData\Roaming\aichat\config.yaml roles_file C:\Users\rwilms\AppData\Roaming\aichat\roles.yaml messages_file C:\Users\rwilms\AppData\Roaming\aichat\messages.md sessions_dir C:\Users\rwilms\AppData\Roaming\aichat\sessions functions_dir C:\Users\rwilms\AppData\Roaming\aichat\functions

Environment (please complete the following information):

Additional context Actually using master as of 2024-05-25, but 0.17.0 gives the same error. I'll try to provide a pull request which removes the key 'stream'.

rolfwilms commented 3 months ago

Added pull request https://github.com/sigoden/aichat/pull/544 for this issue. It also fixes too high default max_output_tokens with AWS Bedrock Meta llama-3 models.

sigoden commented 3 months ago

Thank you for your contribution.