ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Bug]: Anthropic set api key error

Open shijiefengjun opened this issue 1 year ago • 4 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Branch name

main

Commit ID

7e0148c

Other environment information

No response

Actual behavior

A small bug caused the inability to add anthropic model providers. I found that this bug is caused by this code: 20241107171049

The file is located at /rag/llm/chat_model.py row1261 This should not be parsed as Json string, causing the following code to fail in taking values: ans = response["content"][0]["text"]

Suggestion for modification: change .json() to .dict()

Expected behavior

No response

Steps to reproduce

when i add anthropic model providers and set apikey, always fail.

Additional information

No response

shijiefengjun avatar Nov 07 '24 09:11 shijiefengjun

Could you paste the error message or print(response) if it's convenient ?

KevinHuSh avatar Nov 08 '24 01:11 KevinHuSh

Could you paste the error message or print(response) if it's convenient ?

Yes, my negligence. This was an error in setting the anthropic’s apikey. 20241108101151

Additionally, I have ignored claude-instant-1.2 as it caused an error: Fail to access model(claude-instant-1.2) using this api key. **ERROR**: Error code: 404 - {'type': 'error', 'error': {'type': 'not_found_error', 'message': 'model: claude-instant-1.2'}

shijiefengjun avatar Nov 08 '24 02:11 shijiefengjun

Same issue

 Fail to access model(claude-2.0) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-2.1) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-5-sonnet-20240620) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-haiku-20240307) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-opus-20240229) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-sonnet-20240229) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-instant-1.2) using this api key. **ERROR**: Error code: 404 - {'type': 'error', 'error': {'type': 'not_found_error', 'message': 'model: claude-instant-1.2'}}

kevinroleke avatar Nov 10 '24 19:11 kevinroleke

Same issue

 Fail to access model(claude-2.0) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-2.1) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-5-sonnet-20240620) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-haiku-20240307) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-opus-20240229) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-3-sonnet-20240229) using this api key. **ERROR**: string indices must be integers, not 'str' Fail to access model(claude-instant-1.2) using this api key. **ERROR**: Error code: 404 - {'type': 'error', 'error': {'type': 'not_found_error', 'message': 'model: claude-instant-1.2'}}

Same error for me right now.

mattsahn avatar Nov 10 '24 20:11 mattsahn

Fixed by #3351

yuzhichang avatar Dec 02 '24 12:12 yuzhichang