Skip to main content

qna_routes.py

Source: 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

Usage docs: https://docs.pydantic.dev/2.9/concepts/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_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]'

  • 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_str(self, join_str: 'str') -> 'str'

    • No docstring available.
  • rich_repr(self) -> 'RichReprResult'

  • 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.
  • _check_frozen(self, name: 'str', value: 'Any') -> 'None'

    • 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.
  • 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: 'dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'

Returns a copy of the model.

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' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'

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]. 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' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, serialize_as_any: 'bool' = False) -> 'str'

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]. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.

Returns: A JSON string representation of the model.

  • model_post_init(self, _BaseModel__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.
Sunholo Multivac

Get in touch to see if we can help with your GenAI project.

Contact us

Other Links

Sunholo Multivac - GenAIOps

Copyright ©

Holosun ApS 2024