File size: 5,648 Bytes
7042c3c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
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'"
)
|