avfranco's picture
ea4all-gradio-agents-mcp-hackathon-kickoff
7042c3c
from typing import List, Optional
from pydantic import BaseModel, Field
"""
This module defines the data models used in the EA4ALL TOGAF project.
The data models include:
- Capability: Represents a business capability.
- BusinessCapability: Represents a list of required business capabilities.
- Requirement: Represents a business requirement.
- ListRequirement: Represents a list of identified business requirements.
- Objective: Represents a business objective.
- ListObjective: Represents a list of business objectives.
- UseCase: Represents a use case describing user interactions with the system.
- UserJourney: Represents a list of user journeys.
- StakeholderMap: Represents a business stakeholder.
- StakeholderList: Represents a list of business stakeholders.
- IdentifiedApp: Represents an identified application.
- LandscapeAsIs: Represents a list of applications to address a business query.
- CapabilityAsIs: Represents the support status of a business capability.
- CapabilityGap: Represents a list of capability support statuses.
- GradeAnswer: Represents a binary score for relevance check on retrieved applications.
- GradeHallucinations: Represents a binary score for hallucination present in generation answer.
- GradeDocuments: Represents a binary score for relevance check on retrieved applications.
- Principles: Represents the business, architecture, and technology principles.
- GradeBusinessQueryAnswer: Represents a binary score for quality check on business query.
"""
class Capability(BaseModel):
"""Business capability"""
capability: str = Field(description="Business capability name.")
class BusinessCapability(BaseModel):
"""List of required business capabilities."""
capabilities: Optional[List[Capability]]
class Requirement(BaseModel):
"""Business requirement."""
category: str = Field(description="Business requirement should be functional or non-functional")
requirement: str = Field(description="Business requirement description.")
class ListRequirement(BaseModel):
"""List of identified business requirements."""
requirements: Optional[List[Requirement]]
class Objective(BaseModel):
"""Business Objective"""
objective: str = Field(title=None, description="Business objective.")
class ListObjective(BaseModel):
"""List of business objectives."""
objectives: Optional[List[Objective]]
class UseCase(BaseModel):
"""Use case describing who (actor,user,persona) does what (interaction) with the system, for what purpose (goal), without dealing with system internals."""
persona: str = Field(description="User, actor or personna who interacts with the system.")
step: str = Field(description="Action executed by user.")
goal: str = Field(description="Purpose, goal of a step executed by user.")
class UserJourney(BaseModel):
"""List of user journey."""
userjourney: Optional[List[UseCase]]
class StakeholderMap(BaseModel):
"""Business stakeholder."""
stakeholder: str = Field(description="Stakeholder name.")
role: str = Field(description="Stakeholder role.")
concern: str = Field(description="Stakeholder concern.")
class StakeholderList(BaseModel):
"""List of business stakeholders."""
stakeholders: Optional[List[StakeholderMap]]
#Task-2
class IdentifiedApp(BaseModel):
"""Identified application"""
application: str = Field(description="Application name")
description: str = Field(description="Application description")
capability: list = Field(description="Business capabilities supported")
businessFit: str = Field(description="how well application support current business need")
technicalFit: str = Field(description="application alignment with technology strategy")
roadmap: str = Field(description="application portfolio strategy")
class LandscapeAsIs(BaseModel):
"""List of applications to address a business query."""
identified_asis: Optional[List[IdentifiedApp]]
class CapabilityAsIs(BaseModel):
"""Business capability support"""
capability: str = Field(description="business capability definition")
support: bool = Field(description="capability support status")
class CapabilityGap(BaseModel):
"""List of capabilities support status"""
capability_status: Optional[List[CapabilityAsIs]]
class GradeAnswer(BaseModel):
"""Binary score for relevance check on retrieved applications."""
binary_score: str = Field(...,
description="Relevance of retrieved applications to the business query, 'yes' or 'no'"
)
class GradeHallucinations(BaseModel):
"""Binary score for hallucination present in generation answer."""
binary_score: bool = Field(
description="Answer is grounded in the facts, 'yes' or 'no'"
)
class GradeDocuments(BaseModel):
"""Binary score for relevance check on retrieved applications."""
binary_score: str = Field(
description="Applications support the business capability, 'yes' or 'no'"
)
#Task-3
class Principles(BaseModel):
"""Describe the business, archirecture and technology principles"""
architecture: list = Field(description="Name and description of an architecture principle")
business: list = Field(description="Name and description of a business principle")
technology: list = Field(description="Name and description of a technology principle")
#Togaf-Agentic-Workflow
class GradeBusinessQueryAnswer(BaseModel):
"""Binary score for quality check on business query."""
binary_score: str = Field(
description="Business Query is well-described, 'yes' or 'no'"
)