Source code for openapi_client.models.get_project_details_response

# coding: utf-8

"""
    Amorphic Data Platform

    Amorphic Data Platform - API Definition documentation

    The version of the OpenAPI document: 1.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.get_project_details_response_agents_inner import GetProjectDetailsResponseAgentsInner
from openapi_client.models.get_project_details_response_guard_rail import GetProjectDetailsResponseGuardRail
from openapi_client.models.get_project_details_response_knowledge_bases_inner import GetProjectDetailsResponseKnowledgeBasesInner
from openapi_client.models.get_project_details_response_model import GetProjectDetailsResponseModel
from typing import Optional, Set
from typing_extensions import Self

[docs] class GetProjectDetailsResponse(BaseModel): """ Response for GET /ai/projects/{project_id} endpoint """ # noqa: E501 project_id: Optional[StrictStr] = Field(default=None, description="Project identifier", alias="ProjectId") project_name: Optional[StrictStr] = Field(default=None, description="Project name", alias="ProjectName") project_status: Optional[StrictStr] = Field(default=None, description="Project status", alias="ProjectStatus") message: Optional[StrictStr] = Field(default=None, description="Status message", alias="Message") description: Optional[StrictStr] = Field(default=None, description="Project description", alias="Description") keywords: Optional[List[StrictStr]] = Field(default=None, description="List of keywords associated with the project", alias="Keywords") category: Optional[StrictStr] = Field(default=None, description="Category for the project", alias="Category") enforce_resource_acls: Optional[StrictBool] = Field(default=None, description="Whether resource ACLs are enforced", alias="EnforceResourceACLs") chatbot_name: Optional[StrictStr] = Field(default=None, description="Name of the chatbot/project agent", alias="ChatbotName") instructions: Optional[StrictStr] = Field(default=None, description="Instructions for the project agent", alias="Instructions") greeting: Optional[StrictStr] = Field(default=None, description="Greeting message for the project agent", alias="Greeting") chat_suggestions: Optional[List[StrictStr]] = Field(default=None, description="List of chat suggestions", alias="ChatSuggestions") enable_smart_orchestration: Optional[StrictBool] = Field(default=None, description="Whether to enable smart orchestration", alias="EnableSmartOrchestration") model: Optional[GetProjectDetailsResponseModel] = Field(default=None, alias="Model") guard_rail: Optional[GetProjectDetailsResponseGuardRail] = Field(default=None, alias="GuardRail") avatar_url: Optional[StrictStr] = Field(default=None, description="URL of the project agent avatar", alias="AvatarURL") knowledge_bases: Optional[List[GetProjectDetailsResponseKnowledgeBasesInner]] = Field(default=None, description="List of knowledge bases", alias="KnowledgeBases") agents: Optional[List[GetProjectDetailsResponseAgentsInner]] = Field(default=None, description="List of agents", alias="Agents") access_type: Optional[StrictStr] = Field(default=None, description="Access type of the project", alias="AccessType") __properties: ClassVar[List[str]] = ["ProjectId", "ProjectName", "ProjectStatus", "Message", "Description", "Keywords", "Category", "EnforceResourceACLs", "ChatbotName", "Instructions", "Greeting", "ChatSuggestions", "EnableSmartOrchestration", "Model", "GuardRail", "AvatarURL", "KnowledgeBases", "Agents", "AccessType"] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), )
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of GetProjectDetailsResponse from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. """ excluded_fields: Set[str] = set([ ]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of model if self.model: _dict['Model'] = self.model.to_dict() # override the default output from pydantic by calling `to_dict()` of guard_rail if self.guard_rail: _dict['GuardRail'] = self.guard_rail.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in knowledge_bases (list) _items = [] if self.knowledge_bases: for _item_knowledge_bases in self.knowledge_bases: if _item_knowledge_bases: _items.append(_item_knowledge_bases.to_dict()) _dict['KnowledgeBases'] = _items # override the default output from pydantic by calling `to_dict()` of each item in agents (list) _items = [] if self.agents: for _item_agents in self.agents: if _item_agents: _items.append(_item_agents.to_dict()) _dict['Agents'] = _items return _dict
[docs] @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of GetProjectDetailsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "ProjectId": obj.get("ProjectId"), "ProjectName": obj.get("ProjectName"), "ProjectStatus": obj.get("ProjectStatus"), "Message": obj.get("Message"), "Description": obj.get("Description"), "Keywords": obj.get("Keywords"), "Category": obj.get("Category"), "EnforceResourceACLs": obj.get("EnforceResourceACLs"), "ChatbotName": obj.get("ChatbotName"), "Instructions": obj.get("Instructions"), "Greeting": obj.get("Greeting"), "ChatSuggestions": obj.get("ChatSuggestions"), "EnableSmartOrchestration": obj.get("EnableSmartOrchestration"), "Model": GetProjectDetailsResponseModel.from_dict(obj["Model"]) if obj.get("Model") is not None else None, "GuardRail": GetProjectDetailsResponseGuardRail.from_dict(obj["GuardRail"]) if obj.get("GuardRail") is not None else None, "AvatarURL": obj.get("AvatarURL"), "KnowledgeBases": [GetProjectDetailsResponseKnowledgeBasesInner.from_dict(_item) for _item in obj["KnowledgeBases"]] if obj.get("KnowledgeBases") is not None else None, "Agents": [GetProjectDetailsResponseAgentsInner.from_dict(_item) for _item in obj["Agents"]] if obj.get("Agents") is not None else None, "AccessType": obj.get("AccessType") }) return _obj