nv_ingest_api.internal.primitives package#
Subpackages#
- nv_ingest_api.internal.primitives.nim package
- Subpackages
- nv_ingest_api.internal.primitives.nim.model_interface package
- Submodules
- nv_ingest_api.internal.primitives.nim.model_interface.cached module
- nv_ingest_api.internal.primitives.nim.model_interface.decorators module
- nv_ingest_api.internal.primitives.nim.model_interface.deplot module
- nv_ingest_api.internal.primitives.nim.model_interface.helpers module
- nv_ingest_api.internal.primitives.nim.model_interface.nemoretriever_parse module
- nv_ingest_api.internal.primitives.nim.model_interface.paddle module
- nv_ingest_api.internal.primitives.nim.model_interface.parakeet module
- nv_ingest_api.internal.primitives.nim.model_interface.text_embedding module
- nv_ingest_api.internal.primitives.nim.model_interface.vlm module
- nv_ingest_api.internal.primitives.nim.model_interface.yolox module
- Module contents
- nv_ingest_api.internal.primitives.nim.model_interface package
- Submodules
- nv_ingest_api.internal.primitives.nim.default_values module
- nv_ingest_api.internal.primitives.nim.nim_client module
- nv_ingest_api.internal.primitives.nim.nim_model_interface module
- Module contents
- Subpackages
- nv_ingest_api.internal.primitives.tracing package
Submodules#
nv_ingest_api.internal.primitives.control_message_task module#
- class nv_ingest_api.internal.primitives.control_message_task.ControlMessageTask(
- *,
- type: str,
- id: str | ~uuid.UUID,
- properties: ~typing.Dict[str,
- ~typing.Any] = <factory>,
Bases:
BaseModel
- id: str | UUID#
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- properties: Dict[str, Any]#
- type: str#
nv_ingest_api.internal.primitives.ingest_control_message module#
- class nv_ingest_api.internal.primitives.ingest_control_message.IngestControlMessage[source]#
Bases:
object
A control message class for ingesting tasks and managing associated metadata, timestamps, configuration, and payload.
- add_task(
- task: ControlMessageTask,
Add a task to the control message, keyed by the task’s unique ‘id’.
- Raises:
ValueError – If a task with the same ‘id’ already exists.
- config(
- config: Dict[str, Any] | None = None,
Get or update the control message configuration.
If ‘config’ is provided, it must be a dictionary. The configuration is updated with the provided values. If no argument is provided, returns a copy of the current configuration.
- Raises:
ValueError – If the provided configuration is not a dictionary.
- copy() IngestControlMessage [source]#
Create a deep copy of this control message.
- filter_timestamp(
- regex_filter: str,
Retrieve timestamps whose keys match the regex filter.
- get_metadata(
- key: str | Pattern | None = None,
- default_value: Any | None = None,
Retrieve metadata. If ‘key’ is None, returns a copy of all metadata.
- Parameters:
key (str or re.Pattern, optional) – If a string is provided, returns the value for that exact key. If a regex pattern is provided, returns a dictionary of all metadata key-value pairs where the key matches the regex. If no matches are found, returns default_value.
default_value (Any, optional) – The value to return if the key is not found or no regex matches.
- Returns:
The metadata value for an exact string key, or a dict of matching metadata if a regex is provided.
- Return type:
Any
- get_tasks() Generator[ControlMessageTask, None, None] [source]#
Return all tasks as a generator.
- get_timestamp(
- key: str,
- fail_if_nonexist: bool = False,
Retrieve a timestamp for a given key.
- Raises:
KeyError – If the key is not found and ‘fail_if_nonexist’ is True.
- has_metadata(key: str | Pattern) bool [source]#
Check if a metadata key exists.
- Parameters:
key (str or re.Pattern) – If a string is provided, checks for the exact key. If a regex pattern is provided, returns True if any metadata key matches the regex.
- Returns:
True if the key (or any matching key, in case of a regex) exists, False otherwise.
- Return type:
bool
- payload(
- payload: DataFrame | None = None,
Get or set the payload DataFrame.
- Raises:
ValueError – If the provided payload is not a pandas DataFrame.
- remove_task(
- task_id: str,
Remove a task from the control message. Logs a warning if the task does not exist.
- nv_ingest_api.internal.primitives.ingest_control_message.remove_task_by_type(ctrl_msg, task: str)[source]#
Remove a task from the control message by matching its type.
This function iterates over the tasks in the control message, and if it finds a task whose type matches the provided task string, it removes that task (using its unique id) and returns the task’s properties.
- Parameters:
ctrl_msg (IngestControlMessage) – The control message from which to remove the task.
task (str) – The task type to remove.
- Returns:
The properties of the removed task.
- Return type:
dict
- Raises:
ValueError – If no task with the given type is found.