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

Weave quickstart code has incorrect type annotation #2475

Open
adam-lally opened this issue Sep 25, 2024 · 1 comment · May be fixed by #2476
Open

Weave quickstart code has incorrect type annotation #2475

adam-lally opened this issue Sep 25, 2024 · 1 comment · May be fixed by #2476

Comments

@adam-lally
Copy link

This weave quickstart code has the wrong return type annotation

@weave.op()
def extract_dinos(sentence: str) -> dict:
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {
                "role": "system",
                "content": """In JSON format extract a list of `dinosaurs`, with their `name`, 
their `common_name`, and whether its `diet` is a herbivore or carnivore"""
            },
            {
                "role": "user",
                "content": sentence
            }
            ],
            response_format={ "type": "json_object" }
        )
    return response.choices[0].message.content

response.choices[0].message.content is a Str not a dict.

adam-lally added a commit to adam-lally/weave that referenced this issue Sep 25, 2024
@adam-lally adam-lally linked a pull request Sep 25, 2024 that will close this issue
@andrewtruong
Copy link
Collaborator

Thanks for catching :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants