haive.core.schema.field_registryΒΆ
Field Registry for standardized field definitions across Haive.
This module provides a centralized registry of commonly used field definitions that can be referenced by nodes, engines, and schema composers. This ensures consistency and allows for selective state schema composition.
Key benefits: - Standardized field definitions across the framework - Selective inclusion in state schemas (only whatβs needed) - Type safety with proper generics - Token counting integration for messages - Backwards compatibility
ClassesΒΆ
Pre-defined sets of fields for common use cases. |
|
Dynamic field registry for custom field definitions. |
|
Registry of prebuilt state schemas for common use cases. |
|
Registry of standard field definitions used across Haive. |
FunctionsΒΆ
|
Get a standard field definition by name. |
Module ContentsΒΆ
- class haive.core.schema.field_registry.CommonFieldSets[source]ΒΆ
Pre-defined sets of fields for common use cases.
- class haive.core.schema.field_registry.FieldRegistry[source]ΒΆ
Dynamic field registry for custom field definitions.
This complements StandardFields by allowing registration of custom field definitions at runtime.
- classmethod get(name)[source]ΒΆ
Get a registered field definition.
- Parameters:
name (str)
- Return type:
- classmethod register(field_def)[source]ΒΆ
Register a custom field definition.
- Parameters:
field_def (haive.core.schema.field_definition.FieldDefinition)
- Return type:
None
- class haive.core.schema.field_registry.PrebuiltStates[source]ΒΆ
Registry of prebuilt state schemas for common use cases.
Hierarchy: - MessagesState (basic, no tokens) - MessagesStateWithTokenUsage (with token tracking)
LLMState (single engine + tokens + thresholds) - ToolState (tools + LLM features)
- classmethod base_messages_state()[source]ΒΆ
Get basic MessagesState without token tracking.
- Return type:
Any
- classmethod llm_state()[source]ΒΆ
Get LLMState for single-engine LLM agents with token tracking and model awareness.
- Return type:
Any
- class haive.core.schema.field_registry.StandardFields[source]ΒΆ
Registry of standard field definitions used across Haive.
Each field is defined with: - name: field name in snake_case - type: proper Python type annotation - description: human-readable description - default: default value or factory - metadata: additional field metadata
- classmethod messages(use_enhanced=True)[source]ΒΆ
Standard messages field for conversation history.
- Parameters:
use_enhanced (bool) β Whether to use the enhanced MessageList with token counting and metadata
- Return type:
- classmethod structured_output(model_class, field_name=None)[source]ΒΆ
Create a structured output field for a Pydantic model.
- Parameters:
- Return type:
- haive.core.schema.field_registry.get_standard_field(name, **kwargs)[source]ΒΆ
Get a standard field definition by name.
- Parameters:
name (str) β Standard field name (e.g., βmessagesβ, βcontextβ, βqueryβ)
**kwargs β Additional arguments passed to the field method
- Returns:
FieldDefinition or None if field not found
- Return type: