GPT-JSON

AI

llm output parsing library

SHOW HN2023

174points
72comments
#342of 3,109 in 2023
Top 12%of 2023 by points

How HN took it

MixedNo clear lean

5 positive, 11 neutral or asking, 1 mixed, 10 critical, out of 27 comments about the project. Thread score -0.14.

Idea: 3 for, 7 againstExecution: 0 for, 2 againstDesign: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Pydantic-based prompt-to-schema approach is useful for chaining GPT calls

    From 1 comment
    • You might not! Depends on what you're looking for. I've been finding this library most helpful in places where I have a lot of GPT calls in pipelines, so having typehinted schema…
      icyfox on HN

Objections

  • Prompt-only JSON instructions already work about 99% of the time

    From 2 comments
    • I've been interfacing with GPT programmatically for a little while now, leveraging it's "soft and fuzzy" interface to produce hard / machine-readable results. JSON was the format…
      btbuildem on HN
    • It works fine 99% of the time by just using a small amount of extra instruction in the actual prompt. The method GP describes works in any language with just the basic building…
      verdverm on HN
  • A library is unnecessary overhead for this task

    From 2 comments
    • It works fine 99% of the time by just using a small amount of extra instruction in the actual prompt. The method GP describes works in any language with just the basic building…
      verdverm on HN
    • yeah, don't disagree, however this idea is better a function I use within gpt-index or langchain. There is a horse race and we're all making our bets about who's going to win
      verdverm on HN
  • Retry loops are questioned as unreliable

    From 1 comment
    • 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?
      TeeWEE on HN

Requests

  • Support for YAML or markdown output instead of JSON

    From 2 comments
    • In the last 24 hours I've seen a bunch of projects doing LLM -> JSON. I think we want to be focusing on markdown instead. An intuition I have developed is that an ideal prompt…
      killthebuddha on HN
    • I'm having success with simple YAML schema. One thing that's very helpful for the prompt is to include "description" and "example": ``` - column name: salary_max format: number…
      mmaia on HN
  • Include examples in the schema prompt

    From 1 comment
    • I'm having success with simple YAML schema. One thing that's very helpful for the prompt is to include "description" and "example": ``` - column name: salary_max format: number…
      mmaia on HN

Questions

  • Why are retry errors appended as system messages rather than user messages

    From 1 comment
    • Very cool. Out of curiosity, for the retries why are the errors appended as system messages as opposed to appending to the user message? And in either case, would it help to…
      SeanA208 on HN
  • Is CUE validation better than pydantic or zod

    From 1 comment
    • Pretty good pitch from ChatGPT if you ask me! I haven't used cue outside of test projects before, so a few questions: 1. Is cue's validation a material improvement from something…
      icyfox on HN

Alternatives named

  • pydantic-chatcompletion

    From 1 comment
    • Here's 40 lines of python code that I've found to be unreasonably effective at accomplishing something similar:…
      wskish on HN
  • Guardrails

    From 1 comment
    • Have you considered Guardrails, https://shreyar.github.io/guardrails/, it’s like Pydantic but for LLMs?
      armcat on HN
  • Langchain output parser

    From 1 comment
    • Langchain also has a built in Pydantic output parser https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/pydantic.html However I've found it to be…
      lharries on HN
  • zod-chatgpt

    From 1 comment
    • I built zod-chatgpt https://github.com/olup/zod-chatgpt a couple of weeks ago to serve same purpose in typescript
      olup on HN
  • jsonformer

    From 1 comment
    • Hey HN, I've been using GPT a lot lately in some side projects around data generation and benchmarking. During the course of prompt tuning I ended up with a pretty complicated…
      icyfox on HN
  • struct-gpt

    From 1 comment
    • I'm curious what you might think of https://github.com/knowsuchagency/struct-gpt
      knowsuchagency on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/35821748)