You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parser bug — empty quotes makes it stop parsing the last two fields usageCode and usageLanguage.
When the raw response is this:
{
"projectName": "BAMLIntroduction",
"projectPlan": """
This simple project will demonstrate BAML's basic capabilities by creating a text analysis function that:
1. Takes a simple text input
2. Analyzes its sentiment and content
3. Returns a structured response
""",
"bamlCode": """
class TextAnalysis {
sentiment string @description("The overall sentiment of the text: positive, negative, or neutral")
mainTopic string @description("The main topic or subject of the text")
wordCount int @description("Number of words in the text")
}
function AnalyzeText(text: string) -> TextAnalysis {
client "openai/gpt-4o-mini"
prompt #"
Analyze the following text for its sentiment, main topic, and count the words.
{{ _.role("user") }} {{ text }}
{{ ctx.output_format }}
"#
}
""",
"bamlTests": """
test BasicTextAnalysis {
functions [AnalyzeText]
args {
text "I love learning about new programming languages! BAML seems really interesting and useful."
}
}
test EmptyTextAnalysis {
functions [AnalyzeText]
args {
text ""
}
}
""",
"usageCode": """
from baml_client import b
from baml_client.types import TextAnalysis
def main():
# Analyze some sample text
sample_text = "I love learning about new programming languages! BAML seems really interesting and useful."
result = b.AnalyzeText(sample_text)
print(f"Sentiment: {result.sentiment}")
print(f"Main Topic: {result.mainTopic}")
print(f"Word Count: {result.wordCount}")
if __name__ == "__main__":
main()
""",
"usageLanguage": "python"
}
The parser will truncate at the first empty quotes:
{
...
"bamlTests": "
...
args {
text
"
}
The text was updated successfully, but these errors were encountered:
parser bug — empty quotes makes it stop parsing the last two fields usageCode and usageLanguage.
When the
raw response
is this:The parser will truncate at the first empty quotes:
The text was updated successfully, but these errors were encountered: