instructor_ex icon indicating copy to clipboard operation
instructor_ex copied to clipboard

Missing schema descriptions in prod

Open petrus-jvrensburg opened this issue 2 years ago • 3 comments

When running in prod, I'm getting different results than when running in dev. After digging, it seems that the @doc description from my schema is missing in prod.

E.g. in prod:

iex> Instructor.JSONSchema.from_ecto_schema(DSS.ProductSuggestion)
"{\"type\":\"object\",\"description\":\"\",\"title\":\"DSS.ProductSuggestion\",\"required\":[\"product_description\",\"product_name\",\"relative_description\"],\"properties\":{\"product_description\":{\"type\":\"string\",\"title\":\"product_description\"},\"product_name\":{\"type\":\"string\",\"title\":\"product_name\"},\"relative_description\":{\"type\":\"string\",\"title\":\"relative_description\"}}}"

Notice that the description field is empty, which is not the case when calling the same function in dev.

petrus-jvrensburg avatar Apr 15 '24 08:04 petrus-jvrensburg

Are you deploying with Mix releases? Releases strip out docs by default, but you can configure them to be kept with:

# mix.exs
def project do
  # ...
  releases: [
    myappname: [
      strip_beams: [keep: ["Docs"]]
    ]
  ]
end

stevehodgkiss avatar Apr 16 '24 08:04 stevehodgkiss

Aah, yes I am. Didn't know about that option to keep the docs, thanks!

petrus-jvrensburg avatar Apr 16 '24 19:04 petrus-jvrensburg

Related to #35.

rhcarvalho avatar Apr 30 '24 18:04 rhcarvalho

Solved in the latest release, {:instructor, "~> 0.1.0"}

We've migrated to using @llm_doc for this exact reason

thmsmlr avatar Feb 09 '25 19:02 thmsmlr