Skip to content

Commit

Permalink
documentation update, some clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Dec 3, 2024
1 parent 67260d7 commit ae5a69a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ data class Address(
@Pattern("[a-z]{2}")
val countryCode: String,
@Format(StringFormat.EMAIL)
val email: String?
val email: String? = null
)
```

Expand Down Expand Up @@ -129,15 +129,16 @@ serializes to:
"street",
"city",
"postalCode",
"countryCode",
"email"
"countryCode"
]
}
```

And this is the input accepted by Large Language Model APIs like
[OpenAI API](https://platform.openai.com/docs/api-reference/introduction)
and [Anthropic API](https://docs.anthropic.com/en/api/getting-started).
and [Anthropic API](https://docs.anthropic.com/en/api/getting-started). When requesting a tool use, these LLMs
will send a JSON payload like adhering to this schema, therefore
immediately deserializable as the original `@Serializable` Kotlin class.

More details and use cases in the [JsonSchemaGeneratorTest](src/commonTest/kotlin/generator/JsonSchemaGeneratorTest.kt).

Expand Down

0 comments on commit ae5a69a

Please sign in to comment.