Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Will you be able to share an example code or gist ?


If you look into the instructor code(https://github.com/jxnl/instructor/blob/06a49e7824729b8df1f7...). Here is the core code snippet they use:

            message = dedent(
                f"""
                As a genius expert, your task is to understand the content and provide
                the parsed objects in json that match the following json_schema:\n

                {json.dumps(response_model.model_json_schema(), indent=2)}

                Make sure to return an instance of the JSON, not the schema itself
                """
            )

Then depending on the mode, either they add another message `Return the correct JSON response within a ```json codeblock. not the JSON_SCHEMA` or they set the response format to json.



Thanks for sharing the link, but no agenta is not a library that can help with getting structured outputs from LLMs (at least not in the way discussed in the parent comment). It's a prompt management, evaluation and observability platform for LLM apps.


Just stumbled with https://controlflow.ai/ today. Perhaps it serves to structure outputs as "agentic" workflows in pursuit of LLM autonomy.

Let us know your opinion.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: