courses icon indicating copy to clipboard operation
courses copied to clipboard

implement dynamic model name selection in course notebooks

Open Andy7475 opened this issue 1 year ago • 1 comments

Currently in the course notebooks you have hardcoded in a model name that is deprecated resulting in a 404

tool_use\03_structured_outputs.ipynb

response = client.messages.create( model="claude-3-sonnet-20240629", <----- no longer exists

suggest you implement something aligned to the below, where "sonnet" could be a param in a function (accepting either 'sonnet' or 'haiku' and then return the model.id:

even better would be something in the Anthropic class like Athropic().model.latest.large / Anthropic().model.latest.small or similar to protect against name changes away from 'sonnet' or 'haiku'

models = Anthropic().models.list().data for model in models: if "sonnet" in model.id: print(model.id)

Andy7475 avatar Feb 17 '25 17:02 Andy7475

Actually I notice you have this in your client: claude-3-opus-latest etc suggest a quick swap out for that in the notebooks

Andy7475 avatar Feb 23 '25 10:02 Andy7475