Skip to content

Commit f1d6cb2

Browse files
committed
Update URL type to avoid string-ifying and creating complexity
1 parent 75e72cf commit f1d6cb2

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

docs/resources/llama-stack-spec.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,9 +2893,16 @@
28932893
]
28942894
},
28952895
"URL": {
2896-
"type": "string",
2897-
"format": "uri",
2898-
"pattern": "^(https?://|file://|data:)"
2896+
"type": "object",
2897+
"properties": {
2898+
"uri": {
2899+
"type": "string"
2900+
}
2901+
},
2902+
"additionalProperties": false,
2903+
"required": [
2904+
"uri"
2905+
]
28992906
},
29002907
"UserMessage": {
29012908
"type": "object",

docs/resources/llama-stack-spec.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,9 +3105,13 @@ components:
31053105
title: A single turn in an interaction with an Agentic System.
31063106
type: object
31073107
URL:
3108-
format: uri
3109-
pattern: ^(https?://|file://|data:)
3110-
type: string
3108+
additionalProperties: false
3109+
properties:
3110+
uri:
3111+
type: string
3112+
required:
3113+
- uri
3114+
type: object
31113115
UnregisterDatasetRequest:
31123116
additionalProperties: false
31133117
properties:

llama_stack/apis/common/content_types.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@
1111
from pydantic import BaseModel, Field, model_validator
1212

1313

14-
@json_schema_type(
15-
schema={"type": "string", "format": "uri", "pattern": "^(https?://|file://|data:)"}
16-
)
14+
@json_schema_type
1715
class URL(BaseModel):
1816
uri: str
1917

20-
def __str__(self) -> str:
21-
return self.uri
22-
2318

2419
class _URLOrData(BaseModel):
2520
url: Optional[URL] = None

0 commit comments

Comments
 (0)