from langchain_core.pydantic_v1 import BaseModel, Field from typing import List class UserStoryScenarios(BaseModel): """List of User Stories Business Scenarios Pydantic Schema""" scenario_title: str = Field(description="Provide a business scenario acceptance criteria title") pre_conditions: str = Field(description="Provide a precondition details") action_details: str = Field(description="Provide action details to be taken in business application by the user role specified") expected_outcome: str = Field(description="Provide list of activities to be allowed by business user role") def get_json_template(model: BaseModel): """helper function to get the json schema from the pydantic model""" schema = model.model_json_schema() json_schema = json.dumps(schema) json_schema = Template(json_schema).substitute( {"defs": "definitions", "ref": "$ref"} ) return json.loads(json_schema) class UserStory(BaseModel): """User Story Pydantic Schema""" title: str = Field(description="Provide clear user story title") role: str = Field(description="Provide application user role",default="Loan Servicing Agent",const=True) feature: str = Field(description="Provide application feature/functionality") benefit: str = Field(description="Provide benefits of the feature to the user role") user_story_scenarios : List[UserStoryScenarios] = Field(description="Provide list of user story scenarios") def get_json_template(model: BaseModel): """helper function to get the json schema from the pydantic model""" schema = model.model_json_schema() json_schema = json.dumps(schema) json_schema = Template(json_schema).substitute( {"defs": "definitions", "ref": "$ref"} ) return json.loads(json_schema)