@@ -34,7 +34,7 @@ class Weather(BaseModel):
34
34
"messages" : [
35
35
{
36
36
"role" : "system" ,
37
- "content" : f"Respond to the users questions and answer them in the following format: { Weather .schema ()} " ,
37
+ "content" : f"Respond to the users questions and answer them in the following format: { Weather .model_json_schema ()} " ,
38
38
},
39
39
{
40
40
"role" : "user" ,
@@ -43,7 +43,7 @@ class Weather(BaseModel):
43
43
],
44
44
"seed" : 42 ,
45
45
"max_tokens" : 500 ,
46
- "response_format" : {"type" : "json_object" , "value" : Weather .schema ()},
46
+ "response_format" : {"type" : "json_object" , "value" : Weather .model_json_schema ()},
47
47
}
48
48
# send the request
49
49
response = requests .post (
@@ -75,7 +75,7 @@ class Weather(BaseModel):
75
75
76
76
json_payload ["response_format" ] = {
77
77
"type" : "json_schema" ,
78
- "value" : {"name" : "weather" , "strict" : True , "schema" : Weather .schema ()},
78
+ "value" : {"name" : "weather" , "strict" : True , "schema" : Weather .model_json_schema ()},
79
79
}
80
80
response = requests .post (
81
81
f"{ llama_grammar .base_url } /v1/chat/completions" ,
@@ -109,7 +109,7 @@ class Weather(BaseModel):
109
109
"messages" : [
110
110
{
111
111
"role" : "system" ,
112
- "content" : f"Respond to the users questions and answer them in the following format: { Weather .schema ()} " ,
112
+ "content" : f"Respond to the users questions and answer them in the following format: { Weather .model_json_schema ()} " ,
113
113
},
114
114
{
115
115
"role" : "user" ,
@@ -119,7 +119,7 @@ class Weather(BaseModel):
119
119
"seed" : 42 ,
120
120
"max_tokens" : 500 ,
121
121
"tools" : [],
122
- "response_format" : {"type" : "json_object" , "value" : Weather .schema ()},
122
+ "response_format" : {"type" : "json_object" , "value" : Weather .model_json_schema ()},
123
123
},
124
124
)
125
125
0 commit comments