I've had luck doing chain-of-thought prompting in the JSON payload as you've described, too. Cheers, really validating to see someone taking a similar approach.
Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
31–40 of 76 posts
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#32I asked ChatGPT (GPT-4) about the idea of integrating GPT-JSON with CUE language ( https://cuelang.org/ ) for potential improvements and the answers are quite impressive: "Yes, integrating the CUE language with GPT-JSON can potentially lead to improvements in its capability. CUE, short for Configuration, Unification, and Environment, is an open-source data constraint language designed to simplify the definition, gene…
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#33You can use simpler types. Instead of : messages=[ GPTMessage( role=GPTMessageRole.SYSTEM, content=SYSTEM_PROMPT, ), GPTMessage( role=GPTMessageRole.USER, content="Text: I love this product. It's the best thing ever!", ) ] Try: messages=( ("system", SYSTEM_PROMPT), ("user", "Text: I love this product. It's the best thing ever!") ) Or: messages=( SystemMsg(SYSTEM_PROMPT), UserMsg("Text: I love this product. It's the b…
python newbie here, why did messages change from [ to (
The important part is that the way messages types are defined is very heavy, and you can get them to be lighter without sacrificing type safety.
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#34Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#35Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#36Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#37Here's 40 lines of python code that I've found to be unreasonably effective at accomplishing something similar: https://github.com/jiggy-ai/pydantic-chatcompletion/blob/mas...
What is the failure rate?
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#38I like the idea, but I think a library that focuses on producing requests and parsing responses according to schema is better. Sending requests to the server is orthogonal to the purpose. What we've found useful in practice in dealing with similar problems: - Use json5 instead of json when parsing. It allows trailing commas. - Don't let it respond in true/false. Instead, ask it for a short sentence explaining whether…
The tips on booleans and numerics are interesting! Will keep them in mind if I ever need to do that. I've definitely experienced a few quirks like that (E.g. ChatGPT 'helpfully' responding with "Here's your JSON" instead of just giving me JSON).
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#39Here's 40 lines of python code that I've found to be unreasonably effective at accomplishing something similar: https://github.com/jiggy-ai/pydantic-chatcompletion/blob/mas...
I dont see how these infinite loops are a good idea... You never sure if you actually getting a good result ? What is the failure rate?
Re: Show HN: GPT-JSON – Structured and typehinted GPT responses in Python
#40 ```
[TOML]
key="""
value
"""
"""