Skip to content

implement dynamic model name selection in course notebooks #71

Open
@Andy7475

Description

@Andy7475

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions