qna_routes.py
Source: src/sunholo/agents/fastapi/qna_routes.py
Functions
register_qna_fastapi_routes(app, stream_interpreter, qna_interpreter)
No docstring available.
create_process_qna_endpoint(qna_interpreter)
No docstring available.
create_stream_qa_endpoint(stream_interpreter)
No docstring available.
Classes
VACRequest
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes: class_vars: The names of the class variables defined on the model. private_attributes: Metadata about the private attributes of the model. signature: The synthesized `init` [`Signature`][inspect.Signature] of the model.
pydantic_complete: Whether model building is completed, or if there are still undefined fields. pydantic_core_schema: The core schema of the model. pydantic_custom_init: Whether the model has a custom `init` function. pydantic_decorators: Metadata containing the decorators defined on the model. This replaces `Model.validators` and `Model.root_validators` from Pydantic V1. pydantic_generic_metadata: Metadata for generic models; contains data used for a similar purpose to args, origin, parameters in typing-module generics. May eventually be replaced by these. pydantic_parent_namespace: Parent namespace of the model, used for automatic rebuilding of models. pydantic_post_init: The name of the post-init method for the model, if defined. pydantic_root_model: Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. pydantic_serializer: The `pydantic-core` `SchemaSerializer` used to dump instances of the model. pydantic_validator: The `pydantic-core` `SchemaValidator` used to validate instances of the model.
pydantic_fields: A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. pydantic_computed_fields: A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects.
pydantic_extra: A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] is set to `'allow'`. pydantic_fields_set: The names of fields explicitly set during instantiation. pydantic_private: Values of private attributes set on the model instance.
-
copy(self) -> 'Self'
- Returns a shallow copy of the model.
-
deepcopy(self, memo: 'dict[int, Any] | None' = None) -> 'Self'
- Returns a deep copy of the model.
-
delattr(self, item: 'str') -> 'Any'
- Implement delattr(self, name).
-
eq(self, other: 'Any') -> 'bool'
- Return self==value.
-
getattr(self, item: 'str') -> 'Any'
- No docstring available.
-
getstate(self) -> 'dict[Any, Any]'
- Helper for pickle.
-
init(self, /, **data: 'Any') -> 'None'
- Create a new model by parsing and validating input data from keyword arguments.
Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
`self` is explicitly positional-only to allow `self` as a field name.
-
iter(self) -> 'TupleGenerator'
- So `dict(model)` works.
-
pretty(self, fmt: 'typing.Callable[[Any], Any]', **kwargs: 'Any') -> 'typing.Generator[Any, None, None]'
- Used by devtools (https://python-devtools.helpmanual.io/) to pretty print objects.
-
replace(self, **changes: 'Any') -> 'Self'
- No docstring available.
-
repr(self) -> 'str'
- Return repr(self).
-
repr_args(self) -> '_repr.ReprArgs'
- No docstring available.
-
repr_name(self) -> 'str'
- Name of the instance's class, used in repr.
-
repr_recursion(self, object: 'Any') -> 'str'
- Returns the string representation of a recursive object.
-
repr_str(self, join_str: 'str') -> 'str'
- No docstring available.
-
rich_repr(self) -> 'RichReprResult'
- Used by Rich (https://rich.readthedocs.io/en/stable/pretty.html) to pretty print objects.
-
setattr(self, name: 'str', value: 'Any') -> 'None'
- Implement setattr(self, name, value).
-
setstate(self, state: 'dict[Any, Any]') -> 'None'
- No docstring available.
-
str(self) -> 'str'
- Return str(self).
-
_calculate_keys(self, *args: 'Any', **kwargs: 'Any') -> 'Any'
- No docstring available.
-
_copy_and_set_values(self, *args: 'Any', **kwargs: 'Any') -> 'Any'
- No docstring available.
-
_iter(self, *args: 'Any', **kwargs: 'Any') -> 'Any'
- No docstring available.
-
_setattr_handler(self, name: 'str', value: 'Any') -> 'Callable[[BaseModel, str, Any], None] | None'
- Get a handler for setting an attribute on the model instance.
Returns: A handler for setting an attribute on the model instance. Used for memoization of the handler. Memoizing the handlers leads to a dramatic performance improvement in `setattr` Returns `None` when memoization is not safe, then the attribute is set directly.
- copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'
- Returns a copy of the model.
!!! warning "Deprecated"
This method is now deprecated; use model_copy
instead.
If you need include
or exclude
, use:
data = self.model_dump(include=include, exclude=exclude, round_trip=True)
data = {**data, **(update or {})}
copied = self.model_validate(data)
Args: include: Optional set or mapping specifying which fields to include in the copied model. exclude: Optional set or mapping specifying which fields to exclude in the copied model. update: Optional dictionary of field-value pairs to override field values in the copied model. deep: If True, the values of fields that are Pydantic models will be deep-copied.
Returns: A copy of the model with included, excluded and updated fields as specified.
-
dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'
- No docstring available.
-
json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'
- No docstring available.
-
model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'
- !!! abstract "Usage Documentation" `model_copy`
Returns a copy of the model.
!!! note The underlying instance's [`dict`][object.dict] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
Args: update: Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data. deep: Set to `True` to make a deep copy of the model.
Returns: New model instance.
- model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'
- !!! abstract "Usage Documentation" `model_dump`
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Args: mode: The mode in which `to_python` should run. If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects. include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of `None`. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. fallback: A function to call when an unknown value is encountered. If not provided, a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
Returns: A dictionary representation of the model.
- model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'
- !!! abstract "Usage Documentation" `model_dump_json`
Generates a JSON representation of the model using Pydantic's `to_json` method.
Args: indent: Indentation to use in the JSON output. If None is passed, the output will be compact. include: Field(s) to include in the JSON output. exclude: Field(s) to exclude from the JSON output. context: Additional context to pass to the serializer. by_alias: Whether to serialize using field aliases. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of `None`. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. fallback: A function to call when an unknown value is encountered. If not provided, a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
Returns: A JSON string representation of the model.
- model_post_init(self, context: 'Any', /) -> 'None'
- Override this method to perform additional initialization after `init` and `model_construct`. This is useful if you want to do some validation that requires the entire model to be initialized.