from uiform import Schemaschema_obj = Schema( json_schema ={'X-SystemPrompt':'You are a useful assistant.','properties':{'name':{'X-FieldPrompt':'Provide a descriptive and concise name for the event.','description':'The name of the calendar event.','title':'Name','type':'string'},'date':{'X-FieldPrompt':'Specify the event date in YYYY-MM-DD format.','description':'The date of the calendar event in ISO 8601 format.','title':'Date','type':'string'}},'required':['name','date'],'title':'CalendarEvent','type':'object'})
from uiform import Schemafrom pydantic import BaseModel, Field, ConfigDictclassCalendarEvent(BaseModel): model_config = ConfigDict(json_schema_extra ={"X-SystemPrompt":"You are a useful assistant."}) name:str= Field(..., description="The name of the calendar event.", json_schema_extra={"X-FieldPrompt":"Provide a descriptive and concise name for the event."}) date:str= Field(..., description="The date of the calendar event in ISO 8601 format.", json_schema_extra={"X-FieldPrompt":"Specify the event date in YYYY-MM-DD format.",})schema_obj = Schema( pydantic_model = CalendarEvent)
The Generate Schema endpoint allows you to automatically generate a JSON Schema from a set of example documents. This is particularly useful when you want to create a schema that captures all the important fields and patterns present in your documents.
You can provide multiple documents to ensure the generated schema covers all possible variations in your data structure. The AI will analyze the documents and create a comprehensive schema with appropriate field descriptions and validation rules.
from uiform import UiFormuiclient = UiForm()schema_obj = uiclient.schemas.generate( documents =["freight/booking_confirmation_1.jpg","freight/booking_confirmation_2.jpg"])
The Promptify Schema endpoint allows you to enhance an existing JSON Schema with AI-generated prompts and descriptions. By analyzing example documents, it can add helpful X-Directives (X-SystemPrompt, X-FieldPrompt and X-ReasoningPrompt) that will guide the AI in extracting the right information.
This is particularly useful when you already have a schema structure but want to improve the quality of AI extractions by adding more context and guidance through prompts.
from uiform import UiFormuiclient = UiForm()schema_obj = uiclient.schemas.promptify( json_schema ={'properties':{'name':{'description':'The name of the calendar event.','title':'Name','type':'string'},'date':{'description':'The date of the calendar event in ISO 8601 format.','title':'Date','type':'string'}},'required':['name','date'],'title':'CalendarEvent','type':'object'}, documents =["freight/booking_confirmation_1.jpg","freight/booking_confirmation_2.jpg"])