From a62f53a71db1cb8e9610a085ac1e36727a309f78 Mon Sep 17 00:00:00 2001 From: Zbigniew Lukasiak Date: Mon, 30 Sep 2024 19:50:36 +0200 Subject: [PATCH] using Field --- examples/response_format_structured_output.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/response_format_structured_output.py b/examples/response_format_structured_output.py index 355e8c9..4afeaec 100644 --- a/examples/response_format_structured_output.py +++ b/examples/response_format_structured_output.py @@ -1,5 +1,5 @@ from prompete import Chat -from pydantic import BaseModel +from pydantic import BaseModel, Field from pprint import pprint @@ -11,7 +11,7 @@ class Address(BaseModel): class Company(BaseModel): name: str specialty: str - address: Address + address: Address = Field(..., description='The address of the company headquarters') # Address of the company headquarters class CompaniesList(BaseModel): @@ -29,6 +29,8 @@ def print_companies(self): # model = "claude-3-haiku-20240307" # Currently Anthropic does not support response_format - but we emulate it by using tools #model="ollama_chat/llama3:instruct" +#model = "ollama_chat/llama3.1:8b-instruct-q8_0" + model = "gpt-4o-mini" chat = Chat(model=model, emulate_response_format=True)