1515 ConfigDict ,
1616 Field ,
1717 model_validator ,
18- constr ,
1918 FilePath ,
2019 AnyHttpUrl ,
2120 PositiveInt ,
@@ -483,14 +482,35 @@ def check_llama_stack_model(self) -> Self:
483482class UserDataCollection (ConfigurationBase ):
484483 """User data collection configuration."""
485484
486- feedback_enabled : bool = False
487- feedback_storage : Optional [str ] = None
488- transcripts_enabled : bool = False
489- transcripts_storage : Optional [str ] = None
485+ feedback_enabled : bool = Field (
486+ False ,
487+ title = "Feedback enabled" ,
488+ description = "When set to true the user feedback is stored and later sent for analysis." ,
489+ )
490+
491+ feedback_storage : Optional [str ] = Field (
492+ None ,
493+ title = "Feedback storage directory" ,
494+ description = "Path to directory where feedback will be saved for further processing." ,
495+ )
496+
497+ transcripts_enabled : bool = Field (
498+ False ,
499+ title = "Transcripts enabled" ,
500+ description = "When set to true the conversation history is stored and later sent for "
501+ "analysis." ,
502+ )
503+
504+ transcripts_storage : Optional [str ] = Field (
505+ None ,
506+ title = "Transcripts storage directory" ,
507+ description = "Path to directory where conversation history will be saved for further "
508+ "processing." ,
509+ )
490510
491511 @model_validator (mode = "after" )
492512 def check_storage_location_is_set_when_needed (self ) -> Self :
493- """Check that storage_location is set when enabled."""
513+ """Ensure storage directories are set when feedback or transcripts are enabled."""
494514 if self .feedback_enabled :
495515 if self .feedback_storage is None :
496516 raise ValueError (
@@ -517,7 +537,10 @@ def check_storage_location_is_set_when_needed(self) -> Self:
517537
518538
519539class JsonPathOperator (str , Enum ):
520- """Supported operators for JSONPath evaluation."""
540+ """Supported operators for JSONPath evaluation.
541+
542+ Note: this is not a real model, just an enumeration of all supported JSONPath operators.
543+ """
521544
522545 EQUALS = "equals"
523546 CONTAINS = "contains"
@@ -612,7 +635,10 @@ def compiled_regex(self) -> Optional[Pattern[str]]:
612635
613636
614637class Action (str , Enum ):
615- """Available actions in the system."""
638+ """Available actions in the system.
639+
640+ Note: this is not a real model, just an enumeration of all action names.
641+ """
616642
617643 # Special action to allow unrestricted access to all actions
618644 ADMIN = "admin"
@@ -665,39 +691,102 @@ class Action(str, Enum):
665691class AccessRule (ConfigurationBase ):
666692 """Rule defining what actions a role can perform."""
667693
668- role : str # Role name
669- actions : list [Action ] # Allowed actions for this role
694+ role : str = Field (
695+ ...,
696+ title = "Role name" ,
697+ description = "Name of the role" ,
698+ )
699+
700+ actions : list [Action ] = Field (
701+ ...,
702+ title = "Allowed actions" ,
703+ description = "Allowed actions for this role" ,
704+ )
670705
671706
672707class AuthorizationConfiguration (ConfigurationBase ):
673708 """Authorization configuration."""
674709
675710 access_rules : list [AccessRule ] = Field (
676- default_factory = list
677- ) # Rules for role-based access control
711+ default_factory = list ,
712+ title = "Access rules" ,
713+ description = "Rules for role-based access control" ,
714+ )
678715
679716
680717class JwtConfiguration (ConfigurationBase ):
681- """JWT configuration."""
718+ """JWT (JSON Web Token) configuration.
719+
720+ JSON Web Token (JWT) is a compact, URL-safe means of representing
721+ claims to be transferred between two parties. The claims in a JWT
722+ are encoded as a JSON object that is used as the payload of a JSON
723+ Web Signature (JWS) structure or as the plaintext of a JSON Web
724+ Encryption (JWE) structure, enabling the claims to be digitally
725+ signed or integrity protected with a Message Authentication Code
726+ (MAC) and/or encrypted.
727+
728+ Useful resources:
729+
730+ - [JSON Web Token](https://en.wikipedia.org/wiki/JSON_Web_Token)
731+ - [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519)
732+ - [JSON Web Tokens](https://auth0.com/docs/secure/tokens/json-web-tokens)
733+ """
734+
735+ user_id_claim : str = Field (
736+ constants .DEFAULT_JWT_UID_CLAIM ,
737+ title = "User ID claim" ,
738+ description = "JWT claim name that uniquely identifies the user (subject ID)." ,
739+ )
740+
741+ username_claim : str = Field (
742+ constants .DEFAULT_JWT_USER_NAME_CLAIM ,
743+ title = "Username claim" ,
744+ description = "JWT claim name that provides the human-readable username." ,
745+ )
682746
683- user_id_claim : str = constants .DEFAULT_JWT_UID_CLAIM
684- username_claim : str = constants .DEFAULT_JWT_USER_NAME_CLAIM
685747 role_rules : list [JwtRoleRule ] = Field (
686- default_factory = list
687- ) # Rules for extracting roles from JWT claims
748+ default_factory = list ,
749+ title = "Role rules" ,
750+ description = "Rules for extracting roles from JWT claims" ,
751+ )
688752
689753
690754class JwkConfiguration (ConfigurationBase ):
691- """JWK configuration."""
755+ """JWK (JSON Web Key) configuration.
692756
693- url : AnyHttpUrl
694- jwt_configuration : JwtConfiguration = Field (default_factory = JwtConfiguration )
757+ A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure
758+ that represents a cryptographic key.
759+
760+ Useful resources:
761+
762+ - [JSON Web Key](https://openid.net/specs/draft-jones-json-web-key-03.html)
763+ - [RFC 7517](https://www.rfc-editor.org/rfc/rfc7517)
764+ """
765+
766+ url : AnyHttpUrl = Field (
767+ ...,
768+ title = "URL" ,
769+ description = "HTTPS URL of the JWK (JSON Web Key) set used to validate JWTs." ,
770+ )
771+
772+ jwt_configuration : JwtConfiguration = Field (
773+ default_factory = lambda : JwtConfiguration (
774+ user_id_claim = constants .DEFAULT_JWT_UID_CLAIM ,
775+ username_claim = constants .DEFAULT_JWT_USER_NAME_CLAIM ,
776+ ),
777+ title = "JWT configuration" ,
778+ description = "JWT (JSON Web Token) configuration" ,
779+ )
695780
696781
697782class RHIdentityConfiguration (ConfigurationBase ):
698783 """Red Hat Identity authentication configuration."""
699784
700- required_entitlements : Optional [list [str ]] = None
785+ required_entitlements : Optional [list [str ]] = Field (
786+ None ,
787+ title = "Required entitlements" ,
788+ description = "List of all required entitlements." ,
789+ )
701790
702791
703792class AuthenticationConfiguration (ConfigurationBase ):
@@ -762,8 +851,18 @@ def rh_identity_configuration(self) -> RHIdentityConfiguration:
762851class CustomProfile :
763852 """Custom profile customization for prompts and validation."""
764853
765- path : str
766- prompts : dict [str , str ] = Field (default = {}, init = False )
854+ path : str = Field (
855+ ...,
856+ title = "Path to custom profile" ,
857+ description = "Path to Python modules containing custom profile." ,
858+ )
859+
860+ prompts : dict [str , str ] = Field (
861+ default = {},
862+ init = False ,
863+ title = "System prompts" ,
864+ description = "Dictionary containing map of system prompts" ,
865+ )
767866
768867 def __post_init__ (self ) -> None :
769868 """Validate and load profile."""
@@ -806,8 +905,17 @@ def check_customization_model(self) -> Self:
806905class InferenceConfiguration (ConfigurationBase ):
807906 """Inference configuration."""
808907
809- default_model : Optional [str ] = None
810- default_provider : Optional [str ] = None
908+ default_model : Optional [str ] = Field (
909+ None ,
910+ title = "Default model" ,
911+ description = "Identification of default model used when no other model is specified." ,
912+ )
913+
914+ default_provider : Optional [str ] = Field (
915+ None ,
916+ title = "Default provider" ,
917+ description = "Identification of default provider used when no other model is specified." ,
918+ )
811919
812920 @model_validator (mode = "after" )
813921 def check_default_model_and_provider (self ) -> Self :
@@ -826,10 +934,29 @@ def check_default_model_and_provider(self) -> Self:
826934class ConversationHistoryConfiguration (ConfigurationBase ):
827935 """Conversation history configuration."""
828936
829- type : Literal ["noop" , "memory" , "sqlite" , "postgres" ] | None = None
830- memory : Optional [InMemoryCacheConfig ] = None
831- sqlite : Optional [SQLiteDatabaseConfiguration ] = None
832- postgres : Optional [PostgreSQLDatabaseConfiguration ] = None
937+ type : Literal ["noop" , "memory" , "sqlite" , "postgres" ] | None = Field (
938+ None ,
939+ title = "Conversation history database type" ,
940+ description = "Type of database where the conversation history is to be stored." ,
941+ )
942+
943+ memory : Optional [InMemoryCacheConfig ] = Field (
944+ None ,
945+ title = "In-memory cache configuration" ,
946+ description = "In-memory cache configuration" ,
947+ )
948+
949+ sqlite : Optional [SQLiteDatabaseConfiguration ] = Field (
950+ None ,
951+ title = "SQLite configuration" ,
952+ description = "SQLite database configuration" ,
953+ )
954+
955+ postgres : Optional [PostgreSQLDatabaseConfiguration ] = Field (
956+ None ,
957+ title = "PostgreSQL configuration" ,
958+ description = "PostgreSQL database configuration" ,
959+ )
833960
834961 @model_validator (mode = "after" )
835962 def check_cache_configuration (self ) -> Self :
@@ -865,16 +992,47 @@ def check_cache_configuration(self) -> Self:
865992
866993
867994class ByokRag (ConfigurationBase ):
868- """BYOK RAG configuration."""
995+ """BYOK (Bring Your Own Knowledge) RAG configuration."""
869996
870- rag_id : constr (min_length = 1 ) # type:ignore
871- rag_type : constr (min_length = 1 ) = constants .DEFAULT_RAG_TYPE # type:ignore
872- embedding_model : constr (min_length = 1 ) = ( # type:ignore
873- constants .DEFAULT_EMBEDDING_MODEL
997+ rag_id : str = Field (
998+ ...,
999+ min_length = 1 ,
1000+ title = "RAG ID" ,
1001+ description = "Unique RAG ID" ,
1002+ )
1003+
1004+ rag_type : str = Field (
1005+ constants .DEFAULT_RAG_TYPE ,
1006+ min_length = 1 ,
1007+ title = "RAG type" ,
1008+ description = "Type of RAG database." ,
1009+ )
1010+
1011+ embedding_model : str = Field (
1012+ constants .DEFAULT_EMBEDDING_MODEL ,
1013+ min_length = 1 ,
1014+ title = "Embedding model" ,
1015+ description = "Embedding model identification" ,
1016+ )
1017+
1018+ embedding_dimension : PositiveInt = Field (
1019+ constants .DEFAULT_EMBEDDING_DIMENSION ,
1020+ title = "Embedding dimension" ,
1021+ description = "Dimensionality of embedding vectors." ,
1022+ )
1023+
1024+ vector_db_id : str = Field (
1025+ ...,
1026+ min_length = 1 ,
1027+ title = "Vector DB ID" ,
1028+ description = "Vector DB identification." ,
1029+ )
1030+
1031+ db_path : FilePath = Field (
1032+ ...,
1033+ title = "DB path" ,
1034+ description = "Path to RAG database." ,
8741035 )
875- embedding_dimension : PositiveInt = constants .DEFAULT_EMBEDDING_DIMENSION
876- vector_db_id : constr (min_length = 1 ) # type:ignore
877- db_path : FilePath
8781036
8791037
8801038class QuotaLimiterConfiguration (ConfigurationBase ):
@@ -1050,15 +1208,19 @@ class Configuration(ConfigurationBase):
10501208 )
10511209
10521210 inference : InferenceConfiguration = Field (
1053- default_factory = InferenceConfiguration ,
1211+ default_factory = lambda : InferenceConfiguration (
1212+ default_model = None , default_provider = None
1213+ ),
10541214 title = "Inference configuration" ,
10551215 description = "One LLM provider and one its model might be selected as "
10561216 "default ones. When no provider+model pair is specified in REST API "
10571217 "calls (query endpoints), the default provider and model are used." ,
10581218 )
10591219
10601220 conversation_cache : ConversationHistoryConfiguration = Field (
1061- default_factory = ConversationHistoryConfiguration ,
1221+ default_factory = lambda : ConversationHistoryConfiguration (
1222+ type = None , memory = None , sqlite = None , postgres = None
1223+ ),
10621224 title = "Conversation history configuration" ,
10631225 description = "Conversation history configuration." ,
10641226 )
0 commit comments