1+ # pylint: disable=line-too-long,useless-suppression
12# ------------------------------------
23# Copyright (c) Microsoft Corporation.
34# Licensed under the MIT License.
3435from dotenv import load_dotenv
3536from azure .identity import DefaultAzureCredential
3637from azure .ai .projects import AIProjectClient
37- from azure .ai .projects .models import PromptAgentDefinition , PromptAgentDefinitionText , ResponseTextFormatConfigurationJsonSchema
38+ from azure .ai .projects .models import (
39+ PromptAgentDefinition ,
40+ PromptAgentDefinitionText ,
41+ ResponseTextFormatConfigurationJsonSchema ,
42+ )
3843from pydantic import BaseModel
3944
4045load_dotenv ()
4146
47+
4248class CalendarEvent (BaseModel ):
4349 model_config = {"extra" : "forbid" }
4450 name : str
4551 date : str
4652 participants : list [str ]
4753
54+
4855project_client = AIProjectClient (
4956 endpoint = os .environ ["AZURE_AI_PROJECT_ENDPOINT" ],
5057 credential = DefaultAzureCredential (),
@@ -58,8 +65,10 @@ class CalendarEvent(BaseModel):
5865 agent_name = "MyAgent" ,
5966 definition = PromptAgentDefinition (
6067 model = os .environ ["AZURE_AI_MODEL_DEPLOYMENT_NAME" ],
61- #BUG? text=PromptAgentDefinitionText(format=ResponseTextFormatConfigurationJsonSchema(name="CalendarEvent", schema=CalendarEvent.model_json_schema())),
62- text = PromptAgentDefinitionText (format = {"type" : "json_schema" , "name" : "CalendarEvent" , "schema" : CalendarEvent .model_json_schema ()}),
68+ # BUG? text=PromptAgentDefinitionText(format=ResponseTextFormatConfigurationJsonSchema(name="CalendarEvent", schema=CalendarEvent.model_json_schema())),
69+ text = PromptAgentDefinitionText (
70+ format = {"type" : "json_schema" , "name" : "CalendarEvent" , "schema" : CalendarEvent .model_json_schema ()}
71+ ),
6372 instructions = """
6473 You are a helpful assistant that extracts calendar event information from the input user messages,
6574 and returns it in the desired structured output format.
0 commit comments