You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/types.md
+19-4
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,18 @@
2
2
3
3
Outlines provides custom Pydantic types so you can focus on your use case rather than on writing regular expressions:
4
4
5
-
- Using `outlines.types.ZipCode` will generate valid US Zip(+4) codes.
6
-
- Using `outlines.types.PhoneNumber` will generate valid US phone numbers.
7
-
- Using `outlines.types.ISBN` will generate ISBNs. Note that there is no guarantee that the [check digit](https://en.wikipedia.org/wiki/ISBN#Check_digits) will be correct.
8
-
- Using `outlines.types.airports.IATA` will generate valid airport IATA codes.
5
+
6
+
| Category | Type | Import | Description |
7
+
|:--------:|:----:|:-------|:------------|
8
+
| Zip code | US |`outlines.types.ZipCode`| Generate US Zip(+4) codes |
9
+
| Phone number | US |`outlines.types.PhoneNumber`| Generate valid US phone numbers |
10
+
| ISBN | 10 & 13 |`outlines.types.ISBN`| There is no guarantee that the [check digit][wiki-isbn] will be correct |
|| name |`outlines.types.countries.Name`| Valid country names |
16
+
|| flag |`outlines.types.countries.Flag`| Valid flag emojis |
9
17
10
18
You can use these types in Pydantic schemas for JSON-structured generation:
11
19
@@ -49,3 +57,10 @@ print(result)
49
57
50
58
51
59
We plan on adding many more custom types. If you have found yourself writing regular expressions to generate fields of a given type, or if you could benefit from more specific types don't hesite to [submit a PR](https://github.com/outlines-dev/outlines/pulls) or [open an issue](https://github.com/outlines-dev/outlines/issues/new/choose).
0 commit comments