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

Consider fixing parsing of literals from objects #1141

Open
hellovai opened this issue Nov 4, 2024 · 0 comments
Open

Consider fixing parsing of literals from objects #1141

hellovai opened this issue Nov 4, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@hellovai
Copy link
Contributor

hellovai commented Nov 4, 2024

Sometimes when an LLM responds to a primitive value, it can use an object to contain its response. We can benefit from parsing objects of singular keys as the values themslves and drop they key. we already do this in some places.

This new test fails:

// file: engine/baml-lib/jsonish/src/tests/test_literals.rs

test_deserializer!(
    test_union_literal_with_multiple_types_from_object,
    EMPTY_FILE,
    r#"{
  "status": 1
}"#,
    FieldType::Union(vec![
        FieldType::Literal(LiteralValue::Int(1)),
        FieldType::Literal(LiteralValue::Bool(true)),
        FieldType::Literal(LiteralValue::String("THREE".into())),
    ]),
    1
);
@hellovai hellovai added the good first issue Good for newcomers label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant