Claude-API icon indicating copy to clipboard operation
Claude-API copied to clipboard

Send message need to update model from claude-2 to claude-2.1

Open nt1r opened this issue 2 years ago • 11 comments

Error response:

{
  "error": {
    "type": "permission_error",
    "message": "Invalid model",
    "code": "model_not_allowed"
  }
}

Chrome browser fetch:

{
  "completion": {
    "prompt": "Hi",
    "timezone": "Asia/Shanghai",
    "model": "claude-2.1" # update here
  },
  "organization_uuid": "xxxxxx",
  "conversation_uuid": "xxxxxx",
  "text": "Hi",
  "attachments": []
}

=-=-=-=-= 2023/11/22 =-=-=-=-= Claude model name seems to be updated to 'claude-2.1' on 2023/11/22.

=-=-=-=-= 2023/11/21 =-=-=-=-= Claude model name seems to be updated to 'claude-2.0-magenta' on 2023/11/21.

nt1r avatar Nov 21 '23 03:11 nt1r

Hi nt1r, did you try to update your code? It shows this error today, not sure if it is related Traceback (most recent call last): File "/home/xxx/Claude-API/usecases/console_chat.py", line 32, in main() File "/home/xxx/Claude-API/usecases/console_chat.py", line 28, in main response = claude.send_message(user_input, conversation_id) File "/home/xxx/.local/lib/python3.10/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) File "/usr/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

wmcaeddy avatar Nov 21 '23 05:11 wmcaeddy

Hi nt1r, did you try to update your code? It shows this error today, not sure if it is related

@wmcaeddy Hi, there. I'm not sure if this error is caused by the model name change. I'm not very good at Python, sorry I can't help you locate the error. Recently I've been referencing the code from this project and refactoring it using the Kotlin language. Today when I was writing the Ktor server side code I came across this Error, so I decided to open this Issue here.

Translated by Claude.

PS: You can checkout the pull request I submitted today and see if the error has been resolved.

nt1r avatar Nov 21 '23 06:11 nt1r

@nt1r thank you, this is useful

Lxb921006 avatar Nov 21 '23 08:11 Lxb921006

Thanks for the update! I encountered a similar problem and your solution successfully solved the problem!

Traceback (most recent call last):
  File "E:\0nlp\Claude-API-main\usecases\console_chat.py", line 43, in <module>
    main()
  File "E:\0nlp\Claude-API-main\usecases\console_chat.py", line 36, in main
    response = claude.send_message(user_input, conversation_id, timeout=600)
  File "E:\0nlp\Claude-API-main\claude-api\claude_api.py", line 137, in send_message
    data = json.loads(json_str)
  File "C:\Users\14416\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\14416\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\14416\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

rosa-lie avatar Nov 21 '23 08:11 rosa-lie

It seems that the model has been updated, claude-2.1

Lxb921006 avatar Nov 22 '23 03:11 Lxb921006

It seems that the model has been updated, claude-2.1

you are right. thanks

rosa-lie avatar Nov 22 '23 03:11 rosa-lie

Hi nt1r, did you try to update your code? It shows this error today, not sure if it is related

@wmcaeddy Hi, there. I'm not sure if this error is caused by the model name change. I'm not very good at Python, sorry I can't help you locate the error. Recently I've been referencing the code from this project and refactoring it using the Kotlin language. Today when I was writing the Ktor server side code I came across this Error, so I decided to open this Issue here.

Translated by Claude.

PS: You can checkout the pull request I submitted today and see if the error has been resolved.

Hello, do you have the the API translated in kotlin? May I ask if I can get a copy, I'm working on my school project, it will helps a lot. Thanks

Randomboiii03 avatar Nov 24 '23 04:11 Randomboiii03

Hello, do you have the the API translated in kotlin? May I ask if I can get a copy, I'm working on my school project, it will helps a lot. Thanks

here I have not yet added a readme.md file in the project. You can take a look at the ktor related documentation.

nt1r avatar Nov 24 '23 06:11 nt1r

It seems that the model has been updated:claude-2.0

Reference https://github.com/KoushikNavuluri/Claude-API/issues/91

cj1357 avatar Jan 02 '24 11:01 cj1357

Bro,I had the same problem when using "send_message", the problem still exists after updating model, it is still in debug. If a brother found a solution, can you share it?

caicaicaibeiqie avatar Jan 29 '24 07:01 caicaicaibeiqie

I think they updated their API, can't seem to see POST request in the network console, anyone can look up if there is changes?

Randomboiii03 avatar Jan 29 '24 11:01 Randomboiii03