Skip to content

Commit

Permalink
Merge pull request #91 from samchon/feat/additionalProperties
Browse files Browse the repository at this point in the history
Allow `additionalProperties` in Claude and Llama.
  • Loading branch information
samchon authored Nov 28, 2024
2 parents 50ea930 + 51d43d4 commit 93942ef
Show file tree
Hide file tree
Showing 30 changed files with 398 additions and 270 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "John Doe",
"age": 42,
"etc": {
"hobby": "Soccer",
"job": "Scientist"
}
}
25 changes: 12 additions & 13 deletions examples/function-calling/arguments/claude.sale.input.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"title": "Surface Pro 9",
"format": "md",
"body": "The Surface Pro 9 is a versatile 2-in-1 device that combines the power of a laptop with the flexibility of a tablet. It features advanced technology, making it suitable for both professional and personal use.\n\n- \"Unleash Your Creativity Anywhere\": The Surface Pro 9 is designed for those who need power and portability, making it perfect for creative professionals and students alike.\n- \"The Ultimate 2-in-1 Experience\": With its detachable keyboard and touchscreen capabilities, the Surface Pro 9 adapts to your needs, whether you're working, studying, or relaxing.\n- \"Stay Connected with 5G\": Experience lightning-fast internet speeds and seamless connectivity, no matter where you are.\n- \"Power Meets Flexibility\": The Surface Pro 9 combines the performance of a laptop with the convenience of a tablet, making it the ideal device for multitasking.\n\nIn summary, the Surface Pro 9 stands out as a powerful and flexible device, perfect for users who require both performance and portability. With its advanced features and sleek design, it is an excellent choice for anyone looking to enhance their productivity and creativity. Whether for work or play, the Surface Pro 9 is ready to meet your needs.",
"files": [],
"thumbnails": [
{
"name": "microsoft-surface-pro-9-thumbnail-1",
Expand All @@ -23,8 +24,7 @@
"extension": "jpeg",
"url": "https://serpapi.com/searches/673d3a37e45f3316ecd8ab3e/images/1be25e6e2b1fb7505946d975aac683f8826bcb8c509672de4a5f8c71f149fdef.jpeg"
}
],
"files": []
]
},
"channels": [
{
Expand Down Expand Up @@ -92,7 +92,7 @@
],
"stocks": [
{
"name": "Surface Pro 9 (i3/8GB/128GB)",
"name": "Surface Pro 9 - i3/8GB/128GB",
"price": {
"nominal": 1000000,
"real": 899000
Expand All @@ -114,7 +114,7 @@
]
},
{
"name": "Surface Pro 9 (i3/16GB/256GB)",
"name": "Surface Pro 9 - i3/16GB/256GB",
"price": {
"nominal": 1200000,
"real": 1099000
Expand All @@ -136,7 +136,7 @@
]
},
{
"name": "Surface Pro 9 (i3/16GB/512GB)",
"name": "Surface Pro 9 - i3/16GB/512GB",
"price": {
"nominal": 1400000,
"real": 1299000
Expand All @@ -158,7 +158,7 @@
]
},
{
"name": "Surface Pro 9 (i5/16GB/256GB)",
"name": "Surface Pro 9 - i5/16GB/256GB",
"price": {
"nominal": 1500000,
"real": 1399000
Expand All @@ -180,7 +180,7 @@
]
},
{
"name": "Surface Pro 9 (i5/32GB/512GB)",
"name": "Surface Pro 9 - i5/32GB/512GB",
"price": {
"nominal": 1800000,
"real": 1699000
Expand All @@ -202,7 +202,7 @@
]
},
{
"name": "Surface Pro 9 (i7/16GB/512GB)",
"name": "Surface Pro 9 - i7/16GB/512GB",
"price": {
"nominal": 1800000,
"real": 1699000
Expand All @@ -224,7 +224,7 @@
]
},
{
"name": "Surface Pro 9 (i7/32GB/512GB)",
"name": "Surface Pro 9 - i7/32GB/512GB",
"price": {
"nominal": 2000000,
"real": 1899000
Expand Down Expand Up @@ -284,11 +284,10 @@
],
"tags": [
"Surface",
"Surface Pro",
"Surface Pro 9",
"Microsoft",
"Tablet",
"2-in-1",
"Laptop"
"Laptop",
"Tablet",
"Windows"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"age": 42,
"etc": {
"hobby": "Soccer",
"job": "Scientist"
},
"name": "John Doe"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"name": {
"title": "The name of the person",
"description": "The name of the person.",
"type": "string"
},
"age": {
"title": "The age of the person",
"description": "The age of the person.",
"type": "integer"
},
"etc": {
"title": "Additional informations about the person",
"description": "Construct a type with a set of properties K of type T",
"type": "object",
"properties": {},
"required": [],
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"name",
"age",
"etc"
]
}
},
"required": [
"input"
],
"$defs": {}
}
34 changes: 11 additions & 23 deletions examples/function-calling/schemas/claude.sale.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"name",
"extension",
"url"
],
"additionalProperties": false
]
}
},
"thumbnails": {
Expand Down Expand Up @@ -152,8 +151,7 @@
"name",
"extension",
"url"
],
"additionalProperties": false
]
}
}
},
Expand All @@ -163,8 +161,7 @@
"body",
"files",
"thumbnails"
],
"additionalProperties": false
]
},
"channels": {
"title": "List of channels and categories",
Expand All @@ -191,8 +188,7 @@
"required": [
"code",
"category_codes"
],
"additionalProperties": false
]
},
"minItems": 1
},
Expand Down Expand Up @@ -243,8 +239,7 @@
},
"required": [
"name"
],
"additionalProperties": false
]
},
"minItems": 1
}
Expand All @@ -254,8 +249,7 @@
"name",
"variable",
"candidates"
],
"additionalProperties": false
]
}
},
"stocks": {
Expand Down Expand Up @@ -292,8 +286,7 @@
"required": [
"nominal",
"real"
],
"additionalProperties": false
]
},
"quantity": {
"title": "Initial inventory quantity",
Expand Down Expand Up @@ -321,8 +314,7 @@
"required": [
"option_index",
"candidate_index"
],
"additionalProperties": false
]
}
}
},
Expand All @@ -331,8 +323,7 @@
"price",
"quantity",
"choices"
],
"additionalProperties": false
]
},
"minItems": 1
},
Expand All @@ -358,8 +349,7 @@
"name",
"required",
"primary"
],
"additionalProperties": false
]
},
"minItems": 1
},
Expand All @@ -381,13 +371,11 @@
"channels",
"units",
"tags"
],
"additionalProperties": false
]
}
},
"required": [
"input"
],
"additionalProperties": false,
"$defs": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"name": {
"title": "The name of the person",
"description": "The name of the person.",
"type": "string"
},
"age": {
"title": "The age of the person",
"description": "The age of the person.",
"type": "integer"
},
"etc": {
"title": "Additional informations about the person",
"description": "Construct a type with a set of properties K of type T",
"type": "object",
"properties": {},
"required": [],
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"name",
"age",
"etc"
]
}
},
"required": [
"input"
],
"$defs": {}
}
Loading

0 comments on commit 93942ef

Please sign in to comment.