@@ -34,7 +34,7 @@ class Weather(BaseModel):
3434 "messages" : [
3535 {
3636 "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 ()} " ,
3838 },
3939 {
4040 "role" : "user" ,
@@ -43,7 +43,7 @@ class Weather(BaseModel):
4343 ],
4444 "seed" : 42 ,
4545 "max_tokens" : 500 ,
46- "response_format" : {"type" : "json_object" , "value" : Weather .schema ()},
46+ "response_format" : {"type" : "json_object" , "value" : Weather .model_json_schema ()},
4747 }
4848 # send the request
4949 response = requests .post (
@@ -75,7 +75,7 @@ class Weather(BaseModel):
7575
7676 json_payload ["response_format" ] = {
7777 "type" : "json_schema" ,
78- "value" : {"name" : "weather" , "strict" : True , "schema" : Weather .schema ()},
78+ "value" : {"name" : "weather" , "strict" : True , "schema" : Weather .model_json_schema ()},
7979 }
8080 response = requests .post (
8181 f"{ llama_grammar .base_url } /v1/chat/completions" ,
@@ -109,7 +109,7 @@ class Weather(BaseModel):
109109 "messages" : [
110110 {
111111 "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 ()} " ,
113113 },
114114 {
115115 "role" : "user" ,
@@ -119,7 +119,7 @@ class Weather(BaseModel):
119119 "seed" : 42 ,
120120 "max_tokens" : 500 ,
121121 "tools" : [],
122- "response_format" : {"type" : "json_object" , "value" : Weather .schema ()},
122+ "response_format" : {"type" : "json_object" , "value" : Weather .model_json_schema ()},
123123 },
124124 )
125125
0 commit comments