Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for switching between the claude 3 models? Perhaps auto switching when opus is out of quota! #21

Closed
mhd25112 opened this issue Mar 27, 2024 · 15 comments · Fixed by #22
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@mhd25112
Copy link

I'd really appreciate that feature if it's not too much trouble

@st1vms st1vms added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Mar 27, 2024
@st1vms st1vms self-assigned this Mar 27, 2024
@mhd25112
Copy link
Author

mhd25112 commented Mar 28, 2024

I found a way, I modified client.py to remove the lines
if model_name is not None and model_name not in {"claude-2.0", "claude-2.1"}: raise ValueError( "model_name must be either None or one of 'claude-2.0' or 'claude-2.1' strings" )

And initiated the model like that :
claude_client = ClaudeAPIClient(session, timeout=240, model_name="claude-3-sonnet-20240229")

I obtained the model name from the network tab in google chrome

Do you mind if I add that change? I will have to figure out how cuz I am not a coder and I generally dont use github lol

@mhd25112
Copy link
Author

Of course I will add the lines I removed back in but with the claude 3 models instead of claude 2

@mhd25112
Copy link
Author

I also found a way to include images if you want a look at that

@st1vms
Copy link
Owner

st1vms commented Mar 28, 2024

@mhd25112 That's great news!
Seems switching model was as simple as overriding the model_name parameter.

Removing the model name check may be a good idea afterall, i'll add this change for the next PR.

@mhd25112
Copy link
Author

Yeah it's simple, would you like the code for image support? Because right now it supports files but that seems to be handled different from images

@st1vms
Copy link
Owner

st1vms commented Mar 29, 2024

@mhd25112 Thing is that it should already support any type of file... I included a mimetype check feature in the api just for that.

How is that different from your code?

@mhd25112
Copy link
Author

@st1vms In my testing text files worked fine, but images did not. Do images work for you without modification?

@st1vms
Copy link
Owner

st1vms commented Mar 29, 2024

The model_name patch is already live on branch dev-0.3.2

Will test the image attachments...

Repository owner deleted a comment from mhd25112 Mar 30, 2024
@st1vms
Copy link
Owner

st1vms commented Apr 2, 2024

@mhd25112 I finally was able to let file upload work, now it should successfully process images and other file types, changes are already live in dev-0.3.2 come check them out!

@st1vms st1vms linked a pull request Apr 2, 2024 that will close this issue
@st1vms
Copy link
Owner

st1vms commented Apr 2, 2024

PR #22 should be ready for merge.

Please let me know if dev-0.3.2 works for you.

@mhd25112
Copy link
Author

mhd25112 commented Apr 3, 2024

Awesome, will let you know when I have time to shift my code from the customized API I made to this one and if it works well

@mhd25112
Copy link
Author

mhd25112 commented Apr 3, 2024

Also just a suggestion for accessibility, add to the read me which model names are allowed to be used, right now there is kind of no way someone will figure that out on their own without going to the website and inspecting packets. it is "claude-3-opus-20240229", "claude-3-sonnet-20240229", or "claude-3-haiku-20240229" right now but that needs to be updated periodically I presume.

@st1vms
Copy link
Owner

st1vms commented Apr 3, 2024

Also just a suggestion for accessibility, add to the read me which model names are allowed to be used, right now there is kind of no way someone will figure that out on their own without going to the website and inspecting packets. it is "claude-3-opus-20240229", "claude-3-sonnet-20240229", or "claude-3-haiku-20240229" right now but that needs to be updated periodically I presume.

I think it's probably best if I don't check that parameter, as you've noticed it is subject to frequent changes...By default it will allow to use the latest Claude3 model (should be Sonnet). Also I can't seem to find a good reference to gather those strings...

Waiting for confirmations in order to merge dev-0.3.2

@mhd25112
Copy link
Author

mhd25112 commented Apr 3, 2024 via email

@st1vms
Copy link
Owner

st1vms commented Apr 3, 2024

@mhd25112 I updated the README with that link, it's already in dev-0.3.2

@st1vms st1vms closed this as completed in #22 Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants