diff --git a/docs.json b/docs.json index 1f311f94e6..cb59c361c1 100644 --- a/docs.json +++ b/docs.json @@ -991,14 +991,6 @@ "pages": [ "weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server" ] - }, - { - "group": "Other", - "pages": [ - "weave/reference/python-sdk/weave/trace/op", - "weave/reference/python-sdk/weave/trace/weave_client", - "weave/reference/python-sdk/weave/trace_server/trace_server_interface" - ] } ] }, @@ -1030,6 +1022,7 @@ "weave/reference/typescript-sdk/functions/requirecurrentchildsummary", "weave/reference/typescript-sdk/functions/weaveaudio", "weave/reference/typescript-sdk/functions/weaveimage", + "weave/reference/typescript-sdk/functions/withattributes", "weave/reference/typescript-sdk/functions/wrapopenai" ] }, @@ -1098,7 +1091,9 @@ "inference/usage-limits", { "group": "Tutorials", - "pages": ["inference/tutorials/creating-lora"] + "pages": [ + "inference/tutorials/creating-lora" + ] }, { "group": "API Reference", @@ -2625,4 +2620,4 @@ } ], "baseUrl": "https://docs.wandb.ai" -} +} \ No newline at end of file diff --git a/weave/reference/python-sdk.mdx b/weave/reference/python-sdk.mdx index 2949788cdf..d5804006ac 100644 --- a/weave/reference/python-sdk.mdx +++ b/weave/reference/python-sdk.mdx @@ -3,280 +3,1578 @@ title: "weave" description: "Python SDK reference for weave" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + + +## class `Agent` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `model_name`: `` +- `temperature`: `` +- `system_message`: `` +- `tools`: `list[typing.Any]` + + + +### method `step` + +```python +step(state: AgentState) → AgentState +``` + +Run a step of the agent. + +**Args:** + + + - `state`: The current state of the environment. + - `action`: The action to take. +**Returns:** + The new state of the environment. + +--- + + + +## class `AgentState` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `history`: `list[typing.Any]` + +--- + + + +## class `AnnotationSpec` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `field_schema`: `dict[str, typing.Any]` +- `unique_among_creators`: `` +- `op_scope`: `list[str] | None` + + + +### classmethod `preprocess_field_schema` + +```python +preprocess_field_schema(data: dict[str, Any]) → dict[str, Any] +``` + +--- + + + +### classmethod `validate_field_schema` + +```python +validate_field_schema(schema: dict[str, Any]) → dict[str, Any] +``` + +--- + + + +### method `value_is_valid` + +```python +value_is_valid(payload: Any) → bool +``` + +Validates a payload against this annotation spec's schema. + +**Args:** + + + - `payload`: The data to validate against the schema +**Returns:** + + - `bool`: True if validation succeeds, False otherwise + +--- + + + +## class `Audio` +A class representing audio data in a supported format (wav or mp3). + +This class handles audio data storage and provides methods for loading from different sources and exporting to files. + +**Attributes:** + + - `format`: The audio format (currently supports 'wav' or 'mp3') + - `data`: The raw audio data as bytes + +**Args:** + + + - `data`: The audio data (bytes or base64 encoded string) + - `format`: The audio format ('wav' or 'mp3') + - `validate_base64`: Whether to attempt base64 decoding of the input data +**Raises:** + + - `ValueError`: If audio data is empty or format is not supported + + + +### method `__init__` + +```python +__init__( + data: 'bytes', + format: 'SUPPORTED_FORMATS_TYPE', + validate_base64: 'bool' = True +) → None +``` + +--- + + + +### method `export` + +```python +export(path: 'str | bytes | Path | PathLike') → None +``` + +Export audio data to a file. + +**Args:** + + +--- + + + +### classmethod `from_data` + +```python +from_data(data: 'str | bytes', format: 'str') → Self +``` + +Create an Audio object from raw data and specified format. + + - `path`: Path where the audio file should be written +**Args:** + + + - `data`: Audio data as bytes or base64 encoded string + - `format`: Audio format ('wav' or 'mp3') +**Returns:** + + - `Audio`: A new Audio instance + +**Raises:** + + - `ValueError`: If format is not supported + +--- + + + +### classmethod `from_path` + +```python +from_path(path: 'str | bytes | Path | PathLike') → Self +``` + +Create an Audio object from a file path. + +**Args:** + + + - `path`: Path to an audio file (must have .wav or .mp3 extension) +**Returns:** + + - `Audio`: A new Audio instance loaded from the file + +**Raises:** + + - `ValueError`: If file doesn't exist or has unsupported extension + +--- + + + +## class `Content` +A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata. + +This class must be instantiated using one of its classmethods: +- from_path() +- from_bytes() +- from_text() +- from_url() +- from_base64() +- from_data_url() + + + +### method `__init__` + +```python +__init__(*args: 'Any', **kwargs: 'Any') → None +``` + +Direct initialization is disabled. Please use a classmethod like `Content.from_path()` to create an instance. + +**Pydantic Fields:** + +- `data`: `` +- `size`: `` +- `mimetype`: `` +- `digest`: `` +- `filename`: `` +- `content_type`: `typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']` +- `input_type`: `` +- `encoding`: `` +- `metadata`: `dict[str, typing.Any] | None` +- `extension`: `str | None` + +--- + +#### property art + +#### property ref + +--- + + + +### method `as_string` + +```python +as_string() → str +``` + +Display the data as a string. Bytes are decoded using the `encoding` attribute If base64, the data will be re-encoded to base64 bytes then decoded to an ASCII string + +**Returns:** + str. + +--- + + + +### classmethod `from_base64` + +```python +from_base64( + b64_data: 'str | bytes', + extension: 'str | None' = None, + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None +) → Self +``` + +Initializes Content from a base64 encoded string or bytes. + +--- + + + +### classmethod `from_bytes` + +```python +from_bytes( + data: 'bytes', + extension: 'str | None' = None, + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None, + encoding: 'str' = 'utf-8' +) → Self +``` + +Initializes Content from raw bytes. + +--- + + + +### classmethod `from_data_url` + +```python +from_data_url(url: 'str', metadata: 'dict[str, Any] | None' = None) → Self +``` + +Initializes Content from a data URL. + +--- + + + +### classmethod `from_path` + +```python +from_path( + path: 'str | Path', + encoding: 'str' = 'utf-8', + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None +) → Self +``` + +Initializes Content from a local file path. + +--- + + + +### classmethod `from_text` + +```python +from_text( + text: 'str', + extension: 'str | None' = None, + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None, + encoding: 'str' = 'utf-8' +) → Self +``` + +Initializes Content from a string of text. + +--- + + + +### classmethod `from_url` + +```python +from_url( + url: 'str', + headers: 'dict[str, Any] | None' = None, + timeout: 'int | None' = 30, + metadata: 'dict[str, Any] | None' = None +) → Self +``` + +Initializes Content by fetching bytes from an HTTP(S) URL. + +Downloads the content, infers mimetype/extension from headers, URL path, and data, and constructs a Content object from the resulting bytes. + +--- + + + +### classmethod `model_validate` + +```python +model_validate( + obj: 'Any', + strict: 'bool | None' = None, + from_attributes: 'bool | None' = None, + context: 'dict[str, Any] | None' = None +) → Self +``` + +Override model_validate to handle Content reconstruction from dict. + +--- + + + +### classmethod `model_validate_json` + +```python +model_validate_json( + json_data: 'str | bytes | bytearray', + strict: 'bool | None' = None, + context: 'dict[str, Any] | None' = None +) → Self +``` + +Override model_validate_json to handle Content reconstruction from JSON. + +--- + + + +### method `open` + +```python +open() → bool +``` + +Open the file using the operating system's default application. + +This method uses the platform-specific mechanism to open the file with the default application associated with the file's type. + +**Returns:** + + - `bool`: True if the file was successfully opened, False otherwise. + +--- + + + +### method `save` + +```python +save(dest: 'str | Path') → None +``` + +Copy the file to the specified destination path. Updates the filename and the path of the content to reflect the last saved copy. + +**Args:** + + +--- + + + +### method `serialize_data` + +```python +serialize_data(data: 'bytes') → str +``` + +When dumping model in json mode + +--- + + + +### method `to_data_url` + +```python +to_data_url(use_base64: 'bool' = True) → str +``` + +Constructs a data URL from the content. + + - `dest`: Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. If dest has no file extension (e.g. .txt), destination will be considered a directory. +**Args:** + + + - `use_base64`: If True, the data will be base64 encoded. Otherwise, it will be percent-encoded. Defaults to True. +**Returns:** + A data URL string. + +--- + + + +## class `Dataset` +Dataset object with easy saving and automatic versioning. + +**Examples:** +```python +# Create a dataset +dataset = Dataset(name='grammar', rows=[ + {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."}, + {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."}, + {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."} +]) + +# Publish the dataset +weave.publish(dataset) + +# Retrieve the dataset +dataset_ref = weave.ref('grammar').get() + +# Access a specific example +example_label = dataset_ref.rows[2]['sentence'] +``` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `rows`: `trace.table.Table | trace.vals.WeaveTable` + + + +### method `add_rows` + +```python +add_rows(rows: Iterable[dict]) → Dataset +``` + +Create a new dataset version by appending rows to the existing dataset. + +This is useful for adding examples to large datasets without having to load the entire dataset into memory. + +**Args:** + + + - `rows`: The rows to add to the dataset. +**Returns:** + The updated dataset. + +--- + + + +### classmethod `convert_to_table` + +```python +convert_to_table(rows: Any) → Table | WeaveTable +``` + +--- + + + +### classmethod `from_calls` + +```python +from_calls(calls: Iterable[Call]) → Self +``` + +--- + + + +### classmethod `from_hf` + +```python +from_hf( + hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')] +) → Self +``` + +--- + + + +### classmethod `from_obj` + +```python +from_obj(obj: WeaveObject) → Self +``` + +--- + + + +### classmethod `from_pandas` + +```python +from_pandas(df: 'DataFrame') → Self +``` + +--- + + + +### method `select` + +```python +select(indices: Iterable[int]) → Self +``` + +Select rows from the dataset based on the provided indices. + +**Args:** + + + - `indices`: An iterable of integer indices specifying which rows to select. +**Returns:** + A new Dataset object containing only the selected rows. + +--- + + + +### method `to_hf` + +```python +to_hf() → HFDataset +``` + +--- + + + +### method `to_pandas` + +```python +to_pandas() → DataFrame +``` + +--- + + + +## class `EasyPrompt` + + + +### method `__init__` + +```python +__init__( + content: str | dict | list | None = None, + role: str | None = None, + dedent: bool = False, + **kwargs: Any +) → None +``` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `data`: `` +- `config`: `` +- `requirements`: `` + +--- + +#### property as_str + +Join all messages into a single string. + +--- + +#### property is_bound + +--- + +#### property messages + +#### property placeholders + +--- + +#### property system_message + +Join all messages into a system prompt message. + +--- + +#### property system_prompt + +Join all messages into a system prompt object. + +--- + +#### property unbound_placeholders + +--- + + + +### method `append` + +```python +append(item: Any, role: str | None = None, dedent: bool = False) → None +``` + +--- + + + +### method `as_dict` + +```python +as_dict() → dict[str, Any] +``` + +--- + + + +### method `as_pydantic_dict` + +```python +as_pydantic_dict() → dict[str, Any] +``` + +--- + + + +### method `bind` + +```python +bind(*args: Any, **kwargs: Any) → Prompt +``` + +--- + + + +### method `bind_rows` + +```python +bind_rows(dataset: list[dict] | Any) → list['Prompt'] +``` + +--- + + + +### method `config_table` + +```python +config_table(title: str | None = None) → Table +``` + +--- + + + +### method `configure` + +```python +configure(config: dict | None = None, **kwargs: Any) → Prompt +``` + +--- + + + +### method `dump` + +```python +dump(fp: ) → None +``` + +--- + + + +### method `dump_file` + +```python +dump_file(filepath: str | Path) → None +``` + +--- + + + +### method `format` + +```python +format(**kwargs: Any) → Any +``` + +--- + + + +### classmethod `from_obj` + +```python +from_obj(obj: WeaveObject) → Self +``` + +--- + + + +### classmethod `load` + +```python +load(fp: ) → Self +``` + +--- + + + +### classmethod `load_file` + +```python +load_file(filepath: str | Path) → Self +``` + +--- + + + +### method `messages_table` + +```python +messages_table(title: str | None = None) → Table +``` + +--- + + + +### method `print` + +```python +print() → str +``` + +--- + + + +### method `publish` + +```python +publish(name: str | None = None) → ObjectRef +``` + +--- + + + +### method `require` + +```python +require(param_name: str, **kwargs: Any) → Prompt +``` + +--- + + + +### method `run` + +```python +run() → Any +``` + +--- + + + +### method `validate_requirement` + +```python +validate_requirement(key: str, value: Any) → list +``` + +--- + + + +### method `validate_requirements` + +```python +validate_requirements(values: dict[str, Any]) → list +``` + +--- + + + +### method `values_table` + +```python +values_table(title: str | None = None) → Table +``` + +--- + + + +## class `Evaluation` +Sets up an evaluation which includes a set of scorers and a dataset. + +Calling evaluation.evaluate(model) will pass in rows from a dataset into a model matching the names of the columns of the dataset to the argument names in model.predict. + +Then it will call all of the scorers and save the results in weave. + +If you want to preprocess the rows from the dataset you can pass in a function to preprocess_model_input. + +**Examples:** +```python +# Collect your examples +examples = [ + {"question": "What is the capital of France?", "expected": "Paris"}, + {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"}, + {"question": "What is the square root of 64?", "expected": "8"}, +] + +# Define any custom scoring function +@weave.op +def match_score1(expected: str, model_output: dict) -> dict: + # Here is where you'd define the logic to score the model output + return {'match': expected == model_output['generated_text']} + +@weave.op +def function_to_evaluate(question: str): + # here's where you would add your LLM call and return the output + return {'generated_text': 'Paris'} + +# Score your examples using scoring functions +evaluation = Evaluation( + dataset=examples, scorers=[match_score1] +) + +# Start tracking the evaluation +weave.init('intro-example') +# Run the evaluation +asyncio.run(evaluation.evaluate(function_to_evaluate)) +``` + +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `dataset`: `` +- `scorers`: `list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]] | None` +- `preprocess_model_input`: `collections.abc.Callable[[dict], dict] | None` +- `trials`: `` +- `metadata`: `dict[str, typing.Any] | None` +- `evaluation_name`: `str | collections.abc.Callable[trace.call.Call, str] | None` + + + +### method `evaluate` + +```python +evaluate(model: Op | Model) → dict +``` + +--- + + + +### classmethod `from_obj` + +```python +from_obj(obj: WeaveObject) → Self +``` + +--- + + + +### method `get_eval_results` + +```python +get_eval_results(model: Op | Model) → EvaluationResults +``` + +--- + + + +### method `get_evaluate_calls` + +```python +get_evaluate_calls() → PaginatedIterator[CallSchema, WeaveObject] +``` + +Retrieve all evaluation calls that used this Evaluation object. + +Note that this returns a CallsIter instead of a single call because it's possible to have multiple evaluation calls for a single evaluation (e.g. if you run the same evaluation multiple times). + +**Returns:** + + - `CallsIter`: An iterator over Call objects representing evaluation runs. + +**Raises:** + + - `ValueError`: If the evaluation has no ref (hasn't been saved/run yet). + +**Examples:** +```python +evaluation = Evaluation(dataset=examples, scorers=[scorer]) +await evaluation.evaluate(model) # Run evaluation first +calls = evaluation.get_evaluate_calls() +for call in calls: + print(f"Evaluation run: {call.id} at {call.started_at}") +``` + +--- + + + +### method `get_score_calls` + +```python +get_score_calls() → dict[str, list[Call]] +``` + +Retrieve scorer calls for each evaluation run, grouped by trace ID. + +**Returns:** + + - `dict[str, list[Call]]`: A dictionary mapping trace IDs to lists of scorer Call objects. Each trace ID represents one evaluation run, and the list contains all scorer calls executed during that run. + +**Examples:** +```python +evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) +await evaluation.evaluate(model) +score_calls = evaluation.get_score_calls() +for trace_id, calls in score_calls.items(): + print(f"Trace {trace_id}: {len(calls)} scorer calls") + for call in calls: + scorer_name = call.summary.get("weave", {}).get("trace_name") + print(f" Scorer: {scorer_name}, Output: {call.output}") +``` + +--- + + + +### method `get_scores` + +```python +get_scores() → dict[str, dict[str, list[Any]]] +``` + +Extract and organize scorer outputs from evaluation runs. + +**Returns:** + + - `dict[str, dict[str, list[Any]]]`: A nested dictionary structure where: + - First level keys are trace IDs (evaluation runs) + - Second level keys are scorer names + - Values are lists of scorer outputs for that run and scorer + +**Examples:** +```python +evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) +await evaluation.evaluate(model) +scores = evaluation.get_scores() +# Access scores by trace and scorer +for trace_id, trace_scores in scores.items(): + print(f"Evaluation run {trace_id}:") + for scorer_name, outputs in trace_scores.items(): + print(f" {scorer_name}: {outputs}") +``` + +Expected output: + +``` +{ + "trace_123": { + "accuracy_scorer": [{"accuracy": 0.85}], + "f1_scorer": [{"f1": 0.78}] + } +} +``` + +--- + + + +### method `model_post_init` + +```python +model_post_init(_Evaluation__context: Any) → None +``` + +--- + + + +### method `predict_and_score` + +```python +predict_and_score(model: Op | Model, example: dict) → dict +``` + +--- + + + +### method `summarize` + +```python +summarize(eval_table: EvaluationResults) → dict +``` + +--- + + + +## class `EvaluationLogger` +This class provides an imperative interface for logging evaluations. + +An evaluation is started automatically when the first prediction is logged using the `log_prediction` method, and finished when the `log_summary` method is called. + +Each time you log a prediction, you will get back a `ScoreLogger` object. You can use this object to log scores and metadata for that specific prediction. For more information, see the `ScoreLogger` class. + +Basic usage - log predictions with inputs and outputs directly: + +```python +ev = EvaluationLogger() + +# Log predictions with known inputs/outputs +pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'}) +pred.log_score("correctness", 0.9) + +# Finish the evaluation +ev.log_summary({"avg_score": 0.9}) +``` + +Advanced usage - use context manager for dynamic outputs and nested operations: + +```python +ev = EvaluationLogger() + +# Use context manager when you need to capture nested operations +with ev.log_prediction(inputs={'q': 'Hello'}) as pred: + # Any operations here (like LLM calls) automatically become + # children of the predict call + response = your_llm_call(...) + pred.output = response.content + pred.log_score("correctness", 0.9) + +# Finish the evaluation +ev.log_summary({"avg_score": 0.9}) +``` + + + +### method `__init__` + +```python +__init__( + name: 'str | None' = None, + model: 'Model | dict | str | None' = None, + dataset: 'Dataset | list[dict] | str | None' = None, + eval_attributes: 'dict[str, Any] | None' = None, + scorers: 'list[str] | None' = None +) → None +``` + +--- + +#### property attributes + +--- + +#### property ui_url -### function `init` +--- + + + +### method `fail` ```python -init( - project_name: 'str', - settings: 'UserSettings | dict[str, Any] | None' = None, - autopatch_settings: 'AutopatchSettings | None' = None, - global_postprocess_inputs: 'PostprocessInputsFunc | None' = None, - global_postprocess_output: 'PostprocessOutputFunc | None' = None, - global_attributes: 'dict[str, Any] | None' = None -) → WeaveClient +fail(exception: 'BaseException') → None ``` -Initialize weave tracking, logging to a wandb project. +Convenience method to fail the evaluation with an exception. -Logging is initialized globally, so you do not need to keep a reference to the return value of init. +--- -Following init, calls of weave.op() decorated functions will be logged to the specified project. + -**Args:** - +### method `finish` -NOTE: Global postprocessing settings are applied to all ops after each op's own postprocessing. The order is always: 1. Op-specific postprocessing 2. Global postprocessing +```python +finish(exception: 'BaseException | None' = None) → None +``` - - `project_name`: The name of the Weights & Biases team and project to log to. If you don't specify a team, your default entity is used. To find or update your default entity, refer to [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team) in the W&B Models documentation. - - `settings`: Configuration for the Weave client generally. - - `autopatch_settings`: (Deprecated) Configuration for autopatch integrations. Use explicit patching instead. - - `global_postprocess_inputs`: A function that will be applied to all inputs of all ops. - - `global_postprocess_output`: A function that will be applied to all outputs of all ops. - - `global_attributes`: A dictionary of attributes that will be applied to all traces. -**Returns:** - A Weave client. +Clean up the evaluation resources explicitly without logging a summary. + +Ensures all prediction calls and the main evaluation call are finalized. This is automatically called if the logger is used as a context manager. --- - + -### function `publish` +### method `log_example` ```python -publish(obj: 'Any', name: 'str | None' = None) → ObjectRef +log_example( + inputs: 'dict[str, Any]', + output: 'Any', + scores: 'dict[str, ScoreType]' +) → None ``` -Save and version a Python object. +Log a complete example with inputs, output, and scores. -Weave creates a new version of the object if the object's name already exists and its content hash does not match the latest version of that object. +This is a convenience method that combines log_prediction and log_score for when you have all the data upfront. **Args:** - - `obj`: The object to save and version. - - `name`: The name to save the object under. -**Returns:** - A Weave Ref to the saved object. + - `inputs`: The input data for the prediction + - `output`: The output value + - `scores`: Dictionary mapping scorer names to score values +**Example:** +```python +ev = EvaluationLogger() +ev.log_example( + inputs={'q': 'What is 2+2?'}, + output='4', + scores={'correctness': 1.0, 'fluency': 0.9} +) +``` --- - + -### function `ref` +### method `log_prediction` ```python -ref(location: 'str') → ObjectRef +log_prediction(inputs: 'dict[str, Any]', output: 'Any' = None) → ScoreLogger ``` -Creates a Ref to an existing Weave object. This does not directly retrieve the object but allows you to pass it to other Weave API functions. +Log a prediction to the Evaluation. + +Returns a ScoreLogger that can be used directly or as a context manager. **Args:** - - `location`: A Weave Ref URI, or if `weave.init()` has been called, `name:version` or `name`. If no version is provided, `latest` is used. + - `inputs`: The input data for the prediction + - `output`: The output value. Defaults to None. Can be set later using pred.output. **Returns:** - A Weave Ref to the object. + ScoreLogger for logging scores and optionally finishing the prediction. + +Example (direct): + - `pred = ev.log_prediction({'q'`: '...'}, output="answer") pred.log_score("correctness", 0.9) pred.finish() + +Example (context manager): + - `with ev.log_prediction({'q'`: '...'}) as pred: response = model(...) pred.output = response pred.log_score("correctness", 0.9) # Automatically calls finish() on exit --- - + -### function `get` +### method `log_summary` ```python -get(uri: 'str | ObjectRef') → Any +log_summary(summary: 'dict | None' = None, auto_summarize: 'bool' = True) → None ``` -A convenience function for getting an object from a URI. +Log a summary dict to the Evaluation. -Many objects logged by Weave are automatically registered with the Weave server. This function allows you to retrieve those objects by their URI. +This will calculate the summary, call the summarize op, and then finalize the evaluation, meaning no more predictions or scores can be logged. + +--- + + + +### method `set_view` + +```python +set_view( + name: 'str', + content: 'Content | str', + extension: 'str | None' = None, + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None, + encoding: 'str' = 'utf-8' +) → None +``` + +Attach a view to the evaluation's main call summary under `weave.views`. + +Saves the provided content as an object in the project and writes its reference URI under `summary.weave.views.` for the evaluation's `evaluate` call. String inputs are wrapped as text content using `Content.from_text` with the provided extension or mimetype. **Args:** - - `uri`: A fully-qualified weave ref URI. + - `name`: The view name to display, used as the key under `summary.weave.views`. + - `content`: A `weave.Content` instance or string to serialize. + - `extension`: Optional file extension for string content inputs. + - `mimetype`: Optional MIME type for string content inputs. + - `metadata`: Optional metadata attached to newly created `Content`. + - `encoding`: Text encoding for string content inputs. **Returns:** - The object. + None + +**Examples:** + ``` import weave``` + >>> ev = weave.EvaluationLogger() + >>> ev.set_view("report", "# Report", extension="md") + +--- + + + +## class `File` +A class representing a file with path, mimetype, and size information. + + + +### method `__init__` -**Example:** ```python -weave.init("weave_get_example") -dataset = weave.Dataset(rows=[{"a": 1, "b": 2}]) -ref = weave.publish(dataset) +__init__(path: 'str | Path', mimetype: 'str | None' = None) +``` -dataset2 = weave.get(ref) # same as dataset! +Initialize a File object. + +**Args:** + + +--- + +#### property filename + +Get the filename of the file. + + - `path`: Path to the file (string or pathlib.Path) + - `mimetype`: Optional MIME type of the file - will be inferred from extension if not provided +**Returns:** + + - `str`: The name of the file without the directory path. + +--- + + + +### method `open` + +```python +open() → bool ``` +Open the file using the operating system's default application. + +This method uses the platform-specific mechanism to open the file with the default application associated with the file's type. + +**Returns:** + + - `bool`: True if the file was successfully opened, False otherwise. + --- - + -### function `require_current_call` +### method `save` ```python -require_current_call() → Call +save(dest: 'str | Path') → None ``` -Get the Call object for the currently executing Op, within that Op. +Copy the file to the specified destination path. -This allows you to access attributes of the Call such as its id or feedback while it is running. +**Args:** + + +--- + + + +## class `Markdown` +A Markdown renderable. + + - `dest`: Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. +**Args:** + + - `markup` (str): A string containing markdown. + - `code_theme` (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes. + - `justify` (JustifyMethod, optional): Justify value for paragraphs. Defaults to None. + - `style` (Union[str, Style], optional): Optional style to apply to markdown. + - `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``. + + + +### method `__init__` ```python -@weave.op -def hello(name: str) -> None: - print(f"Hello {name}!") - current_call = weave.require_current_call() - print(current_call.id) +__init__( + markup: 'str', + code_theme: 'str' = 'monokai', + justify: 'JustifyMethod | None' = None, + style: 'str | Style' = 'none', + hyperlinks: 'bool' = True, + inline_code_lexer: 'str | None' = None, + inline_code_theme: 'str | None' = None +) → None ``` -It is also possible to access a Call after the Op has returned. +--- -If you have the Call's id, perhaps from the UI, you can use the `get_call` method on the `WeaveClient` returned from `weave.init` to retrieve the Call object. + + +## class `MessagesPrompt` + + + +### method `__init__` ```python -client = weave.init("") -mycall = client.get_call("") +__init__(messages: list[dict]) ``` -Alternately, after defining your Op you can use its `call` method. For example: + - `inline_code_lexer`: (str, optional): Lexer to use if inline code highlighting is enabled. Defaults to None. + - `inline_code_theme`: (Optional[str], optional): Pygments theme for inline code highlighting, or None for no highlighting. Defaults to None. +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `messages`: `list[dict]` + + + +### method `format` ```python -@weave.op -def add(a: int, b: int) -> int: - return a + b +format(**kwargs: Any) → list +``` -result, call = add.call(1, 2) -print(call.id) +--- + + + +### method `format_message` + +```python +format_message(message: dict, **kwargs: Any) → dict ``` -**Returns:** - The Call object for the currently executing Op +Format a single message by replacing template variables. -**Raises:** - - - `NoCurrentCallError`: If tracking has not been initialized or this method is invoked outside an Op. +This method delegates to the standalone format_message_with_template_vars function for the actual formatting logic. --- - + -### function `get_current_call` +### classmethod `from_obj` ```python -get_current_call() → Call | None +from_obj(obj: WeaveObject) → Self ``` -Get the Call object for the currently executing Op, within that Op. +--- -**Returns:** - The Call object for the currently executing Op, or None if tracking has not been initialized or this method is invoked outside an Op. + + +## class `Model` +Intended to capture a combination of code and data the operates on an input. For example it might call an LLM with a prompt to make a prediction or generate text. + +When you change the attributes or the code that defines your model, these changes will be logged and the version will be updated. This ensures that you can compare the predictions across different versions of your model. Use this to iterate on prompts or to try the latest LLM and compare predictions across different settings + +**Examples:** +```python +class YourModel(Model): + attribute1: str + attribute2: int -**Note:** + @weave.op + def predict(self, input_data: str) -> dict: + # Model logic goes here + prediction = self.attribute1 + ' ' + input_data + return {'pred': prediction} +``` -> The returned Call's ``attributes`` dictionary becomes immutable once the call starts. Use :func:`weave.attributes` to set call metadata before invoking an Op. The ``summary`` field may be updated while the Op executes and will be merged with computed summary information when the call finishes. +**Pydantic Fields:** ---- +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` - + -### function `finish` +### method `get_infer_method` ```python -finish() → None +get_infer_method() → Callable ``` -Stops logging to weave. - -Following finish, calls of weave.op() decorated functions will no longer be logged. You will need to run weave.init() again to resume logging. - --- - + -### function `op` +## class `Monitor` +Sets up a monitor to score incoming calls automatically. +**Examples:** ```python -op( - func: 'Callable[P, R] | None' = None, - name: 'str | None' = None, - call_display_name: 'str | CallDisplayNameFunc | None' = None, - postprocess_inputs: 'PostprocessInputsFunc | None' = None, - postprocess_output: 'PostprocessOutputFunc | None' = None, - tracing_sample_rate: 'float' = 1.0, - enable_code_capture: 'bool' = True, - accumulator: 'Callable[[Any | None, Any], Any] | None' = None -) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R] +import weave +from weave.scorers import ValidJSONScorer + +json_scorer = ValidJSONScorer() + +my_monitor = weave.Monitor( + name="my-monitor", + description="This is a test monitor", + sampling_rate=0.5, + op_names=["my_op"], + query={ + "$expr": { + "$gt": [ + { + "$getField": "started_at" + }, + { + "$literal": 1742540400 + } + ] + } + } + }, + scorers=[json_scorer], +) + +my_monitor.activate() ``` -A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior. +**Pydantic Fields:** ---- +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `sampling_rate`: `` +- `scorers`: `list[flow.scorer.Scorer]` +- `op_names`: `list[str]` +- `query`: `trace_server.interface.query.Query | None` +- `active`: `` - + -### function `attributes` +### method `activate` ```python -attributes(attributes: 'dict[str, Any]') → Iterator +activate() → ObjectRef ``` -Context manager for setting attributes on a call. +Activates the monitor. -**Example:** -```python -with weave.attributes({'env': 'production'}): - print(my_function.call("World")) -``` +**Returns:** + The ref to the monitor. --- - + -### function `thread` +### method `deactivate` ```python -thread( - thread_id: 'str | None | object' = -) → Iterator[ThreadContext] +deactivate() → ObjectRef ``` -Context manager for setting thread_id on calls within the context. +Deactivates the monitor. -**Examples:** -```python -# Auto-generate thread_id -with weave.thread() as t: - print(f"Thread ID: {t.thread_id}") - result = my_function("input") # This call will have the auto-generated thread_id - print(f"Current turn: {t.turn_id}") +**Returns:** + The ref to the monitor. -# Explicit thread_id -with weave.thread("custom_thread") as t: - result = my_function("input") # This call will have thread_id="custom_thread" +--- -# Disable threading -with weave.thread(None) as t: - result = my_function("input") # This call will have thread_id=None -``` + -**Args:** - +### classmethod `from_obj` - - `thread_id`: The thread identifier to associate with calls in this context. If not provided, a UUID v7 will be auto-generated. If None, thread tracking will be disabled. -**Yields:** - - - `ThreadContext`: An object providing access to thread_id and current turn_id. +```python +from_obj(obj: WeaveObject) → Self +``` --- - + ## class `Object` Base class for Weave objects that can be tracked and versioned. @@ -300,13 +1598,11 @@ obj = Object.from_uri("weave:///entity/project/object:digest") **Pydantic Fields:** -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` - ---------- +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` - + ### classmethod `from_uri` @@ -336,7 +1632,7 @@ obj = MyObject.from_uri("weave:///entity/project/object:digest") --- - + ### classmethod `handle_relocatable_object` @@ -373,1701 +1669,1530 @@ This validator handles special cases where the input is an ObjectRef or WeaveObj --- - - -## class `Dataset` -Dataset object with easy saving and automatic versioning. - -**Examples:** -```python -# Create a dataset -dataset = Dataset(name='grammar', rows=[ - {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."}, - {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."}, - {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."} -]) - -# Publish the dataset -weave.publish(dataset) - -# Retrieve the dataset -dataset_ref = weave.ref('grammar').get() - -# Access a specific example -example_label = dataset_ref.rows[2]['sentence'] -``` - -**Pydantic Fields:** - -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `rows`: `typing.Union[trace.table.Table, trace.vals.WeaveTable]` - ---------- - - - -### method `add_rows` - -```python -add_rows(rows: Iterable[dict]) → Dataset -``` - -Create a new dataset version by appending rows to the existing dataset. - -This is useful for adding examples to large datasets without having to load the entire dataset into memory. - -**Args:** - - - - `rows`: The rows to add to the dataset. -**Returns:** - The updated dataset. + ---- +## class `ObjectRef` +ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) - + -### classmethod `convert_to_table` +### method `__init__` ```python -convert_to_table(rows: Any) → Union[Table, WeaveTable] +__init__( + entity: 'str', + project: 'str', + name: 'str', + _digest: 'str | Future[str]', + _extra: 'tuple[str | Future[str], ]' = () +) → None ``` --- - - -### classmethod `from_calls` - -```python -from_calls(calls: Iterable[Call]) → Self -``` +#### property digest --- - - -### classmethod `from_hf` - -```python -from_hf( - hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')] -) → Self -``` +#### property extra --- - + -### classmethod `from_obj` +### method `as_param_dict` ```python -from_obj(obj: WeaveObject) → Self +as_param_dict() → dict ``` --- - + -### classmethod `from_pandas` +### method `delete` ```python -from_pandas(df: 'DataFrame') → Self +delete() → None ``` --- - + -### method `select` +### method `get` ```python -select(indices: Iterable[int]) → Self +get(objectify: 'bool' = True) → Any ``` -Select rows from the dataset based on the provided indices. - -**Args:** - - - - `indices`: An iterable of integer indices specifying which rows to select. -**Returns:** - A new Dataset object containing only the selected rows. - --- - + -### method `to_hf` +### method `is_descended_from` ```python -to_hf() → HFDataset +is_descended_from(potential_ancestor: 'ObjectRef') → bool ``` --- - + -### method `to_pandas` +### method `maybe_parse_uri` ```python -to_pandas() → DataFrame +maybe_parse_uri(s: 'str') → AnyRef | None ``` --- - - -## class `Model` -Intended to capture a combination of code and data the operates on an input. For example it might call an LLM with a prompt to make a prediction or generate text. - -When you change the attributes or the code that defines your model, these changes will be logged and the version will be updated. This ensures that you can compare the predictions across different versions of your model. Use this to iterate on prompts or to try the latest LLM and compare predictions across different settings - -**Examples:** -```python -class YourModel(Model): - attribute1: str - attribute2: int - - @weave.op() - def predict(self, input_data: str) -> dict: - # Model logic goes here - prediction = self.attribute1 + ' ' + input_data - return {'pred': prediction} -``` - -**Pydantic Fields:** - -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` + ---------- - - - -### method `get_infer_method` +### method `parse_uri` ```python -get_infer_method() → Callable +parse_uri(uri: 'str') → ObjectRef ``` --- - + -## class `Prompt` - -**Pydantic Fields:** - -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` - ---------- - - - -### method `format` +### method `uri` ```python -format(**kwargs: Any) → Any +uri() → str ``` --- - - -## class `StringPrompt` - - - -### method `__init__` - -```python -__init__(content: str) -``` - -**Pydantic Fields:** - -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `content`: `` - ---------- - - + -### method `format` +### method `with_attr` ```python -format(**kwargs: Any) → str +with_attr(attr: 'str') → Self ``` --- - + -### classmethod `from_obj` +### method `with_extra` ```python -from_obj(obj: WeaveObject) → Self +with_extra(extra: 'tuple[str | Future[str], ]') → Self ``` --- - + -## class `MessagesPrompt` - - - -### method `__init__` +### method `with_index` ```python -__init__(messages: list[dict]) +with_index(index: 'int') → Self ``` -**Pydantic Fields:** - -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `messages`: `list[dict]` - ---------- +--- - + -### method `format` +### method `with_item` ```python -format(**kwargs: Any) → list +with_item(item_digest: 'str | Future[str]') → Self ``` --- - + -### method `format_message` +### method `with_key` ```python -format_message(message: dict, **kwargs: Any) → dict +with_key(key: 'str') → Self ``` --- - + -### classmethod `from_obj` +## class `EasyPrompt` + + + +### method `__init__` ```python -from_obj(obj: WeaveObject) → Self +__init__( + content: str | dict | list | None = None, + role: str | None = None, + dedent: bool = False, + **kwargs: Any +) → None ``` ---- +**Pydantic Fields:** - +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `data`: `` +- `config`: `` +- `requirements`: `` -## class `Evaluation` -Sets up an evaluation which includes a set of scorers and a dataset. +--- -Calling evaluation.evaluate(model) will pass in rows from a dataset into a model matching the names of the columns of the dataset to the argument names in model.predict. +#### property as_str -Then it will call all of the scorers and save the results in weave. +Join all messages into a single string. -If you want to preprocess the rows from the dataset you can pass in a function to preprocess_model_input. +--- -**Examples:** -```python -# Collect your examples -examples = [ - {"question": "What is the capital of France?", "expected": "Paris"}, - {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"}, - {"question": "What is the square root of 64?", "expected": "8"}, -] +#### property is_bound -# Define any custom scoring function -@weave.op() -def match_score1(expected: str, model_output: dict) -> dict: - # Here is where you'd define the logic to score the model output - return {'match': expected == model_output['generated_text']} +--- -@weave.op() -def function_to_evaluate(question: str): - # here's where you would add your LLM call and return the output - return {'generated_text': 'Paris'} +#### property messages -# Score your examples using scoring functions -evaluation = Evaluation( - dataset=examples, scorers=[match_score1] -) +#### property placeholders -# Start tracking the evaluation -weave.init('intro-example') -# Run the evaluation -asyncio.run(evaluation.evaluate(function_to_evaluate)) -``` +--- -**Pydantic Fields:** +#### property system_message -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `dataset`: `` -- `scorers`: `typing.Optional[list[typing.Annotated[typing.Union[trace.op_protocol.Op, flow.scorer.Scorer], BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]]]` -- `preprocess_model_input`: `typing.Optional[typing.Callable[[dict], dict]]` -- `trials`: `` -- `metadata`: `typing.Optional[dict[str, typing.Any]]` -- `evaluation_name`: `typing.Union[str, typing.Callable[[trace.call.Call], str], NoneType]` +Join all messages into a system prompt message. ---------- +--- - +#### property system_prompt -### method `evaluate` +Join all messages into a system prompt object. -```python -evaluate(model: Union[Op, Model]) → dict -``` +--- + +#### property unbound_placeholders --- - + -### classmethod `from_obj` +### method `append` ```python -from_obj(obj: WeaveObject) → Self +append(item: Any, role: str | None = None, dedent: bool = False) → None ``` --- - + -### method `get_eval_results` +### method `as_dict` ```python -get_eval_results(model: Union[Op, Model]) → EvaluationResults +as_dict() → dict[str, Any] ``` --- - + -### method `get_evaluate_calls` +### method `as_pydantic_dict` ```python -get_evaluate_calls() → PaginatedIterator[CallSchema, WeaveObject] +as_pydantic_dict() → dict[str, Any] ``` -Retrieve all evaluation calls that used this Evaluation object. - -Note that this returns a CallsIter instead of a single call because it's possible to have multiple evaluation calls for a single evaluation (e.g. if you run the same evaluation multiple times). +--- -**Returns:** - - - `CallsIter`: An iterator over Call objects representing evaluation runs. + -**Raises:** - - - `ValueError`: If the evaluation has no ref (hasn't been saved/run yet). +### method `bind` -**Examples:** ```python -evaluation = Evaluation(dataset=examples, scorers=[scorer]) -await evaluation.evaluate(model) # Run evaluation first -calls = evaluation.get_evaluate_calls() -for call in calls: - print(f"Evaluation run: {call.id} at {call.started_at}") +bind(*args: Any, **kwargs: Any) → Prompt ``` --- - + -### method `get_score_calls` +### method `bind_rows` ```python -get_score_calls() → dict[str, list[Call]] +bind_rows(dataset: list[dict] | Any) → list['Prompt'] ``` -Retrieve scorer calls for each evaluation run, grouped by trace ID. +--- -**Returns:** - - - `dict[str, list[Call]]`: A dictionary mapping trace IDs to lists of scorer Call objects. Each trace ID represents one evaluation run, and the list contains all scorer calls executed during that run. + + +### method `config_table` -**Examples:** ```python -evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) -await evaluation.evaluate(model) -score_calls = evaluation.get_score_calls() -for trace_id, calls in score_calls.items(): - print(f"Trace {trace_id}: {len(calls)} scorer calls") - for call in calls: - scorer_name = call.summary.get("weave", {}).get("trace_name") - print(f" Scorer: {scorer_name}, Output: {call.output}") +config_table(title: str | None = None) → Table ``` --- - + -### method `get_scores` +### method `configure` ```python -get_scores() → dict[str, dict[str, list[Any]]] +configure(config: dict | None = None, **kwargs: Any) → Prompt ``` -Extract and organize scorer outputs from evaluation runs. - -**Returns:** - - - `dict[str, dict[str, list[Any]]]`: A nested dictionary structure where: - - First level keys are trace IDs (evaluation runs) - - Second level keys are scorer names - - Values are lists of scorer outputs for that run and scorer +--- -**Examples:** -```python -evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) -await evaluation.evaluate(model) -scores = evaluation.get_scores() -# Access scores by trace and scorer -for trace_id, trace_scores in scores.items(): - print(f"Evaluation run {trace_id}:") - for scorer_name, outputs in trace_scores.items(): - print(f" {scorer_name}: {outputs}") -``` + -Expected output: +### method `dump` -``` -{ - "trace_123": { - "accuracy_scorer": [{"accuracy": 0.85}], - "f1_scorer": [{"f1": 0.78}] - } -} +```python +dump(fp: ) → None ``` --- - + -### method `model_post_init` +### method `dump_file` ```python -model_post_init(_Evaluation__context: Any) → None +dump_file(filepath: str | Path) → None ``` --- - + -### method `predict_and_score` +### method `format` ```python -predict_and_score(model: Union[Op, Model], example: dict) → dict +format(**kwargs: Any) → Any ``` --- - + -### method `summarize` +### classmethod `from_obj` ```python -summarize(eval_table: EvaluationResults) → dict +from_obj(obj: WeaveObject) → Self ``` --- - + -## class `EvaluationLogger` -This class provides an imperative interface for logging evaluations. +### classmethod `load` -An evaluation is started automatically when the first prediction is logged using the `log_prediction` method, and finished when the `log_summary` method is called. +```python +load(fp: ) → Self +``` -Each time you log a prediction, you will get back a `ScoreLogger` object. You can use this object to log scores and metadata for that specific prediction. For more information, see the `ScoreLogger` class. +--- -Basic usage - log predictions with inputs and outputs directly: + + +### classmethod `load_file` ```python -ev = EvaluationLogger() +load_file(filepath: str | Path) → Self +``` -# Log predictions with known inputs/outputs -pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'}) -pred.log_score("correctness", 0.9) +--- -# Finish the evaluation -ev.log_summary({"avg_score": 0.9}) -``` + -Advanced usage - use context manager for dynamic outputs and nested operations: +### method `messages_table` ```python -ev = EvaluationLogger() +messages_table(title: str | None = None) → Table +``` -# Use context manager when you need to capture nested operations -with ev.log_prediction(inputs={'q': 'Hello'}) as pred: - # Any operations here (like LLM calls) automatically become - # children of the predict call - response = your_llm_call(...) - pred.output = response.content - pred.log_score("correctness", 0.9) +--- -# Finish the evaluation -ev.log_summary({"avg_score": 0.9}) -``` + -**Pydantic Fields:** +### method `print` -- `name`: `str | None` -- `model`: `flow.model.Model | dict | str` -- `dataset`: `dataset.dataset.Dataset | list[dict] | str` -- `eval_attributes`: `dict[str, typing.Any]` -- `scorers`: `list[str] | None` +```python +print() → str +``` --- -#### property attributes + ---------- +### method `publish` -#### property ui_url +```python +publish(name: str | None = None) → ObjectRef +``` --- - + -### method `fail` +### method `require` ```python -fail(exception: 'BaseException') → None +require(param_name: str, **kwargs: Any) → Prompt ``` -Convenience method to fail the evaluation with an exception. - --- - + -### method `finish` +### method `run` ```python -finish(exception: 'BaseException | None' = None) → None +run() → Any ``` -Clean up the evaluation resources explicitly without logging a summary. - -Ensures all prediction calls and the main evaluation call are finalized. This is automatically called if the logger is used as a context manager. - --- - + -### method `log_prediction` +### method `validate_requirement` ```python -log_prediction( - inputs: 'dict[str, Any]', - output: 'Any | _NotSetType' = -) → ScoreLogger | _LogPredictionContext +validate_requirement(key: str, value: Any) → list ``` -Log a prediction to the Evaluation. - -If output is provided, returns a ScoreLogger for direct use. If output is not provided, returns a PredictionContext for use as a context manager. - -**Args:** - +--- - - `inputs`: The input data for the prediction - - `output`: The output value. If not provided, use as context manager to set later. -**Returns:** - ScoreLogger if output provided, PredictionContext if not. + -Example (direct): - - `pred = ev.log_prediction({'q'`: '...'}, output="answer") pred.log_score("correctness", 0.9) pred.finish() +### method `validate_requirements` -Example (context manager): - - `with ev.log_prediction({'q'`: '...'}) as pred: response = model(...) pred.output = response pred.log_score("correctness", 0.9) +```python +validate_requirements(values: dict[str, Any]) → list +``` --- - + -### method `log_summary` +### method `values_table` ```python -log_summary(summary: 'dict | None' = None, auto_summarize: 'bool' = True) → None +values_table(title: str | None = None) → Table ``` -Log a summary dict to the Evaluation. +--- -This will calculate the summary, call the summarize op, and then finalize the evaluation, meaning no more predictions or scores can be logged. + ---- +## class `Prompt` - +**Pydantic Fields:** -### method `model_post_init` +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` + + + +### method `format` ```python -model_post_init(_EvaluationLogger__context: 'Any') → None +format(**kwargs: Any) → Any ``` -Initialize the pseudo evaluation with the dataset from the model. - --- - - -### method `set_view` + -```python -set_view( - name: 'str', - content: 'Content | str', - extension: 'str | None' = None, - mimetype: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None, - encoding: 'str' = 'utf-8' -) → None -``` +## class `SavedView` +A fluent-style class for working with SavedView objects. -Attach a view to the evaluation's main call summary under `weave.views`. + -Saves the provided content as an object in the project and writes its reference URI under `summary.weave.views.` for the evaluation's `evaluate` call. String inputs are wrapped as text content using `Content.from_text` with the provided extension or mimetype. +### method `__init__` -**Args:** - +```python +__init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None +``` - - `name`: The view name to display, used as the key under `summary.weave.views`. - - `content`: A `weave.Content` instance or string to serialize. - - `extension`: Optional file extension for string content inputs. - - `mimetype`: Optional MIME type for string content inputs. - - `metadata`: Optional metadata attached to newly created `Content`. - - `encoding`: Text encoding for string content inputs. -**Returns:** - None +--- -**Examples:** - ``` import weave``` - >>> ev = weave.EvaluationLogger() - >>> ev.set_view("report", "# Report", extension="md") +#### property entity --- - +#### property label -## class `Scorer` +--- -**Pydantic Fields:** +#### property project + +--- -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `column_map`: `typing.Optional[dict[str, str]]` +#### property view_type ---------- +--- - + -### classmethod `from_obj` +### method `add_column` ```python -from_obj(obj: WeaveObject) → Self +add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView ``` --- - + -### method `model_post_init` +### method `add_columns` ```python -model_post_init(_Scorer__context: Any) → None +add_columns(*columns: 'str') → SavedView ``` +Convenience method for adding multiple columns to the grid. + --- - + -### method `score` +### method `add_filter` ```python -score(output: Any, **kwargs: Any) → Any +add_filter( + field: 'str', + operator: 'str', + value: 'Any | None' = None +) → SavedView ``` --- - + -### method `summarize` +### method `add_sort` ```python -summarize(score_rows: list) → Optional[dict] +add_sort(field: 'str', direction: 'SortDirection') → SavedView ``` --- - - -## class `AnnotationSpec` + -**Pydantic Fields:** +### method `column_index` -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `field_schema`: `dict[str, typing.Any]` -- `unique_among_creators`: `` -- `op_scope`: `typing.Optional[list[str]]` +```python +column_index(path: 'int | str | ObjectPath') → int +``` ---------- +--- - + -### classmethod `preprocess_field_schema` +### method `filter_op` ```python -preprocess_field_schema(data: dict[str, Any]) → dict[str, Any] +filter_op(op_name: 'str | None') → SavedView ``` --- - + -### classmethod `validate_field_schema` +### method `get_calls` ```python -validate_field_schema(schema: dict[str, Any]) → dict[str, Any] +get_calls( + limit: 'int | None' = None, + offset: 'int | None' = None, + include_costs: 'bool' = False, + include_feedback: 'bool' = False, + all_columns: 'bool' = False +) → CallsIter ``` +Get calls matching this saved view's filters and settings. + --- - + -### method `value_is_valid` +### method `get_known_columns` ```python -value_is_valid(payload: Any) → bool +get_known_columns(num_calls_to_query: 'int | None' = None) → list[str] ``` -Validates a payload against this annotation spec's schema. +Get the set of columns that are known to exist. -**Args:** - +--- - - `payload`: The data to validate against the schema -**Returns:** - - - `bool`: True if validation succeeds, False otherwise + ---- +### method `get_table_columns` - +```python +get_table_columns() → list[TableColumn] +``` -## class `File` -A class representing a file with path, mimetype, and size information. +--- - + -### method `__init__` +### method `hide_column` ```python -__init__(path: 'str | Path', mimetype: 'str | None' = None) +hide_column(col_name: 'str') → SavedView ``` -Initialize a File object. - -**Args:** - - --- -#### property filename + -Get the filename of the file. +### method `insert_column` - - `path`: Path to the file (string or pathlib.Path) - - `mimetype`: Optional MIME type of the file - will be inferred from extension if not provided -**Returns:** - - - `str`: The name of the file without the directory path. +```python +insert_column( + idx: 'int', + path: 'str | ObjectPath', + label: 'str | None' = None +) → SavedView +``` --- - + -### method `open` +### classmethod `load` ```python -open() → bool +load(ref: 'str') → Self ``` -Open the file using the operating system's default application. +--- -This method uses the platform-specific mechanism to open the file with the default application associated with the file's type. + -**Returns:** - - - `bool`: True if the file was successfully opened, False otherwise. +### method `page_size` + +```python +page_size(page_size: 'int') → SavedView +``` --- - + -### method `save` +### method `pin_column_left` ```python -save(dest: 'str | Path') → None +pin_column_left(col_name: 'str') → SavedView ``` -Copy the file to the specified destination path. - -**Args:** - - --- - + -## class `Content` -A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata. +### method `pin_column_right` -This class must be instantiated using one of its classmethods: -- from_path() -- from_bytes() -- from_text() -- from_url() -- from_base64() -- from_data_url() +```python +pin_column_right(col_name: 'str') → SavedView +``` - +--- -### method `__init__` + + +### method `remove_column` ```python -__init__(*args: 'Any', **kwargs: 'Any') → None +remove_column(path: 'int | str | ObjectPath') → SavedView ``` -Direct initialization is disabled. Please use a classmethod like `Content.from_path()` to create an instance. +--- - - `dest`: Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. -**Pydantic Fields:** + -- `data`: `` -- `size`: `` -- `mimetype`: `` -- `digest`: `` -- `filename`: `` -- `content_type`: `typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']` -- `input_type`: `` -- `encoding`: `` -- `metadata`: `dict[str, typing.Any] | None` -- `extension`: `str | None` +### method `remove_columns` + +```python +remove_columns(*columns: 'str') → SavedView +``` + +Remove columns from the saved view. --- -#### property art + ---------- +### method `remove_filter` -#### property ref +```python +remove_filter(index_or_field: 'int | str') → SavedView +``` --- - + -### method `as_string` +### method `remove_filters` ```python -as_string() → str +remove_filters() → SavedView ``` -Display the data as a string. Bytes are decoded using the `encoding` attribute If base64, the data will be re-encoded to base64 bytes then decoded to an ASCII string - -**Returns:** - str. +Remove all filters from the saved view. --- - + -### classmethod `from_base64` +### method `rename` ```python -from_base64( - b64_data: 'str | bytes', - extension: 'str | None' = None, - mimetype: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None -) → Self +rename(label: 'str') → SavedView ``` -Initializes Content from a base64 encoded string or bytes. - --- - + -### classmethod `from_bytes` +### method `rename_column` ```python -from_bytes( - data: 'bytes', - extension: 'str | None' = None, - mimetype: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None, - encoding: 'str' = 'utf-8' -) → Self +rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView ``` -Initializes Content from raw bytes. - --- - + -### classmethod `from_data_url` +### method `save` ```python -from_data_url(url: 'str', metadata: 'dict[str, Any] | None' = None) → Self +save() → SavedView ``` -Initializes Content from a data URL. +Publish the saved view to the server. --- - + -### classmethod `from_path` +### method `set_columns` ```python -from_path( - path: 'str | Path', - encoding: 'str' = 'utf-8', - mimetype: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None -) → Self +set_columns(*columns: 'str') → SavedView ``` -Initializes Content from a local file path. +Set the columns to be displayed in the grid. --- - + -### classmethod `from_text` +### method `show_column` ```python -from_text( - text: 'str', - extension: 'str | None' = None, - mimetype: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None, - encoding: 'str' = 'utf-8' -) → Self +show_column(col_name: 'str') → SavedView ``` -Initializes Content from a string of text. - --- - + -### classmethod `from_url` +### method `sort_by` ```python -from_url( - url: 'str', - headers: 'dict[str, Any] | None' = None, - timeout: 'int | None' = 30, - metadata: 'dict[str, Any] | None' = None -) → Self +sort_by(field: 'str', direction: 'SortDirection') → SavedView ``` -Initializes Content by fetching bytes from an HTTP(S) URL. - -Downloads the content, infers mimetype/extension from headers, URL path, and data, and constructs a Content object from the resulting bytes. - --- - + -### classmethod `model_validate` +### method `to_grid` ```python -model_validate( - obj: 'Any', - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) → Self +to_grid(limit: 'int | None' = None) → Grid ``` -Override model_validate to handle Content reconstruction from dict. - --- - + -### classmethod `model_validate_json` +### method `to_rich_table_str` ```python -model_validate_json( - json_data: 'str | bytes | bytearray', - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) → Self +to_rich_table_str() → str ``` -Override model_validate_json to handle Content reconstruction from JSON. - --- - + -### method `open` +### method `ui_url` ```python -open() → bool +ui_url() → str | None ``` -Open the file using the operating system's default application. - -This method uses the platform-specific mechanism to open the file with the default application associated with the file's type. +URL to show this saved view in the UI. -**Returns:** - - - `bool`: True if the file was successfully opened, False otherwise. +Note this is the "result" page with traces etc, not the URL for the view object. --- - + -### method `save` +### method `unpin_column` ```python -save(dest: 'str | Path') → None +unpin_column(col_name: 'str') → SavedView ``` -Copy the file to the specified destination path. Updates the filename and the path of the content to reflect the last saved copy. +--- -**Args:** - + ---- +## class `Scorer` - +**Pydantic Fields:** -### method `serialize_data` +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `column_map`: `dict[str, str] | None` + + + +### classmethod `from_obj` ```python -serialize_data(data: 'bytes') → str +from_obj(obj: WeaveObject) → Self ``` -When dumping model in json mode - --- - + -### method `to_data_url` +### method `model_post_init` ```python -to_data_url(use_base64: 'bool' = True) → str +model_post_init(_Scorer__context: Any) → None ``` -Constructs a data URL from the content. +--- - - `dest`: Destination path where the file will be copied to (string or pathlib.Path) The destination path can be a file or a directory. If dest has no file extension (e.g. .txt), destination will be considered a directory. -**Args:** - + - - `use_base64`: If True, the data will be base64 encoded. Otherwise, it will be percent-encoded. Defaults to True. -**Returns:** - A data URL string. +### method `score` + +```python +score(output: Any, **kwargs: Any) → Any +``` --- - + -## class `Markdown` -A Markdown renderable. +### method `summarize` -**Args:** - - - `markup` (str): A string containing markdown. - - `code_theme` (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes. - - `justify` (JustifyMethod, optional): Justify value for paragraphs. Defaults to None. - - `style` (Union[str, Style], optional): Optional style to apply to markdown. - - `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``. +```python +summarize(score_rows: list) → dict | None +``` + +--- + + + +## class `StringPrompt` - + ### method `__init__` ```python -__init__( - markup: 'str', - code_theme: 'str' = 'monokai', - justify: 'JustifyMethod | None' = None, - style: 'str | Style' = 'none', - hyperlinks: 'bool' = True, - inline_code_lexer: 'str | None' = None, - inline_code_theme: 'str | None' = None -) → None +__init__(content: str) ``` ---- +**Pydantic Fields:** - +- `name`: `str | None` +- `description`: `str | None` +- `ref`: `trace.refs.ObjectRef | None` +- `content`: `` -## class `Monitor` -Sets up a monitor to score incoming calls automatically. + + +### method `format` - - `inline_code_lexer`: (str, optional): Lexer to use if inline code highlighting is enabled. Defaults to None. - - `inline_code_theme`: (Optional[str], optional): Pygments theme for inline code highlighting, or None for no highlighting. Defaults to None. -**Examples:** ```python -import weave -from weave.scorers import ValidJSONScorer +format(**kwargs: Any) → str +``` -json_scorer = ValidJSONScorer() +--- -my_monitor = weave.Monitor( - name="my-monitor", - description="This is a test monitor", - sampling_rate=0.5, - op_names=["my_op"], - query={ - "$expr": { - "$gt": [ - { - "$getField": "started_at" - }, - { - "$literal": 1742540400 - } - ] - } - } - }, - scorers=[json_scorer], -) + -my_monitor.activate() +### classmethod `from_obj` + +```python +from_obj(obj: WeaveObject) → Self ``` -**Pydantic Fields:** +--- -- `name`: `typing.Optional[str]` -- `description`: `typing.Optional[str]` -- `ref`: `typing.Optional[trace.refs.ObjectRef]` -- `sampling_rate`: `` -- `scorers`: `list[flow.scorer.Scorer]` -- `op_names`: `list[str]` -- `query`: `typing.Optional[trace_server.interface.query.Query]` -- `active`: `` + ---------- +## class `Table` - + -### method `activate` +### method `__init__` ```python -activate() → ObjectRef +__init__(rows: 'list[dict]') → None ``` -Activates the monitor. +--- -**Returns:** - The ref to the monitor. +#### property rows --- - + -### method `deactivate` +### method `append` ```python -deactivate() → ObjectRef +append(row: 'dict') → None ``` -Deactivates the monitor. - -**Returns:** - The ref to the monitor. +Add a row to the table. --- - + -### classmethod `from_obj` +### method `pop` ```python -from_obj(obj: WeaveObject) → Self +pop(index: 'int') → None ``` +Remove a row at the given index from the table. + --- - + -## class `SavedView` -A fluent-style class for working with SavedView objects. +## class `ContextAwareThread` +A Thread that runs functions with the context of the caller. - +This is a drop-in replacement for threading.Thread that ensures calls behave as expected inside the thread. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this thread "just works" as the user probably expects. -### method `__init__` +You can achieve the same effect without this class by instead writing: ```python -__init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None -``` +def run_with_context(func, *args, **kwargs): + context = copy_context() + def wrapper(): + context.run(func, *args, **kwargs) + return wrapper ---- +thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs)) +thread.start() +``` -#### property entity + ---- +### method `__init__` -#### property label +```python +__init__(*args: 'Any', **kwargs: 'Any') → None +``` --- -#### property project +#### property daemon ---- +A boolean value indicating whether this thread is a daemon thread. -#### property view_type +This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False. + +The entire Python program exits when only daemon threads are left. --- - +#### property ident -### method `add_column` +Thread identifier of this thread or None if it has not been started. -```python -add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView -``` +This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. --- - +#### property name -### method `add_columns` - -```python -add_columns(*columns: 'str') → SavedView -``` +A string used for identification purposes only. -Convenience method for adding multiple columns to the grid. +It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. --- - +#### property native_id -### method `add_filter` +Native integral thread ID of this thread, or None if it has not been started. -```python -add_filter( - field: 'str', - operator: 'str', - value: 'Any | None' = None -) → SavedView -``` +This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel. --- - + -### method `add_sort` +### method `run` ```python -add_sort(field: 'str', direction: 'SortDirection') → SavedView +run() → None ``` --- - + -### method `column_index` +## class `ThreadContext` +Context object providing access to current thread and turn information. + + + +### method `__init__` ```python -column_index(path: 'int | str | ObjectPath') → int +__init__(thread_id: 'str | None') ``` +Initialize ThreadContext with the specified thread_id. + +**Args:** + + --- - +#### property thread_id -### method `filter_op` +Get the thread_id for this context. -```python -filter_op(op_name: 'str | None') → SavedView -``` + - `thread_id`: The thread identifier for this context, or None if disabled. +**Returns:** + The thread identifier, or None if thread tracking is disabled. --- - - -### method `get_calls` +#### property turn_id -```python -get_calls( - limit: 'int | None' = None, - offset: 'int | None' = None, - include_costs: 'bool' = False, - include_feedback: 'bool' = False, - all_columns: 'bool' = False -) → CallsIter -``` +Get the current turn_id from the active context. -Get calls matching this saved view's filters and settings. +**Returns:** + The current turn_id if set, None otherwise. --- - + -### method `get_known_columns` +## class `ContextAwareThreadPoolExecutor` +A ThreadPoolExecutor that runs functions with the context of the caller. + +This is a drop-in replacement for concurrent.futures.ThreadPoolExecutor that ensures weave calls behave as expected inside the executor. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this executor "just works" as the user probably expects. + +You can achieve the same effect without this class by instead writing: ```python -get_known_columns(num_calls_to_query: 'int | None' = None) → list[str] -``` +with concurrent.futures.ThreadPoolExecutor() as executor: + contexts = [copy_context() for _ in range(len(vals))] -Get the set of columns that are known to exist. + def _wrapped_fn(*args): + return contexts.pop().run(fn, *args) ---- + executor.map(_wrapped_fn, vals) +``` - + -### method `get_table_columns` +### method `__init__` ```python -get_table_columns() → list[TableColumn] +__init__(*args: 'Any', **kwargs: 'Any') → None ``` --- - + -### method `hide_column` +### method `map` ```python -hide_column(col_name: 'str') → SavedView +map( + fn: 'Callable', + *iterables: 'Iterable[Any]', + timeout: 'float | None' = None, + chunksize: 'int' = 1 +) → Iterator ``` --- - + -### method `insert_column` +### method `submit` ```python -insert_column( - idx: 'int', - path: 'str | ObjectPath', - label: 'str | None' = None -) → SavedView +submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any ``` --- - + -### classmethod `load` +### function `as_op` ```python -load(ref: 'str') → SavedView +as_op(fn: 'Callable[P, R]') → Op[P, R] ``` ---- +Given a @weave.op decorated function, return its Op. - +@weave.op decorated functions are instances of Op already, so this function should be a no-op at runtime. But you can use it to satisfy type checkers if you need to access OpDef attributes in a typesafe way. -### method `page_size` +**Args:** + -```python -page_size(page_size: 'int') → SavedView -``` + - `fn`: A weave.op decorated function. +**Returns:** + The Op of the function. --- - + -### method `pin_column_left` +### function `attributes` ```python -pin_column_left(col_name: 'str') → SavedView +attributes(attributes: 'dict[str, Any]') → Iterator ``` ---- - - - -### method `pin_column_right` +Context manager for setting attributes on a call. +**Example:** ```python -pin_column_right(col_name: 'str') → SavedView +with weave.attributes({'env': 'production'}): + print(my_function.call("World")) ``` --- - + -### method `remove_column` +### function `finish` ```python -remove_column(path: 'int | str | ObjectPath') → SavedView +finish() → None ``` +Stops logging to weave. + +Following finish, calls of weave.op decorated functions will no longer be logged. You will need to run weave.init() again to resume logging. + --- - + -### method `remove_columns` +### function `get` ```python -remove_columns(*columns: 'str') → SavedView +get(uri: 'str | ObjectRef') → Any ``` -Remove columns from the saved view. +A convenience function for getting an object from a URI. ---- +Many objects logged by Weave are automatically registered with the Weave server. This function allows you to retrieve those objects by their URI. - +**Args:** + -### method `remove_filter` + - `uri`: A fully-qualified weave ref URI. +**Returns:** + The object. +**Example:** ```python -remove_filter(index_or_field: 'int | str') → SavedView +weave.init("weave_get_example") +dataset = weave.Dataset(rows=[{"a": 1, "b": 2}]) +ref = weave.publish(dataset) + +dataset2 = weave.get(ref) # same as dataset! ``` --- - + -### method `remove_filters` +### function `get_client` ```python -remove_filters() → SavedView +get_client() → WeaveClient | None ``` -Remove all filters from the saved view. - --- - + -### method `rename` +### function `get_current_call` ```python -rename(label: 'str') → SavedView +get_current_call() → Call | None ``` ---- +Get the Call object for the currently executing Op, within that Op. - +**Returns:** + The Call object for the currently executing Op, or None if tracking has not been initialized or this method is invoked outside an Op. -### method `rename_column` +**Note:** -```python -rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView -``` +> The returned Call's ``attributes`` dictionary becomes immutable once the call starts. Use :func:`weave.attributes` to set call metadata before invoking an Op. The ``summary`` field may be updated while the Op executes and will be merged with computed summary information when the call finishes. --- - + -### method `save` +### function `init` ```python -save() → SavedView +init( + project_name: 'str', + settings: 'UserSettings | dict[str, Any] | None' = None, + autopatch_settings: 'AutopatchSettings | None' = None, + global_postprocess_inputs: 'PostprocessInputsFunc | None' = None, + global_postprocess_output: 'PostprocessOutputFunc | None' = None, + global_attributes: 'dict[str, Any] | None' = None +) → WeaveClient ``` -Publish the saved view to the server. +Initialize weave tracking, logging to a wandb project. ---- +Logging is initialized globally, so you do not need to keep a reference to the return value of init. - +Following init, calls of weave.op decorated functions will be logged to the specified project. -### method `set_columns` +**Args:** + -```python -set_columns(*columns: 'str') → SavedView -``` +NOTE: Global postprocessing settings are applied to all ops after each op's own postprocessing. The order is always: 1. Op-specific postprocessing 2. Global postprocessing -Set the columns to be displayed in the grid. + - `project_name`: The name of the Weights & Biases team and project to log to. If you don't specify a team, your default entity is used. To find or update your default entity, refer to [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team) in the W&B Models documentation. + - `settings`: Configuration for the Weave client generally. + - `autopatch_settings`: (Deprecated) Configuration for autopatch integrations. Use explicit patching instead. + - `global_postprocess_inputs`: A function that will be applied to all inputs of all ops. + - `global_postprocess_output`: A function that will be applied to all outputs of all ops. + - `global_attributes`: A dictionary of attributes that will be applied to all traces. +**Returns:** + A Weave client. --- - + -### method `show_column` +### function `log_call` ```python -show_column(col_name: 'str') → SavedView +log_call( + op: 'str', + inputs: 'dict[str, Any]', + output: 'Any', + parent: 'Call | None' = None, + attributes: 'dict[str, Any] | None' = None, + display_name: 'str | Callable[[Call], str] | None' = None, + use_stack: 'bool' = True, + exception: 'BaseException | None' = None +) → Call ``` ---- +Log a call directly to Weave without using the decorator pattern. - +This function provides an imperative API for logging operations to Weave, useful when you want to log calls after they've already been executed or when the decorator pattern isn't suitable for your use case. -### method `sort_by` +**Args:** + + - `op` (str): The operation name to log. This will be used as the op_name for the call. Anonymous operations (strings not referring to published ops) are supported. + - `inputs` (dict[str, Any]): A dictionary of input parameters for the operation. + - `output` (Any): The output/result of the operation. + - `parent` (Call | None): Optional parent call to nest this call under. If not provided, the call will be a root-level call (or nested under the current call context if one exists). Defaults to None. + - `attributes` (dict[str, Any] | None): Optional metadata to attach to the call. These are frozen once the call is created. Defaults to None. + - `display_name` (str | Callable[[Call], str] | None): Optional display name for the call in the UI. Can be a string or a callable that takes the call and returns a string. Defaults to None. + - `use_stack` (bool): Whether to push the call onto the runtime stack. When True, the call will be available in the call context and can be accessed via weave.require_current_call(). When False, the call is logged but not added to the call stack. Defaults to True. + - `exception` (BaseException | None): Optional exception to log if the operation failed. Defaults to None. -```python -sort_by(field: 'str', direction: 'SortDirection') → SavedView -``` +**Returns:** + + - `Call`: The created and finished Call object with full trace information. ---- +**Examples:** + Basic usage: - +```python +import weave + >>> weave.init('my-project') + >>> call = weave.log_call( + ... op="my_function", + ... inputs={"x": 5, "y": 10}, + ... output=15 + ... ) + + Logging with attributes and display name: + >>> call = weave.log_call( + ... op="process_data", + ... inputs={"data": [1, 2, 3]}, + ... output={"mean": 2.0}, + ... attributes={"version": "1.0", "env": "prod"}, + ... display_name="Data Processing" + ... ) + + Logging a failed operation: + >>> try: + ... result = risky_operation() + ... except Exception as e: + ... call = weave.log_call( + ... op="risky_operation", + ... inputs={}, + ... output=None, + ... exception=e + ... ) + + Nesting calls: + >>> parent_call = weave.log_call("parent", {"input": 1}, 2) + >>> child_call = weave.log_call( + ... "child", + ... {"input": 2}, + ... 4, + ... parent=parent_call + ... ) + + Logging without adding to call stack: + >>> call = weave.log_call( + ... op="background_task", + ... inputs={"task_id": 123}, + ... output="completed", + ... use_stack=False # Don't push to call stack + ... ) + +--- + + -### method `to_grid` +### function `op` ```python -to_grid(limit: 'int | None' = None) → Grid +op( + func: 'Callable[P, R] | None' = None, + name: 'str | None' = None, + call_display_name: 'str | CallDisplayNameFunc | None' = None, + postprocess_inputs: 'PostprocessInputsFunc | None' = None, + postprocess_output: 'PostprocessOutputFunc | None' = None, + tracing_sample_rate: 'float' = 1.0, + enable_code_capture: 'bool' = True, + accumulator: 'Callable[[Any | None, Any], Any] | None' = None, + kind: 'OpKind | None' = None, + color: 'OpColor | None' = None +) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R] ``` +A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior. + --- - + -### method `to_rich_table_str` +### function `publish` ```python -to_rich_table_str() → str +publish(obj: 'Any', name: 'str | None' = None) → ObjectRef ``` ---- - - - -### method `ui_url` +Save and version a Python object. -```python -ui_url() → str | None -``` +Weave creates a new version of the object if the object's name already exists and its content hash does not match the latest version of that object. -URL to show this saved view in the UI. +**Args:** + -Note this is the "result" page with traces etc, not the URL for the view object. + - `obj`: The object to save and version. + - `name`: The name to save the object under. +**Returns:** + A Weave Ref to the saved object. --- - + -### method `unpin_column` +### function `ref` ```python -unpin_column(col_name: 'str') → SavedView +ref(location: 'str') → ObjectRef ``` ---- +Creates a Ref to an existing Weave object. This does not directly retrieve the object but allows you to pass it to other Weave API functions. - +**Args:** + -## class `Audio` -A class representing audio data in a supported format (wav or mp3). + - `location`: A Weave Ref URI, or if `weave.init()` has been called, `name:version` or `name`. If no version is provided, `latest` is used. +**Returns:** + A Weave Ref to the object. -This class handles audio data storage and provides methods for loading from different sources and exporting to files. +--- -**Attributes:** - - - `format`: The audio format (currently supports 'wav' or 'mp3') - - `data`: The raw audio data as bytes + -**Args:** - +### function `require_current_call` - - `data`: The audio data (bytes or base64 encoded string) - - `format`: The audio format ('wav' or 'mp3') - - `validate_base64`: Whether to attempt base64 decoding of the input data -**Raises:** - - - `ValueError`: If audio data is empty or format is not supported +```python +require_current_call() → Call +``` - +Get the Call object for the currently executing Op, within that Op. -### method `__init__` +This allows you to access attributes of the Call such as its id or feedback while it is running. ```python -__init__( - data: 'bytes', - format: 'SUPPORTED_FORMATS_TYPE', - validate_base64: 'bool' = True -) → None +@weave.op +def hello(name: str) -> None: + print(f"Hello {name}!") + current_call = weave.require_current_call() + print(current_call.id) ``` ---- +It is also possible to access a Call after the Op has returned. + +If you have the Call's id, perhaps from the UI, you can use the `get_call` method on the `WeaveClient` returned from `weave.init` to retrieve the Call object. - +```python +client = weave.init("") +mycall = client.get_call("") +``` -### method `export` +Alternately, after defining your Op you can use its `call` method. For example: ```python -export(path: 'str | bytes | Path | PathLike') → None +@weave.op +def add(a: int, b: int) -> int: + return a + b + +result, call = add.call(1, 2) +print(call.id) ``` -Export audio data to a file. +**Returns:** + The Call object for the currently executing Op -**Args:** +**Raises:** + - `NoCurrentCallError`: If tracking has not been initialized or this method is invoked outside an Op. --- - + -### classmethod `from_data` +### function `set_view` ```python -from_data(data: 'str | bytes', format: 'str') → Audio +set_view( + name: 'str', + content: 'Content | str', + extension: 'str | None' = None, + mimetype: 'str | None' = None, + metadata: 'dict[str, Any] | None' = None, + encoding: 'str' = 'utf-8' +) → None ``` -Create an Audio object from raw data and specified format. +Attach a custom view to the current call summary at `_weave.views.`. - - `path`: Path where the audio file should be written **Args:** - - `data`: Audio data as bytes or base64 encoded string - - `format`: Audio format ('wav' or 'mp3') + - `name`: The view name (key under `summary._weave.views`). + - `content`: A `weave.Content` instance or raw string. Strings are wrapped via `Content.from_text` using the supplied extension or mimetype. + - `extension`: Optional file extension to use when `content` is a string. + - `mimetype`: Optional MIME type to use when `content` is a string. + - `metadata`: Optional metadata to attach when creating `Content` from text. + - `encoding`: Text encoding to apply when creating `Content` from text. **Returns:** - - - `Audio`: A new Audio instance + None -**Raises:** - - - `ValueError`: If format is not supported +**Examples:** + ``` import weave``` + >>> weave.init("proj") + >>> @weave.op + ... def foo(): + ... weave.set_view("readme", "# Hello", extension="md") + ... return 1 + >>> foo() --- - + -### classmethod `from_path` +### function `thread` ```python -from_path(path: 'str | bytes | Path | PathLike') → Audio +thread( + thread_id: 'str | None | object' = +) → Iterator[ThreadContext] ``` -Create an Audio object from a file path. +Context manager for setting thread_id on calls within the context. + +**Examples:** +```python +# Auto-generate thread_id +with weave.thread() as t: + print(f"Thread ID: {t.thread_id}") + result = my_function("input") # This call will have the auto-generated thread_id + print(f"Current turn: {t.turn_id}") + +# Explicit thread_id +with weave.thread("custom_thread") as t: + result = my_function("input") # This call will have thread_id="custom_thread" + +# Disable threading +with weave.thread(None) as t: + result = my_function("input") # This call will have thread_id=None +``` **Args:** - - `path`: Path to an audio file (must have .wav or .mp3 extension) -**Returns:** + - `thread_id`: The thread identifier to associate with calls in this context. If not provided, a UUID v7 will be auto-generated. If None, thread tracking will be disabled. +**Yields:** - - `Audio`: A new Audio instance loaded from the file + - `ThreadContext`: An object providing access to thread_id and current turn_id. + +--- + + + +### function `wandb_init_hook` + +```python +wandb_init_hook() → None +``` -**Raises:** - - - `ValueError`: If file doesn't exist or has unsupported extension diff --git a/weave/reference/python-sdk/trace/feedback.mdx b/weave/reference/python-sdk/trace/feedback.mdx index 2c63b36097..5318ee0c87 100644 --- a/weave/reference/python-sdk/trace/feedback.mdx +++ b/weave/reference/python-sdk/trace/feedback.mdx @@ -3,84 +3,84 @@ title: "feedback" description: "Python SDK reference for weave.trace.feedback" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + -## class `Feedbacks` -A collection of Feedback objects with utilities. +## class `FeedbackQuery` +Lazy-loading object for fetching feedback from the server. - + ### method `__init__` ```python __init__( - show_refs: 'bool', - feedbacks: 'Iterable[Feedback] | None' = None -) → None + entity: 'str', + project: 'str', + query: 'Query', + offset: 'int | None' = None, + limit: 'int | None' = None, + show_refs: 'bool' = False +) ``` --- - + -### method `refs` +### method `execute` ```python -refs() → Refs +execute() → Feedbacks ``` -Return the unique refs associated with these feedbacks. - --- - + -## class `FeedbackQuery` -Lazy-loading object for fetching feedback from the server. - - - -### method `__init__` +### method `refresh` ```python -__init__( - entity: 'str', - project: 'str', - query: 'Query', - offset: 'int | None' = None, - limit: 'int | None' = None, - show_refs: 'bool' = False -) +refresh() → Feedbacks ``` --- - + -### method `execute` +### method `refs` ```python -execute() → Feedbacks +refs() → Refs ``` --- - + -### method `refresh` +## class `Feedbacks` +A collection of Feedback objects with utilities. + + + +### method `__init__` ```python -refresh() → Feedbacks +__init__( + show_refs: 'bool', + feedbacks: 'Iterable[Feedback] | None' = None +) → None ``` --- - + ### method `refs` @@ -88,14 +88,16 @@ refresh() → Feedbacks refs() → Refs ``` +Return the unique refs associated with these feedbacks. + --- - + ## class `RefFeedbackQuery` Object for interacting with feedback associated with a particular ref. - + ### method `__init__` @@ -105,7 +107,7 @@ __init__(ref: 'str') → None --- - + ### method `add` @@ -125,7 +127,7 @@ feedback_type: A string identifying the type of feedback. The "wandb." prefix is --- - + ### method `add_note` @@ -135,7 +137,7 @@ add_note(note: 'str', creator: 'str | None' = None) → str --- - + ### method `add_reaction` @@ -145,7 +147,7 @@ add_reaction(emoji: 'str', creator: 'str | None' = None) → str --- - + ### method `execute` @@ -155,7 +157,7 @@ execute() → Feedbacks --- - + ### method `purge` @@ -165,7 +167,7 @@ purge(feedback_id: 'str') → None --- - + ### method `refresh` @@ -175,7 +177,7 @@ refresh() → Feedbacks --- - + ### method `refs` diff --git a/weave/reference/python-sdk/trace/op.mdx b/weave/reference/python-sdk/trace/op.mdx index 8c454c5cd1..79f9c35f02 100644 --- a/weave/reference/python-sdk/trace/op.mdx +++ b/weave/reference/python-sdk/trace/op.mdx @@ -3,12 +3,75 @@ title: "op" description: "Python SDK reference for weave.trace.op" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + + +## class `DisplayNameFuncError` + +--- + + + +## class `OpCallError` + +--- + + + +## class `OpKwargs` +TypedDict for op() keyword arguments. + +--- + + + +## class `Sentinel` +Sentinel(package: 'str', path: 'str', name: 'str') + + + +### method `__init__` + +```python +__init__(package: 'str', path: 'str', name: 'str') → None +``` + +--- + + + +## class `WeaveKwargs` + +--- + + + +### function `as_op` + +```python +as_op(fn: 'Callable[P, R]') → Op[P, R] +``` + +Given a @weave.op decorated function, return its Op. + +@weave.op decorated functions are instances of Op already, so this function should be a no-op at runtime. But you can use it to satisfy type checkers if you need to access OpDef attributes in a typesafe way. + +**Args:** + + + - `fn`: A weave.op decorated function. +**Returns:** + The Op of the function. + +--- + + ### function `call` @@ -39,7 +102,7 @@ result, call = add.call(1, 2) --- - + ### function `calls` @@ -60,3 +123,145 @@ calls = add.calls() for call in calls: print(call) ``` + +--- + + + +### function `get_captured_code` + +```python +get_captured_code(op: 'Op') → str +``` + +Get the captured code of the op. + +This only works when you get an op back from a ref. The pattern is: + +ref = weave.publish(func) op = ref.get() captured_code = op.get_captured_code() + +--- + + + +### function `is_op` + +```python +is_op(obj: 'Any') → TypeIs[Op] +``` + +Check if an object is an Op. + +--- + + + +### function `is_placeholder_call` + +```python +is_placeholder_call(call: 'Call') → TypeIs[NoOpCall] +``` + +--- + + + +### function `is_tracing_setting_disabled` + +```python +is_tracing_setting_disabled() → bool +``` + +--- + + + +### function `maybe_bind_method` + +```python +maybe_bind_method(func: 'Callable', self: 'Any' = None) → Callable | MethodType +``` + +Bind a function to any object (even if it's not a class). + +If self is None, return the function as is. + +--- + + + +### function `maybe_unbind_method` + +```python +maybe_unbind_method(oplike: 'Op | MethodType | partial') → Op +``` + +Unbind an Op-like method or partial to a plain Op function. + +For: +- methods, remove set `self` param +- partials, remove any preset params + +--- + + + +### function `op` + +```python +op( + func: 'Callable[P, R] | None' = None, + name: 'str | None' = None, + call_display_name: 'str | CallDisplayNameFunc | None' = None, + postprocess_inputs: 'PostprocessInputsFunc | None' = None, + postprocess_output: 'PostprocessOutputFunc | None' = None, + tracing_sample_rate: 'float' = 1.0, + enable_code_capture: 'bool' = True, + accumulator: 'Callable[[Any | None, Any], Any] | None' = None, + kind: 'OpKind | None' = None, + color: 'OpColor | None' = None +) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R] +``` + +A decorator to weave op-ify a function or method. Works for both sync and async. Automatically detects iterator functions and applies appropriate behavior. + +--- + + + +### function `placeholder_call` + +```python +placeholder_call() → Call +``` + +--- + + + +### function `setup_dunder_weave_dict` + +```python +setup_dunder_weave_dict(op: 'Op', d: 'WeaveKwargs | None' = None) → WeaveKwargs +``` + +Sets up a __weave dict used to pass WeaveKwargs to ops. + +**Args:** + + + - `d`: Optional existing WeaveKwargs dict to update. + - `op`: Op to extract kind and color from. +**Returns:** + WeaveKwargs dict with attributes, display_name, and optionally kind/color set. + +--- + + + +### function `should_skip_tracing_for_op` + +```python +should_skip_tracing_for_op(op: 'Op') → bool +``` + diff --git a/weave/reference/python-sdk/trace/util.mdx b/weave/reference/python-sdk/trace/util.mdx index e849391cda..d8075b2f0f 100644 --- a/weave/reference/python-sdk/trace/util.mdx +++ b/weave/reference/python-sdk/trace/util.mdx @@ -3,12 +3,88 @@ title: "util" description: "Python SDK reference for weave.trace.util" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + + +## class `ContextAwareThread` +A Thread that runs functions with the context of the caller. + +This is a drop-in replacement for threading.Thread that ensures calls behave as expected inside the thread. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this thread "just works" as the user probably expects. + +You can achieve the same effect without this class by instead writing: + +```python +def run_with_context(func, *args, **kwargs): + context = copy_context() + def wrapper(): + context.run(func, *args, **kwargs) + return wrapper + +thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs)) +thread.start() +``` + + + +### method `__init__` + +```python +__init__(*args: 'Any', **kwargs: 'Any') → None +``` + +--- + +#### property daemon + +A boolean value indicating whether this thread is a daemon thread. + +This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False. + +The entire Python program exits when only daemon threads are left. + +--- + +#### property ident + +Thread identifier of this thread or None if it has not been started. + +This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. + +--- + +#### property name + +A string used for identification purposes only. + +It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. + +--- + +#### property native_id + +Native integral thread ID of this thread, or None if it has not been started. + +This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel. + +--- + + + +### method `run` + +```python +run() → None +``` + +--- + + ## class `ContextAwareThreadPoolExecutor` A ThreadPoolExecutor that runs functions with the context of the caller. @@ -27,7 +103,7 @@ with concurrent.futures.ThreadPoolExecutor() as executor: executor.map(_wrapped_fn, vals) ``` - + ### method `__init__` @@ -37,7 +113,7 @@ __init__(*args: 'Any', **kwargs: 'Any') → None --- - + ### method `map` @@ -52,7 +128,7 @@ map( --- - + ### method `submit` @@ -62,7 +138,7 @@ submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any --- - + ## class `ContextAwareThread` A Thread that runs functions with the context of the caller. @@ -82,7 +158,7 @@ thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs)) thread.start() ``` - + ### method `__init__` @@ -126,7 +202,7 @@ This is a non-negative integer. See the get_native_id() function. This represent --- - + ### method `run` @@ -134,3 +210,112 @@ This is a non-negative integer. See the get_native_id() function. This represent run() → None ``` +--- + + + +## class `ContextAwareThreadPoolExecutor` +A ThreadPoolExecutor that runs functions with the context of the caller. + +This is a drop-in replacement for concurrent.futures.ThreadPoolExecutor that ensures weave calls behave as expected inside the executor. Weave requires certain contextvars to be set (see call_context.py), but new threads do not automatically copy context from the parent, which can cause the call context to be lost -- not good! This class automates contextvar copying so using this executor "just works" as the user probably expects. + +You can achieve the same effect without this class by instead writing: + +```python +with concurrent.futures.ThreadPoolExecutor() as executor: + contexts = [copy_context() for _ in range(len(vals))] + + def _wrapped_fn(*args): + return contexts.pop().run(fn, *args) + + executor.map(_wrapped_fn, vals) +``` + + + +### method `__init__` + +```python +__init__(*args: 'Any', **kwargs: 'Any') → None +``` + +--- + + + +### method `map` + +```python +map( + fn: 'Callable', + *iterables: 'Iterable[Any]', + timeout: 'float | None' = None, + chunksize: 'int' = 1 +) → Iterator +``` + +--- + + + +### method `submit` + +```python +submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any +``` + +--- + + + +### function `deprecated` + +```python +deprecated(new_name: 'str') → Callable[[Callable[, Any]], Callable[, Any]] +``` + +Decorator to mark a function as deprecated and redirect users to `new_name`. + +--- + + + +### function `is_colab` + +```python +is_colab() +``` + +--- + + + +### function `is_notebook` + +```python +is_notebook() → bool +``` + +--- + + + +### function `log_once` + +```python +log_once(log_method: 'Callable[[str], None]', message: 'str') → None +``` + +Logs a message once, suppressing subsequent messages of the same type. This is useful for notifying the user about errors without spamming the logs. + +This is mostly useful for cases where the same error message might occur many times. For example, if an op fails to save, it is likely going to happen every time that op is called. Or, if we have an error in our patched iterator, then it likely happens every time we iterate over the result. This allows use to inform the user about the error without clogging up their logs. + +**Args:** + + + - `log_method`: The method to use to log the message. This should accept a string argument. + - `message`: The message to log. +**Example:** +```python +log_once(logger.error, "Failed to save op") +``` diff --git a/weave/reference/python-sdk/trace/weave_client.mdx b/weave/reference/python-sdk/trace/weave_client.mdx index 81b55842fd..07f1eaa7a9 100644 --- a/weave/reference/python-sdk/trace/weave_client.mdx +++ b/weave/reference/python-sdk/trace/weave_client.mdx @@ -3,16 +3,32 @@ title: "weave_client" description: "Python SDK reference for weave.trace.weave_client" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + + +## class `FlushStatus` +Status information about the current flush operation. + +--- + + + +## class `PendingJobCounts` +Counts of pending jobs for each type. + +--- + + ## class `WeaveClient` - + ### method `__init__` @@ -39,7 +55,7 @@ This property can be used to check the progress of background tasks without bloc --- - + ### method `add_cost` @@ -78,30 +94,30 @@ client.add_cost(llm_id="my_expensive_custom_model", prompt_token_cost=500, compl --- - + -### method `call` +### method `clear_wandb_run_context` ```python -call(call_id: 'str', include_costs: 'bool' = False) → WeaveObject +clear_wandb_run_context() → None ``` ---- - - +Clear wandb run context override. -### method `calls` +After calling this, calls will fall back to using the global wandb.run (if available) for run_id and step information. +**Examples:** ```python -calls( - filter: 'CallsFilter | None' = None, - include_costs: 'bool' = False -) → CallsIter +client = weave.init("my-project") +client.set_wandb_run_context(run_id="my-run-id", step=5) +# ... make some calls ... +client.clear_wandb_run_context() +# Now calls will use global wandb.run again ``` --- - + ### method `create_call` @@ -133,7 +149,7 @@ Create, log, and push a call onto the runtime stack. --- - + ### method `delete_all_object_versions` @@ -152,7 +168,7 @@ Delete all versions of an object. --- - + ### method `delete_all_op_versions` @@ -171,7 +187,7 @@ Delete all versions of an op. --- - + ### method `delete_call` @@ -181,7 +197,7 @@ delete_call(call: 'Call') → None --- - + ### method `delete_calls` @@ -198,7 +214,7 @@ Deleting a call will also delete all of its children. --- - + ### method `delete_object_version` @@ -208,7 +224,7 @@ delete_object_version(object: 'ObjectRef') → None --- - + ### method `delete_object_versions` @@ -229,7 +245,7 @@ Delete specific versions of an object. --- - + ### method `delete_op_version` @@ -239,7 +255,7 @@ delete_op_version(op: 'OpRef') → None --- - + ### method `fail_call` @@ -251,22 +267,7 @@ Fail a call with an exception. This is a convenience method for finish_call. --- - - -### method `feedback` - -```python -feedback( - query: 'Query | str | None' = None, - reaction: 'str | None' = None, - offset: 'int' = 0, - limit: 'int' = 100 -) → FeedbackQuery -``` - ---- - - + ### method `finish` @@ -286,7 +287,7 @@ This method blocks until all currently enqueued jobs are processed, displaying a --- - + ### method `finish_call` @@ -305,7 +306,7 @@ Any values present in ``call.summary`` are deep-merged with computed summary sta --- - + ### method `flush` @@ -317,7 +318,7 @@ Flushes background asynchronous tasks, safe to call multiple times. --- - + ### method `get` @@ -327,7 +328,7 @@ get(ref: 'ObjectRef', objectify: 'bool' = True) → Any --- - + ### method `get_call` @@ -356,7 +357,7 @@ Get a single call by its ID. --- - + ### method `get_calls` @@ -369,6 +370,8 @@ get_calls( query: 'QueryLike | None' = None, include_costs: 'bool' = False, include_feedback: 'bool' = False, + include_storage_size: 'bool' = False, + include_total_storage_size: 'bool' = False, columns: 'list[str] | None' = None, expand_columns: 'list[str] | None' = None, return_expanded_column_values: 'bool' = True, @@ -392,6 +395,8 @@ Performance Tip: Specify `columns` and use `filter` or `query` to reduce result - ``query``: A mongo-like expression for advanced filtering. Not all Mongo operators are supported. - ``include_costs``: If True, includes token/cost info in `summary.weave`. - ``include_feedback``: If True, includes feedback in `summary.weave.feedback`. + - ``include_storage_size``: If True, includes the storage size for a call. + - ``include_total_storage_size``: If True, includes the total storage size for a trace. - ``columns``: List of fields to return per call. Reducing this can significantly improve performance. (Some fields like `id`, `trace_id`, `op_name`, and `started_at` are always included.) - ``scored_by``: Filter by one or more scorers (name or ref URI). Multiple scorers are AND-ed. - ``page_size``: Number of calls fetched per page. Tune this for performance in large queries. @@ -413,7 +418,7 @@ for call in calls: --- - + ### method `get_evaluation` @@ -449,7 +454,7 @@ print(evaluation.name) --- - + ### method `get_evaluations` @@ -474,7 +479,7 @@ for eval in evaluations: --- - + ### method `get_feedback` @@ -528,7 +533,7 @@ client.get_feedback(query=query) --- - + ### method `purge_costs` @@ -549,7 +554,7 @@ client.purge_costs(ids) --- - + ### method `query_costs` @@ -588,7 +593,7 @@ client.query_costs(llm_ids=["gpt-4o-mini-2024-07-18"], limit=10) --- - + ### method `save` @@ -609,188 +614,91 @@ Do not call directly, use weave.publish() instead. --- - - -## class `Call` -A Call represents a single operation executed as part of a trace. - -``attributes`` are frozen once the call is created. Use :func:`weave.attributes` or ``create_call(..., attributes=...)`` to populate metadata beforehand. The ``summary`` dictionary may be modified while the call is running; its contents are deep-merged with computed summary values when :meth:`WeaveClient.finish_call` is invoked. + - - -### method `__init__` +### method `set_wandb_run_context` ```python -__init__( - _op_name: 'str | Future[str]', - trace_id: 'str', - project_id: 'str', - parent_id: 'str | None', - inputs: 'dict[str, Any]', - id: 'str | None' = None, - output: 'Any' = None, - exception: 'str | None' = None, - summary: 'dict[str, Any] | None' = <factory>, - _display_name: 'str | Callable[[Call], str] | None' = None, - attributes: 'dict[str, Any] | None' = None, - started_at: 'datetime | None' = None, - ended_at: 'datetime | None' = None, - deleted_at: 'datetime | None' = None, - thread_id: 'str | None' = None, - turn_id: 'str | None' = None, - wb_run_id: 'str | None' = None, - wb_run_step: 'int | None' = None, - wb_run_step_end: 'int | None' = None, - _children: 'list[Call]' = <factory>, - _feedback: 'RefFeedbackQuery | None' = None -) → None +set_wandb_run_context(run_id: 'str', step: 'int | None' = None) → None ``` ---- - -#### property display_name - ---- - -#### property feedback - ---- - -#### property func_name +Override wandb run_id and step for calls created by this client. -The decorated function's name that produced this call. - -This is different from `op_name` which is usually the ref of the op. - ---- - -#### property op_name - ---- - -#### property ref - ---- - -#### property ui_url - ---- - - - -### method `apply_scorer` - -```python -apply_scorer( - scorer: 'Op | Scorer', - additional_scorer_kwargs: 'dict[str, Any] | None' = None -) → ApplyScorerResult -``` - -`apply_scorer` is a method that applies a Scorer to a Call. This is useful for guarding application logic with a scorer and/or monitoring the quality of critical ops. Scorers are automatically logged to Weave as Feedback and can be used in queries & analysis. +This allows you to associate Weave calls with a specific WandB run that is not bound to the global wandb.run symbol. **Args:** - - `scorer`: The Scorer to apply. - - `additional_scorer_kwargs`: Additional kwargs to pass to the scorer. This is useful for passing in additional context that is not part of the call inputs.useful for passing in additional context that is not part of the call inputs. -**Returns:** - The result of the scorer application in the form of an `ApplyScorerResult`. - + - `run_id`: The run ID (not including entity/project prefix). The client will automatically add the entity/project prefix. + - `step`: The step number to use for calls. If None, step will not be set. +**Examples:** ```python -class ApplyScorerSuccess: - - - ` result`: Any - - - ` score_call`: Call -``` - -Example usage: +client = weave.init("my-project") +client.set_wandb_run_context(run_id="my-run-id", step=5) +# Now all calls will be associated with entity/project/my-run-id at step 5 -```python -my_scorer = ... # construct a scorer -prediction, prediction_call = my_op.call(input_data) -result, score_call = prediction.apply_scorer(my_scorer) +# Or without a step +client.set_wandb_run_context(run_id="my-run-id") +# Calls will be associated with entity/project/my-run-id with no step ``` --- - + -### method `children` +### function `get_obj_name` ```python -children(page_size: 'int' = 1000) → CallsIter +get_obj_name(val: 'Any') → str ``` -Get the children of the call. - -**Args:** - - - - `page_size`: Tune performance by changing the number of calls fetched at a time. -**Returns:** - An iterator of calls. - --- - + -### method `delete` +### function `get_parallelism_settings` ```python -delete() → bool +get_parallelism_settings() → tuple[int | None, int | None] ``` -Delete the call. - --- - + -### method `remove_display_name` +### function `map_to_refs` ```python -remove_display_name() → None +map_to_refs(obj: 'Any') → Any ``` --- - - -### method `set_display_name` - -```python -set_display_name(name: 'str | None') → None -``` - -Set the display name for the call. + -**Args:** - +### function `print_call_link` - - `name`: The display name to set for the call. -**Example:** ```python -result, call = my_function.call("World") -call.set_display_name("My Custom Display Name") +print_call_link(call: 'Call') → None ``` --- - + -### method `to_dict` +### function `redact_sensitive_keys` ```python -to_dict() → CallDict +redact_sensitive_keys(obj: 'Any') → Any ``` --- -### function `PaginatedIterator` + + +### function `sanitize_object_name` ```python -PaginatedIterator(*args, **kwargs) +sanitize_object_name(name: 'str') → str ``` diff --git a/weave/reference/python-sdk/trace_server/trace_server_interface.mdx b/weave/reference/python-sdk/trace_server/trace_server_interface.mdx index 5e86827716..1c124e8a22 100644 --- a/weave/reference/python-sdk/trace_server/trace_server_interface.mdx +++ b/weave/reference/python-sdk/trace_server/trace_server_interface.mdx @@ -3,12 +3,14 @@ title: "trace_server_interface" description: "Python SDK reference for weave.trace_server.trace_server_interface" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + ## class `ActionsExecuteBatchReq` @@ -17,30 +19,264 @@ description: "Python SDK reference for weave.trace_server.trace_server_interface - `project_id`: `` - `action_ref`: `` - `call_ids`: `list[str]` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `wb_user_id`: `str | None` --- - + ## class `ActionsExecuteBatchRes` ------- +--- + + + +## class `AnnotationQueueAddCallsReq` +Request to add calls to an annotation queue in batch. + +Extends AnnotationQueueAddCallsBody by adding queue_id for internal API usage. + +**Pydantic Fields:** + +- `project_id`: `` +- `call_ids`: `list[str]` +- `display_fields`: `list[str]` +- `queue_id`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `AnnotationQueueAddCallsRes` +Response from adding calls to a queue. + +**Pydantic Fields:** + +- `added_count`: `` +- `duplicates`: `` + +--- + + + +## class `AnnotationQueueCreateReq` +Request to create a new annotation queue. + +**Pydantic Fields:** + +- `project_id`: `` +- `name`: `` +- `description`: `` +- `scorer_refs`: `list[str]` +- `wb_user_id`: `str | None` + +--- + + + +## class `AnnotationQueueCreateRes` +Response from creating an annotation queue. + +**Pydantic Fields:** + +- `id`: `` + +--- + + + +## class `AnnotationQueueItemSchema` +Schema for annotation queue item responses. + +**Pydantic Fields:** + +- `id`: `` +- `project_id`: `` +- `queue_id`: `` +- `call_id`: `` +- `call_started_at`: `` +- `call_ended_at`: `datetime.datetime | None` +- `call_op_name`: `` +- `call_trace_id`: `` +- `display_fields`: `list[str]` +- `added_by`: `str | None` +- `annotation_state`: `typing.Literal['unstarted', 'in_progress', 'completed', 'skipped']` +- `annotator_user_id`: `str | None` +- `created_at`: `` +- `created_by`: `` +- `updated_at`: `` +- `deleted_at`: `datetime.datetime | None` +- `position_in_queue`: `int | None` + +--- + + + +## class `AnnotationQueueItemsQueryReq` +Request to query items in an annotation queue. + +Extends AnnotationQueueItemsQueryBody by adding queue_id for internal API usage. + +**Pydantic Fields:** + +- `project_id`: `` +- `filter`: `weave.trace_server.common_interface.AnnotationQueueItemsFilter | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `include_position`: `` +- `queue_id`: `` + +--- + + + +## class `AnnotationQueueItemsQueryRes` +Response from querying annotation queue items. + +**Pydantic Fields:** + +- `items`: `list[AnnotationQueueItemSchema]` + +--- + + + +## class `AnnotationQueueReadReq` +Request to read a specific annotation queue. + +**Pydantic Fields:** + +- `project_id`: `` +- `queue_id`: `` + +--- + + + +## class `AnnotationQueueReadRes` +Response from reading an annotation queue. + +**Pydantic Fields:** + +- `queue`: `` + +--- + + + +## class `AnnotationQueueSchema` +Schema for annotation queue responses. + +**Pydantic Fields:** + +- `id`: `` +- `project_id`: `` +- `name`: `` +- `description`: `` +- `scorer_refs`: `list[str]` +- `created_at`: `` +- `created_by`: `` +- `updated_at`: `` +- `deleted_at`: `datetime.datetime | None` + +--- + + + +## class `AnnotationQueueStatsSchema` +Statistics for a single annotation queue. + +**Pydantic Fields:** + +- `queue_id`: `` +- `total_items`: `` +- `completed_items`: `` + +--- + + + +## class `AnnotationQueuesQueryReq` +Request to query annotation queues for a project. + +**Pydantic Fields:** + +- `project_id`: `` +- `name`: `str | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `limit`: `int | None` +- `offset`: `int | None` + +--- + + + +## class `AnnotationQueuesQueryRes` +Response from querying annotation queues. + +**Pydantic Fields:** + +- `queues`: `list[AnnotationQueueSchema]` + +--- + + + +## class `AnnotationQueuesStatsReq` +Request to get stats for multiple annotation queues. + +**Pydantic Fields:** + +- `project_id`: `` +- `queue_ids`: `list[str]` + +--- + + + +## class `AnnotationQueuesStatsRes` +Response with stats for multiple annotation queues. + +**Pydantic Fields:** + +- `stats`: `list[AnnotationQueueStatsSchema]` + +--- + + + +## class `AnnotatorQueueItemsProgressUpdateReq` +Request to update the annotation state of a queue item for the current annotator. + +Valid state transitions: +- (absence) -> 'in_progress': Mark item as in progress (only when no record exists) +- (absence) -> 'completed' or 'skipped': Directly complete/skip item +- 'in_progress' or 'unstarted' -> 'completed' or 'skipped': Complete/skip started item + +**Pydantic Fields:** + +- `project_id`: `` +- `queue_id`: `` +- `item_id`: `` +- `annotation_state`: `` +- `wb_user_id`: `str | None` --- - + -## class `BaseModelStrict` -Base model with strict validation that forbids extra fields. +## class `AnnotatorQueueItemsProgressUpdateRes` +Response from updating annotation state. + +**Pydantic Fields:** ------- +- `item`: `` --- - + ## class `CallBatchEndMode` @@ -49,11 +285,9 @@ Base model with strict validation that forbids extra fields. - `mode`: `` - `req`: `` ------- - --- - + ## class `CallBatchStartMode` @@ -62,35 +296,29 @@ Base model with strict validation that forbids extra fields. - `mode`: `` - `req`: `` ------- - --- - + ## class `CallCreateBatchReq` **Pydantic Fields:** -- `batch`: `list[typing.Union[CallBatchStartMode, CallBatchEndMode]]` - ------- +- `batch`: `list[CallBatchStartMode | CallBatchEndMode]` --- - + ## class `CallCreateBatchRes` **Pydantic Fields:** -- `res`: `list[typing.Union[CallStartRes, CallEndRes]]` - ------- +- `res`: `list[CallStartRes | CallEndRes]` --- - + ## class `CallEndReq` @@ -98,19 +326,15 @@ Base model with strict validation that forbids extra fields. - `end`: `` ------- - --- - + ## class `CallEndRes` ------- - --- - + ## class `CallReadReq` @@ -118,27 +342,23 @@ Base model with strict validation that forbids extra fields. - `project_id`: `` - `id`: `` -- `include_costs`: `typing.Optional[bool]` -- `include_storage_size`: `typing.Optional[bool]` -- `include_total_storage_size`: `typing.Optional[bool]` - ------- +- `include_costs`: `bool | None` +- `include_storage_size`: `bool | None` +- `include_total_storage_size`: `bool | None` --- - + ## class `CallReadRes` **Pydantic Fields:** -- `call`: `typing.Optional[CallSchema]` - ------- +- `call`: `CallSchema | None` --- - + ## class `CallSchema` @@ -147,29 +367,27 @@ Base model with strict validation that forbids extra fields. - `id`: `` - `project_id`: `` - `op_name`: `` -- `display_name`: `typing.Optional[str]` +- `display_name`: `str | None` - `trace_id`: `` -- `parent_id`: `typing.Optional[str]` -- `thread_id`: `typing.Optional[str]` -- `turn_id`: `typing.Optional[str]` +- `parent_id`: `str | None` +- `thread_id`: `str | None` +- `turn_id`: `str | None` - `started_at`: `` - `attributes`: `dict[str, typing.Any]` - `inputs`: `dict[str, typing.Any]` -- `ended_at`: `typing.Optional[datetime.datetime]` -- `exception`: `typing.Optional[str]` -- `output`: `typing.Optional[typing.Any]` -- `summary`: `typing.Optional[SummaryMap]` -- `wb_user_id`: `typing.Optional[str]` -- `wb_run_id`: `typing.Optional[str]` -- `wb_run_step`: `typing.Optional[int]` -- `wb_run_step_end`: `typing.Optional[int]` -- `deleted_at`: `typing.Optional[datetime.datetime]` -- `storage_size_bytes`: `typing.Optional[int]` -- `total_storage_size_bytes`: `typing.Optional[int]` - ---------- - - +- `ended_at`: `datetime.datetime | None` +- `exception`: `str | None` +- `output`: `typing.Any | None` +- `summary`: `SummaryMap | None` +- `wb_user_id`: `str | None` +- `wb_run_id`: `str | None` +- `wb_run_step`: `int | None` +- `wb_run_step_end`: `int | None` +- `deleted_at`: `datetime.datetime | None` +- `storage_size_bytes`: `int | None` +- `total_storage_size_bytes`: `int | None` + + ### method `serialize_typed_dicts` @@ -179,7 +397,7 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] --- - + ## class `CallStartReq` @@ -187,11 +405,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `start`: `` ------- - --- - + ## class `CallStartRes` @@ -200,11 +416,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `id`: `` - `trace_id`: `` ------- - --- - + ## class `CallUpdateReq` @@ -212,22 +426,18 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `call_id`: `` -- `display_name`: `typing.Optional[str]` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `display_name`: `str | None` +- `wb_user_id`: `str | None` --- - + ## class `CallUpdateRes` ------- - --- - + ## class `CallsDeleteReq` @@ -235,67 +445,63 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `call_ids`: `list[str]` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `wb_user_id`: `str | None` --- - + ## class `CallsDeleteRes` ------- +**Pydantic Fields:** + +- `num_deleted`: `` --- - + ## class `CallsFilter` **Pydantic Fields:** -- `op_names`: `typing.Optional[list[str]]` -- `input_refs`: `typing.Optional[list[str]]` -- `output_refs`: `typing.Optional[list[str]]` -- `parent_ids`: `typing.Optional[list[str]]` -- `trace_ids`: `typing.Optional[list[str]]` -- `call_ids`: `typing.Optional[list[str]]` -- `thread_ids`: `typing.Optional[list[str]]` -- `turn_ids`: `typing.Optional[list[str]]` -- `trace_roots_only`: `typing.Optional[bool]` -- `wb_user_ids`: `typing.Optional[list[str]]` -- `wb_run_ids`: `typing.Optional[list[str]]` - ------- +- `op_names`: `list[str] | None` +- `input_refs`: `list[str] | None` +- `output_refs`: `list[str] | None` +- `parent_ids`: `list[str] | None` +- `trace_ids`: `list[str] | None` +- `call_ids`: `list[str] | None` +- `thread_ids`: `list[str] | None` +- `turn_ids`: `list[str] | None` +- `trace_roots_only`: `bool | None` +- `wb_user_ids`: `list[str] | None` +- `wb_run_ids`: `list[str] | None` --- - + ## class `CallsQueryReq` **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[CallsFilter]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` -- `sort_by`: `typing.Optional[list[SortBy]]` -- `query`: `typing.Optional[weave.trace_server.interface.query.Query]` -- `include_costs`: `typing.Optional[bool]` -- `include_feedback`: `typing.Optional[bool]` -- `include_storage_size`: `typing.Optional[bool]` -- `include_total_storage_size`: `typing.Optional[bool]` -- `columns`: `typing.Optional[list[str]]` -- `expand_columns`: `typing.Optional[list[str]]` -- `return_expanded_column_values`: `typing.Optional[bool]` - ------- +- `filter`: `CallsFilter | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `query`: `weave.trace_server.interface.query.Query | None` +- `include_costs`: `bool | None` +- `include_feedback`: `bool | None` +- `include_storage_size`: `bool | None` +- `include_total_storage_size`: `bool | None` +- `columns`: `list[str] | None` +- `expand_columns`: `list[str] | None` +- `return_expanded_column_values`: `bool | None` --- - + ## class `CallsQueryRes` @@ -303,41 +509,35 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `calls`: `list[CallSchema]` ------- - --- - + ## class `CallsQueryStatsReq` **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[CallsFilter]` -- `query`: `typing.Optional[weave.trace_server.interface.query.Query]` -- `limit`: `typing.Optional[int]` -- `include_total_storage_size`: `typing.Optional[bool]` -- `expand_columns`: `typing.Optional[list[str]]` - ------- +- `filter`: `CallsFilter | None` +- `query`: `weave.trace_server.interface.query.Query | None` +- `limit`: `int | None` +- `include_total_storage_size`: `bool | None` +- `expand_columns`: `list[str] | None` --- - + ## class `CallsQueryStatsRes` **Pydantic Fields:** - `count`: `` -- `total_storage_size_bytes`: `typing.Optional[int]` - ------- +- `total_storage_size_bytes`: `int | None` --- - + ## class `CompletionsCreateReq` @@ -345,14 +545,12 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `inputs`: `` -- `wb_user_id`: `typing.Optional[str]` -- `track_llm_call`: `typing.Optional[bool]` - ------- +- `wb_user_id`: `str | None` +- `track_llm_call`: `bool | None` --- - + ## class `CompletionsCreateRequestInputs` @@ -360,49 +558,47 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `model`: `` - `messages`: `` -- `timeout`: `typing.Union[float, str, NoneType]` -- `temperature`: `typing.Optional[float]` -- `top_p`: `typing.Optional[float]` -- `n`: `typing.Optional[int]` -- `stop`: `typing.Union[str, list, NoneType]` -- `max_completion_tokens`: `typing.Optional[int]` -- `max_tokens`: `typing.Optional[int]` -- `modalities`: `typing.Optional[list]` -- `presence_penalty`: `typing.Optional[float]` -- `frequency_penalty`: `typing.Optional[float]` -- `stream`: `typing.Optional[bool]` -- `logit_bias`: `typing.Optional[dict]` -- `user`: `typing.Optional[str]` -- `response_format`: `typing.Union[dict, type[pydantic.main.BaseModel], NoneType]` -- `seed`: `typing.Optional[int]` -- `tools`: `typing.Optional[list]` -- `tool_choice`: `typing.Union[str, dict, NoneType]` -- `logprobs`: `typing.Optional[bool]` -- `top_logprobs`: `typing.Optional[int]` -- `parallel_tool_calls`: `typing.Optional[bool]` -- `extra_headers`: `typing.Optional[dict]` -- `functions`: `typing.Optional[list]` -- `function_call`: `typing.Optional[str]` -- `api_version`: `typing.Optional[str]` - ------- - ---- - - +- `timeout`: `float | str | None` +- `temperature`: `float | None` +- `top_p`: `float | None` +- `n`: `int | None` +- `stop`: `str | list | None` +- `max_completion_tokens`: `int | None` +- `max_tokens`: `int | None` +- `modalities`: `list | None` +- `presence_penalty`: `float | None` +- `frequency_penalty`: `float | None` +- `stream`: `bool | None` +- `logit_bias`: `dict | None` +- `user`: `str | None` +- `response_format`: `dict | type[pydantic.main.BaseModel] | None` +- `seed`: `int | None` +- `tools`: `list | None` +- `tool_choice`: `str | dict | None` +- `logprobs`: `bool | None` +- `top_logprobs`: `int | None` +- `parallel_tool_calls`: `bool | None` +- `extra_headers`: `dict | None` +- `functions`: `list | None` +- `function_call`: `str | None` +- `api_version`: `str | None` +- `prompt`: `str | None` +- `template_vars`: `dict[str, typing.Any] | None` + +--- + + ## class `CompletionsCreateRes` **Pydantic Fields:** - `response`: `dict[str, typing.Any]` -- `weave_call_id`: `typing.Optional[str]` - ------- +- `weave_call_id`: `str | None` --- - + ## class `CostCreateInput` @@ -410,16 +606,14 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `prompt_token_cost`: `` - `completion_token_cost`: `` -- `prompt_token_cost_unit`: `typing.Optional[str]` -- `completion_token_cost_unit`: `typing.Optional[str]` -- `effective_date`: `typing.Optional[datetime.datetime]` -- `provider_id`: `typing.Optional[str]` - ------- +- `prompt_token_cost_unit`: `str | None` +- `completion_token_cost_unit`: `str | None` +- `effective_date`: `datetime.datetime | None` +- `provider_id`: `str | None` --- - + ## class `CostCreateReq` @@ -427,13 +621,11 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `costs`: `dict[str, CostCreateInput]` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `wb_user_id`: `str | None` --- - + ## class `CostCreateRes` @@ -441,11 +633,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `ids`: `list[tuple[str, str]]` ------- - --- - + ## class `CostPurgeReq` @@ -454,55 +644,47 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `query`: `` ------- - --- - + ## class `CostPurgeRes` ------- - --- - + ## class `CostQueryOutput` **Pydantic Fields:** -- `id`: `typing.Optional[str]` -- `llm_id`: `typing.Optional[str]` -- `prompt_token_cost`: `typing.Optional[float]` -- `completion_token_cost`: `typing.Optional[float]` -- `prompt_token_cost_unit`: `typing.Optional[str]` -- `completion_token_cost_unit`: `typing.Optional[str]` -- `effective_date`: `typing.Optional[datetime.datetime]` -- `provider_id`: `typing.Optional[str]` - ------- +- `id`: `str | None` +- `llm_id`: `str | None` +- `prompt_token_cost`: `float | None` +- `completion_token_cost`: `float | None` +- `prompt_token_cost_unit`: `str | None` +- `completion_token_cost_unit`: `str | None` +- `effective_date`: `datetime.datetime | None` +- `provider_id`: `str | None` --- - + ## class `CostQueryReq` **Pydantic Fields:** - `project_id`: `` -- `fields`: `typing.Optional[list[str]]` -- `query`: `typing.Optional[weave.trace_server.interface.query.Query]` -- `sort_by`: `typing.Optional[list[SortBy]]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` - ------- +- `fields`: `list[str] | None` +- `query`: `weave.trace_server.interface.query.Query | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `limit`: `int | None` +- `offset`: `int | None` --- - + ## class `CostQueryRes` @@ -510,195 +692,534 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `results`: `list[CostQueryOutput]` ------- - --- - + -## class `EndedCallSchemaForInsert` +## class `DatasetCreateBody` **Pydantic Fields:** -- `project_id`: `` -- `id`: `` -- `ended_at`: `` -- `exception`: `typing.Optional[str]` -- `output`: `typing.Optional[typing.Any]` -- `summary`: `` -- `wb_run_step_end`: `typing.Optional[int]` +- `name`: `str | None` +- `description`: `str | None` +- `rows`: `list[dict[str, typing.Any]]` ---------- +--- - + -### method `serialize_typed_dicts` +## class `DatasetCreateReq` -```python -serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] -``` +**Pydantic Fields:** + +- `name`: `str | None` +- `description`: `str | None` +- `rows`: `list[dict[str, typing.Any]]` +- `project_id`: `` +- `wb_user_id`: `str | None` --- - + -## class `EnsureProjectExistsRes` +## class `DatasetCreateRes` **Pydantic Fields:** -- `project_name`: `` - ------- +- `digest`: `` +- `object_id`: `` +- `version_index`: `` --- - + -## class `EvaluateModelReq` +## class `DatasetDeleteReq` **Pydantic Fields:** - `project_id`: `` -- `evaluation_ref`: `` -- `model_ref`: `` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `object_id`: `` +- `digests`: `list[str] | None` +- `wb_user_id`: `str | None` --- - + -## class `EvaluateModelRes` +## class `DatasetDeleteRes` **Pydantic Fields:** -- `call_id`: `` - ------- +- `num_deleted`: `` --- - + -## class `EvaluationStatusComplete` +## class `DatasetListReq` **Pydantic Fields:** -- `code`: `typing.Literal['complete']` -- `output`: `dict[str, typing.Any]` - ------- +- `project_id`: `` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` --- - + -## class `EvaluationStatusFailed` +## class `DatasetReadReq` **Pydantic Fields:** -- `code`: `typing.Literal['failed']` -- `error`: `typing.Optional[str]` - ------- +- `project_id`: `` +- `object_id`: `` +- `digest`: `` +- `wb_user_id`: `str | None` --- - + -## class `EvaluationStatusNotFound` +## class `DatasetReadRes` **Pydantic Fields:** -- `code`: `typing.Literal['not_found']` - ------- +- `object_id`: `` +- `digest`: `` +- `version_index`: `` +- `created_at`: `` +- `name`: `` +- `description`: `str | None` +- `rows`: `` --- - + -## class `EvaluationStatusReq` +## class `EndedCallSchemaForInsert` **Pydantic Fields:** - `project_id`: `` -- `call_id`: `` +- `id`: `` +- `ended_at`: `` +- `exception`: `str | None` +- `output`: `typing.Any | None` +- `summary`: `` +- `wb_run_step_end`: `int | None` + + + +### method `serialize_typed_dicts` ------- +```python +serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] +``` --- - + -## class `EvaluationStatusRes` +## class `EnsureProjectExistsRes` **Pydantic Fields:** -- `status`: `typing.Union[EvaluationStatusNotFound, EvaluationStatusRunning, EvaluationStatusFailed, EvaluationStatusComplete]` - ------- +- `project_name`: `` --- - + -## class `EvaluationStatusRunning` +## class `EvaluateModelReq` **Pydantic Fields:** -- `code`: `typing.Literal['running']` -- `completed_rows`: `` -- `total_rows`: `` - ------- +- `project_id`: `` +- `evaluation_ref`: `` +- `model_ref`: `` +- `wb_user_id`: `str | None` --- - + -## class `ExportTracePartialSuccess` +## class `EvaluateModelRes` **Pydantic Fields:** -- `rejected_spans`: `` -- `error_message`: `` - ------- +- `call_id`: `` --- - + -## class `ExtraKeysTypedDict` +## class `EvaluationCreateBody` + +**Pydantic Fields:** + +- `name`: `` +- `description`: `str | None` +- `dataset`: `` +- `scorers`: `list[str] | None` +- `trials`: `` +- `evaluation_name`: `str | None` +- `eval_attributes`: `dict[str, typing.Any] | None` --- - + -## class `Feedback` +## class `EvaluationCreateReq` **Pydantic Fields:** -- `id`: `` +- `name`: `` +- `description`: `str | None` +- `dataset`: `` +- `scorers`: `list[str] | None` +- `trials`: `` +- `evaluation_name`: `str | None` +- `eval_attributes`: `dict[str, typing.Any] | None` - `project_id`: `` -- `weave_ref`: `` -- `creator`: `typing.Optional[str]` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationCreateRes` + +**Pydantic Fields:** + +- `digest`: `` +- `object_id`: `` +- `version_index`: `` +- `evaluation_ref`: `` + +--- + + + +## class `EvaluationDeleteReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digests`: `list[str] | None` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationDeleteRes` + +**Pydantic Fields:** + +- `num_deleted`: `` + +--- + + + +## class `EvaluationListReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationReadReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digest`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationReadRes` + +**Pydantic Fields:** + +- `object_id`: `` +- `digest`: `` +- `version_index`: `` +- `created_at`: `` +- `name`: `` +- `description`: `str | None` +- `dataset`: `` +- `scorers`: `list[str]` +- `trials`: `` +- `evaluation_name`: `str | None` +- `evaluate_op`: `str | None` +- `predict_and_score_op`: `str | None` +- `summarize_op`: `str | None` + +--- + + + +## class `EvaluationRunCreateBody` + +**Pydantic Fields:** + +- `evaluation`: `` +- `model`: `` + +--- + + + +## class `EvaluationRunCreateReq` + +**Pydantic Fields:** + +- `evaluation`: `` +- `model`: `` +- `project_id`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationRunCreateRes` + +**Pydantic Fields:** + +- `evaluation_run_id`: `` + +--- + + + +## class `EvaluationRunDeleteReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `evaluation_run_ids`: `list[str]` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationRunDeleteRes` + +**Pydantic Fields:** + +- `num_deleted`: `` + +--- + + + +## class `EvaluationRunFilter` + +**Pydantic Fields:** + +- `evaluations`: `list[str] | None` +- `models`: `list[str] | None` +- `evaluation_run_ids`: `list[str] | None` + +--- + + + +## class `EvaluationRunFinishBody` +Request body for finishing an evaluation run via REST API. + +This model excludes project_id and evaluation_run_id since they come from the URL path in RESTful endpoints. + +**Pydantic Fields:** + +- `summary`: `dict[str, typing.Any] | None` + +--- + + + +## class `EvaluationRunFinishReq` + +**Pydantic Fields:** + +- `summary`: `dict[str, typing.Any] | None` +- `project_id`: `` +- `evaluation_run_id`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `EvaluationRunFinishRes` + +**Pydantic Fields:** + +- `success`: `` + +--- + + + +## class `EvaluationRunListReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `filter`: `EvaluationRunFilter | None` +- `limit`: `int | None` +- `offset`: `int | None` + +--- + + + +## class `EvaluationRunReadReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `evaluation_run_id`: `` + +--- + + + +## class `EvaluationRunReadRes` + +**Pydantic Fields:** + +- `evaluation_run_id`: `` +- `evaluation`: `` +- `model`: `` +- `status`: `str | None` +- `started_at`: `datetime.datetime | None` +- `finished_at`: `datetime.datetime | None` +- `summary`: `dict[str, typing.Any] | None` + +--- + + + +## class `EvaluationStatusComplete` + +**Pydantic Fields:** + +- `code`: `typing.Literal['complete']` +- `output`: `dict[str, typing.Any]` + +--- + + + +## class `EvaluationStatusFailed` + +**Pydantic Fields:** + +- `code`: `typing.Literal['failed']` +- `error`: `str | None` + +--- + + + +## class `EvaluationStatusNotFound` + +**Pydantic Fields:** + +- `code`: `typing.Literal['not_found']` + +--- + + + +## class `EvaluationStatusReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `call_id`: `` + +--- + + + +## class `EvaluationStatusRes` + +**Pydantic Fields:** + +- `status`: `EvaluationStatusNotFound | EvaluationStatusRunning | EvaluationStatusFailed | EvaluationStatusComplete` + +--- + + + +## class `EvaluationStatusRunning` + +**Pydantic Fields:** + +- `code`: `typing.Literal['running']` +- `completed_rows`: `` +- `total_rows`: `` + +--- + + + +## class `ExportTracePartialSuccess` + +**Pydantic Fields:** + +- `rejected_spans`: `` +- `error_message`: `` + +--- + + + +## class `ExtraKeysTypedDict` + +--- + + + +## class `Feedback` + +**Pydantic Fields:** + +- `id`: `` +- `project_id`: `` +- `weave_ref`: `` +- `creator`: `str | None` - `feedback_type`: `` - `payload`: `dict[str, typing.Any]` -- `annotation_ref`: `typing.Optional[str]` -- `runnable_ref`: `typing.Optional[str]` -- `call_ref`: `typing.Optional[str]` -- `trigger_ref`: `typing.Optional[str]` -- `wb_user_id`: `typing.Optional[str]` +- `annotation_ref`: `str | None` +- `runnable_ref`: `str | None` +- `call_ref`: `str | None` +- `trigger_ref`: `str | None` +- `wb_user_id`: `str | None` - `created_at`: `` ------- - --- - + ## class `FeedbackCreateBatchReq` @@ -706,11 +1227,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `batch`: `list[FeedbackCreateReq]` ------- - --- - + ## class `FeedbackCreateBatchRes` @@ -718,33 +1237,29 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `res`: `list[FeedbackCreateRes]` ------- - --- - + ## class `FeedbackCreateReq` **Pydantic Fields:** -- `id`: `typing.Optional[str]` +- `id`: `str | None` - `project_id`: `` - `weave_ref`: `` -- `creator`: `typing.Optional[str]` +- `creator`: `str | None` - `feedback_type`: `` - `payload`: `dict[str, typing.Any]` -- `annotation_ref`: `typing.Optional[str]` -- `runnable_ref`: `typing.Optional[str]` -- `call_ref`: `typing.Optional[str]` -- `trigger_ref`: `typing.Optional[str]` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `annotation_ref`: `str | None` +- `runnable_ref`: `str | None` +- `call_ref`: `str | None` +- `trigger_ref`: `str | None` +- `wb_user_id`: `str | None` --- - + ## class `FeedbackCreateRes` @@ -755,17 +1270,15 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `wb_user_id`: `` - `payload`: `dict[str, typing.Any]` ------- - --- - + ## class `FeedbackDict` --- - + ## class `FeedbackPurgeReq` @@ -774,36 +1287,30 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `query`: `` ------- - --- - + ## class `FeedbackPurgeRes` ------- - --- - + ## class `FeedbackQueryReq` **Pydantic Fields:** - `project_id`: `` -- `fields`: `typing.Optional[list[str]]` -- `query`: `typing.Optional[weave.trace_server.interface.query.Query]` -- `sort_by`: `typing.Optional[list[SortBy]]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` - ------- +- `fields`: `list[str] | None` +- `query`: `weave.trace_server.interface.query.Query | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `limit`: `int | None` +- `offset`: `int | None` --- - + ## class `FeedbackQueryRes` @@ -811,34 +1318,30 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `result`: `list[dict[str, typing.Any]]` ------- - --- - + ## class `FeedbackReplaceReq` **Pydantic Fields:** -- `id`: `typing.Optional[str]` +- `id`: `str | None` - `project_id`: `` - `weave_ref`: `` -- `creator`: `typing.Optional[str]` +- `creator`: `str | None` - `feedback_type`: `` - `payload`: `dict[str, typing.Any]` -- `annotation_ref`: `typing.Optional[str]` -- `runnable_ref`: `typing.Optional[str]` -- `call_ref`: `typing.Optional[str]` -- `trigger_ref`: `typing.Optional[str]` -- `wb_user_id`: `typing.Optional[str]` +- `annotation_ref`: `str | None` +- `runnable_ref`: `str | None` +- `call_ref`: `str | None` +- `trigger_ref`: `str | None` +- `wb_user_id`: `str | None` - `feedback_id`: `` ------- - --- - + ## class `FeedbackReplaceRes` @@ -849,11 +1352,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `wb_user_id`: `` - `payload`: `dict[str, typing.Any]` ------- - --- - + ## class `FileContentReadReq` @@ -862,11 +1363,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `project_id`: `` - `digest`: `` ------- - --- - + ## class `FileContentReadRes` @@ -874,11 +1373,9 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `content`: `` ------- - --- - + ## class `FileCreateReq` @@ -888,493 +1385,2110 @@ serialize_typed_dicts(v: dict[str, Any]) → dict[str, Any] - `name`: `` - `content`: `` ------- +--- + + + +## class `FileCreateRes` + +**Pydantic Fields:** + +- `digest`: `` + +--- + + + +## class `FilesStatsReq` + +**Pydantic Fields:** + +- `project_id`: `` + +--- + + + +## class `FilesStatsRes` + +**Pydantic Fields:** + +- `total_size_bytes`: `` + +--- + + + +## class `FullTraceServerInterface` +Complete trace server interface supporting both V1 and Object APIs. + +This protocol represents a trace server implementation that supports the full set of APIs - both legacy V1 endpoints and modern Object endpoints. Use this type for implementations that need to support both API versions. + +--- + + + +### method `actions_execute_batch` + +```python +actions_execute_batch(req: ActionsExecuteBatchReq) → ActionsExecuteBatchRes +``` + +--- + + + +### method `annotation_queue_add_calls` + +```python +annotation_queue_add_calls( + req: AnnotationQueueAddCallsReq +) → AnnotationQueueAddCallsRes +``` + +--- + + + +### method `annotation_queue_create` + +```python +annotation_queue_create( + req: AnnotationQueueCreateReq +) → AnnotationQueueCreateRes +``` + +--- + + + +### method `annotation_queue_items_query` + +```python +annotation_queue_items_query( + req: AnnotationQueueItemsQueryReq +) → AnnotationQueueItemsQueryRes +``` + +--- + + + +### method `annotation_queue_read` + +```python +annotation_queue_read(req: AnnotationQueueReadReq) → AnnotationQueueReadRes +``` + +--- + + + +### method `annotation_queues_query_stream` + +```python +annotation_queues_query_stream( + req: AnnotationQueuesQueryReq +) → Iterator[AnnotationQueueSchema] +``` + +--- + + + +### method `annotation_queues_stats` + +```python +annotation_queues_stats( + req: AnnotationQueuesStatsReq +) → AnnotationQueuesStatsRes +``` + +--- + + + +### method `annotator_queue_items_progress_update` + +```python +annotator_queue_items_progress_update( + req: AnnotatorQueueItemsProgressUpdateReq +) → AnnotatorQueueItemsProgressUpdateRes +``` + +--- + + + +### method `call_end` + +```python +call_end(req: CallEndReq) → CallEndRes +``` + +--- + + + +### method `call_read` + +```python +call_read(req: CallReadReq) → CallReadRes +``` + +--- + + + +### method `call_start` + +```python +call_start(req: CallStartReq) → CallStartRes +``` + +--- + + + +### method `call_start_batch` + +```python +call_start_batch(req: CallCreateBatchReq) → CallCreateBatchRes +``` + +--- + + + +### method `call_update` + +```python +call_update(req: CallUpdateReq) → CallUpdateRes +``` + +--- + + + +### method `calls_delete` + +```python +calls_delete(req: CallsDeleteReq) → CallsDeleteRes +``` + +--- + + + +### method `calls_query` + +```python +calls_query(req: CallsQueryReq) → CallsQueryRes +``` + +--- + + + +### method `calls_query_stats` + +```python +calls_query_stats(req: CallsQueryStatsReq) → CallsQueryStatsRes +``` + +--- + + + +### method `calls_query_stream` + +```python +calls_query_stream(req: CallsQueryReq) → Iterator[CallSchema] +``` + +--- + + + +### method `completions_create` + +```python +completions_create(req: CompletionsCreateReq) → CompletionsCreateRes +``` + +--- + + + +### method `completions_create_stream` + +```python +completions_create_stream(req: CompletionsCreateReq) → Iterator[dict[str, Any]] +``` + +--- + + + +### method `cost_create` + +```python +cost_create(req: CostCreateReq) → CostCreateRes +``` + +--- + + + +### method `cost_purge` + +```python +cost_purge(req: CostPurgeReq) → CostPurgeRes +``` + +--- + + + +### method `cost_query` + +```python +cost_query(req: CostQueryReq) → CostQueryRes +``` + +--- + + + +### method `dataset_create` + +```python +dataset_create(req: DatasetCreateReq) → DatasetCreateRes +``` + +--- + + + +### method `dataset_delete` + +```python +dataset_delete(req: DatasetDeleteReq) → DatasetDeleteRes +``` + +--- + + + +### method `dataset_list` + +```python +dataset_list(req: DatasetListReq) → Iterator[DatasetReadRes] +``` + +--- + + + +### method `dataset_read` + +```python +dataset_read(req: DatasetReadReq) → DatasetReadRes +``` + +--- + + + +### method `ensure_project_exists` + +```python +ensure_project_exists(entity: str, project: str) → EnsureProjectExistsRes +``` + +--- + + + +### method `evaluate_model` + +```python +evaluate_model(req: EvaluateModelReq) → EvaluateModelRes +``` + +--- + + + +### method `evaluation_create` + +```python +evaluation_create(req: EvaluationCreateReq) → EvaluationCreateRes +``` + +--- + + + +### method `evaluation_delete` + +```python +evaluation_delete(req: EvaluationDeleteReq) → EvaluationDeleteRes +``` + +--- + + + +### method `evaluation_list` + +```python +evaluation_list(req: EvaluationListReq) → Iterator[EvaluationReadRes] +``` + +--- + + + +### method `evaluation_read` + +```python +evaluation_read(req: EvaluationReadReq) → EvaluationReadRes +``` + +--- + + + +### method `evaluation_run_create` + +```python +evaluation_run_create(req: EvaluationRunCreateReq) → EvaluationRunCreateRes +``` + +--- + + + +### method `evaluation_run_delete` + +```python +evaluation_run_delete(req: EvaluationRunDeleteReq) → EvaluationRunDeleteRes +``` + +--- + + + +### method `evaluation_run_finish` + +```python +evaluation_run_finish(req: EvaluationRunFinishReq) → EvaluationRunFinishRes +``` + +--- + + + +### method `evaluation_run_list` + +```python +evaluation_run_list(req: EvaluationRunListReq) → Iterator[EvaluationRunReadRes] +``` + +--- + + + +### method `evaluation_run_read` + +```python +evaluation_run_read(req: EvaluationRunReadReq) → EvaluationRunReadRes +``` + +--- + + + +### method `evaluation_status` + +```python +evaluation_status(req: EvaluationStatusReq) → EvaluationStatusRes +``` + +--- + + + +### method `feedback_create` + +```python +feedback_create(req: FeedbackCreateReq) → FeedbackCreateRes +``` + +--- + + + +### method `feedback_create_batch` + +```python +feedback_create_batch(req: FeedbackCreateBatchReq) → FeedbackCreateBatchRes +``` + +--- + + + +### method `feedback_purge` + +```python +feedback_purge(req: FeedbackPurgeReq) → FeedbackPurgeRes +``` + +--- + + + +### method `feedback_query` + +```python +feedback_query(req: FeedbackQueryReq) → FeedbackQueryRes +``` + +--- + + + +### method `feedback_replace` + +```python +feedback_replace(req: FeedbackReplaceReq) → FeedbackReplaceRes +``` + +--- + + + +### method `file_content_read` + +```python +file_content_read(req: FileContentReadReq) → FileContentReadRes +``` + +--- + + + +### method `file_create` + +```python +file_create(req: FileCreateReq) → FileCreateRes +``` + +--- + + + +### method `files_stats` + +```python +files_stats(req: FilesStatsReq) → FilesStatsRes +``` + +--- + + + +### method `image_create` + +```python +image_create(req: ImageGenerationCreateReq) → ImageGenerationCreateRes +``` + +--- + + + +### method `model_create` + +```python +model_create(req: ModelCreateReq) → ModelCreateRes +``` + +--- + + + +### method `model_delete` + +```python +model_delete(req: ModelDeleteReq) → ModelDeleteRes +``` + +--- + + + +### method `model_list` + +```python +model_list(req: ModelListReq) → Iterator[ModelReadRes] +``` + +--- + + + +### method `model_read` + +```python +model_read(req: ModelReadReq) → ModelReadRes +``` + +--- + + + +### method `obj_create` + +```python +obj_create(req: ObjCreateReq) → ObjCreateRes +``` + +--- + + + +### method `obj_delete` + +```python +obj_delete(req: ObjDeleteReq) → ObjDeleteRes +``` + +--- + + + +### method `obj_read` + +```python +obj_read(req: ObjReadReq) → ObjReadRes +``` + +--- + + + +### method `objs_query` + +```python +objs_query(req: ObjQueryReq) → ObjQueryRes +``` + +--- + + + +### method `op_create` + +```python +op_create(req: OpCreateReq) → OpCreateRes +``` + +--- + + + +### method `op_delete` + +```python +op_delete(req: OpDeleteReq) → OpDeleteRes +``` + +--- + + + +### method `op_list` + +```python +op_list(req: OpListReq) → Iterator[OpReadRes] +``` + +--- + + + +### method `op_read` + +```python +op_read(req: OpReadReq) → OpReadRes +``` + +--- + + + +### method `otel_export` + +```python +otel_export(req: OtelExportReq) → OtelExportRes +``` + +--- + + + +### method `prediction_create` + +```python +prediction_create(req: PredictionCreateReq) → PredictionCreateRes +``` + +--- + + + +### method `prediction_delete` + +```python +prediction_delete(req: PredictionDeleteReq) → PredictionDeleteRes +``` + +--- + + + +### method `prediction_finish` + +```python +prediction_finish(req: PredictionFinishReq) → PredictionFinishRes +``` + +--- + + + +### method `prediction_list` + +```python +prediction_list(req: PredictionListReq) → Iterator[PredictionReadRes] +``` + +--- + + + +### method `prediction_read` + +```python +prediction_read(req: PredictionReadReq) → PredictionReadRes +``` + +--- + + + +### method `project_stats` + +```python +project_stats(req: ProjectStatsReq) → ProjectStatsRes +``` + +--- + + + +### method `refs_read_batch` + +```python +refs_read_batch(req: RefsReadBatchReq) → RefsReadBatchRes +``` + +--- + + + +### method `score_create` + +```python +score_create(req: ScoreCreateReq) → ScoreCreateRes +``` + +--- + + + +### method `score_delete` + +```python +score_delete(req: ScoreDeleteReq) → ScoreDeleteRes +``` + +--- + + + +### method `score_list` + +```python +score_list(req: ScoreListReq) → Iterator[ScoreReadRes] +``` + +--- + + + +### method `score_read` + +```python +score_read(req: ScoreReadReq) → ScoreReadRes +``` + +--- + + + +### method `scorer_create` + +```python +scorer_create(req: ScorerCreateReq) → ScorerCreateRes +``` + +--- + + + +### method `scorer_delete` + +```python +scorer_delete(req: ScorerDeleteReq) → ScorerDeleteRes +``` + +--- + + + +### method `scorer_list` + +```python +scorer_list(req: ScorerListReq) → Iterator[ScorerReadRes] +``` + +--- + + + +### method `scorer_read` + +```python +scorer_read(req: ScorerReadReq) → ScorerReadRes +``` + +--- + + + +### method `table_create` + +```python +table_create(req: TableCreateReq) → TableCreateRes +``` + +--- + + + +### method `table_create_from_digests` + +```python +table_create_from_digests( + req: TableCreateFromDigestsReq +) → TableCreateFromDigestsRes +``` + +--- + + + +### method `table_query` + +```python +table_query(req: TableQueryReq) → TableQueryRes +``` + +--- + + + +### method `table_query_stats` + +```python +table_query_stats(req: TableQueryStatsReq) → TableQueryStatsRes +``` + +--- + + + +### method `table_query_stats_batch` + +```python +table_query_stats_batch(req: TableQueryStatsBatchReq) → TableQueryStatsBatchRes +``` + +--- + + + +### method `table_query_stream` + +```python +table_query_stream(req: TableQueryReq) → Iterator[TableRowSchema] +``` + +--- + + + +### method `table_update` + +```python +table_update(req: TableUpdateReq) → TableUpdateRes +``` + +--- + + + +### method `threads_query_stream` + +```python +threads_query_stream(req: ThreadsQueryReq) → Iterator[ThreadSchema] +``` + +--- + + + +## class `ImageGenerationCreateReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `inputs`: `` +- `wb_user_id`: `str | None` +- `track_llm_call`: `bool | None` + +--- + + + +## class `ImageGenerationCreateRes` + +**Pydantic Fields:** + +- `response`: `dict[str, typing.Any]` +- `weave_call_id`: `str | None` + +--- + + + +## class `ImageGenerationRequestInputs` + +**Pydantic Fields:** + +- `model`: `` +- `prompt`: `` +- `n`: `int | None` + +--- + + + +## class `LLMCostSchema` + +--- + + + +## class `LLMUsageSchema` + +--- + + + +## class `ModelCreateBody` + +**Pydantic Fields:** + +- `name`: `` +- `description`: `str | None` +- `source_code`: `` +- `attributes`: `dict[str, typing.Any] | None` + +--- + + + +## class `ModelCreateReq` + +**Pydantic Fields:** + +- `name`: `` +- `description`: `str | None` +- `source_code`: `` +- `attributes`: `dict[str, typing.Any] | None` +- `project_id`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `ModelCreateRes` + +**Pydantic Fields:** + +- `digest`: `` +- `object_id`: `` +- `version_index`: `` +- `model_ref`: `` + +--- + + + +## class `ModelDeleteReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digests`: `list[str] | None` +- `wb_user_id`: `str | None` + +--- + + + +## class `ModelDeleteRes` + +**Pydantic Fields:** + +- `num_deleted`: `` + +--- + + + +## class `ModelListReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `limit`: `int | None` +- `offset`: `int | None` + +--- + + + +## class `ModelReadReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digest`: `` + +--- + + + +## class `ModelReadRes` + +**Pydantic Fields:** + +- `object_id`: `` +- `digest`: `` +- `version_index`: `` +- `created_at`: `` +- `name`: `` +- `description`: `str | None` +- `source_code`: `` +- `attributes`: `dict[str, typing.Any] | None` + +--- + + + +## class `ObjCreateReq` + +**Pydantic Fields:** + +- `obj`: `` + +--- + + + +## class `ObjCreateRes` + +**Pydantic Fields:** + +- `digest`: `` +- `object_id`: `str | None` + +--- + + + +## class `ObjDeleteReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digests`: `list[str] | None` + +--- + + + +## class `ObjDeleteRes` + +**Pydantic Fields:** + +- `num_deleted`: `` + +--- + + + +## class `ObjQueryReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `filter`: `ObjectVersionFilter | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` +- `metadata_only`: `bool | None` +- `include_storage_size`: `bool | None` + +--- + + + +## class `ObjQueryRes` + +**Pydantic Fields:** + +- `objs`: `list[ObjSchema]` + +--- + + + +## class `ObjReadReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digest`: `` +- `metadata_only`: `bool | None` + +--- + + + +## class `ObjReadRes` + +**Pydantic Fields:** + +- `obj`: `` + +--- + + + +## class `ObjSchema` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `created_at`: `` +- `deleted_at`: `datetime.datetime | None` +- `digest`: `` +- `version_index`: `` +- `is_latest`: `` +- `kind`: `` +- `base_object_class`: `str | None` +- `leaf_object_class`: `str | None` +- `val`: `typing.Any` +- `wb_user_id`: `str | None` +- `size_bytes`: `int | None` + +--- + + + +## class `ObjSchemaForInsert` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `val`: `typing.Any` +- `builtin_object_class`: `str | None` +- `set_base_object_class`: `str | None` +- `wb_user_id`: `str | None` + + + +### method `model_post_init` + +```python +model_post_init(_ObjSchemaForInsert__context: Any) → None +``` + +--- + + + +## class `ObjectInterface` +Object API endpoints for Trace Server. + +This protocol contains object management APIs that provide cleaner, more RESTful interfaces. Implementations should support both this protocol and TraceServerInterface to maintain backward compatibility. + +--- + + + +### method `dataset_create` + +```python +dataset_create(req: DatasetCreateReq) → DatasetCreateRes +``` + +--- + + + +### method `dataset_delete` + +```python +dataset_delete(req: DatasetDeleteReq) → DatasetDeleteRes +``` + +--- + + + +### method `dataset_list` + +```python +dataset_list(req: DatasetListReq) → Iterator[DatasetReadRes] +``` + +--- + + + +### method `dataset_read` + +```python +dataset_read(req: DatasetReadReq) → DatasetReadRes +``` + +--- + + + +### method `evaluation_create` + +```python +evaluation_create(req: EvaluationCreateReq) → EvaluationCreateRes +``` + +--- + + + +### method `evaluation_delete` + +```python +evaluation_delete(req: EvaluationDeleteReq) → EvaluationDeleteRes +``` + +--- + + + +### method `evaluation_list` + +```python +evaluation_list(req: EvaluationListReq) → Iterator[EvaluationReadRes] +``` + +--- + + + +### method `evaluation_read` + +```python +evaluation_read(req: EvaluationReadReq) → EvaluationReadRes +``` + +--- + + + +### method `evaluation_run_create` + +```python +evaluation_run_create(req: EvaluationRunCreateReq) → EvaluationRunCreateRes +``` + +--- + + + +### method `evaluation_run_delete` + +```python +evaluation_run_delete(req: EvaluationRunDeleteReq) → EvaluationRunDeleteRes +``` + +--- + + + +### method `evaluation_run_finish` + +```python +evaluation_run_finish(req: EvaluationRunFinishReq) → EvaluationRunFinishRes +``` + +--- + + + +### method `evaluation_run_list` + +```python +evaluation_run_list(req: EvaluationRunListReq) → Iterator[EvaluationRunReadRes] +``` + +--- + + + +### method `evaluation_run_read` + +```python +evaluation_run_read(req: EvaluationRunReadReq) → EvaluationRunReadRes +``` + +--- + + + +### method `model_create` + +```python +model_create(req: ModelCreateReq) → ModelCreateRes +``` + +--- + + + +### method `model_delete` + +```python +model_delete(req: ModelDeleteReq) → ModelDeleteRes +``` + +--- + + + +### method `model_list` + +```python +model_list(req: ModelListReq) → Iterator[ModelReadRes] +``` + +--- + + + +### method `model_read` + +```python +model_read(req: ModelReadReq) → ModelReadRes +``` + +--- + + + +### method `op_create` + +```python +op_create(req: OpCreateReq) → OpCreateRes +``` + +--- + + + +### method `op_delete` + +```python +op_delete(req: OpDeleteReq) → OpDeleteRes +``` + +--- + + + +### method `op_list` + +```python +op_list(req: OpListReq) → Iterator[OpReadRes] +``` + +--- + + + +### method `op_read` + +```python +op_read(req: OpReadReq) → OpReadRes +``` + +--- + + + +### method `prediction_create` + +```python +prediction_create(req: PredictionCreateReq) → PredictionCreateRes +``` + +--- + + + +### method `prediction_delete` + +```python +prediction_delete(req: PredictionDeleteReq) → PredictionDeleteRes +``` + +--- + + + +### method `prediction_finish` + +```python +prediction_finish(req: PredictionFinishReq) → PredictionFinishRes +``` + +--- + + + +### method `prediction_list` + +```python +prediction_list(req: PredictionListReq) → Iterator[PredictionReadRes] +``` + +--- + + + +### method `prediction_read` + +```python +prediction_read(req: PredictionReadReq) → PredictionReadRes +``` + +--- + + + +### method `score_create` + +```python +score_create(req: ScoreCreateReq) → ScoreCreateRes +``` + +--- + + + +### method `score_delete` + +```python +score_delete(req: ScoreDeleteReq) → ScoreDeleteRes +``` + +--- + + + +### method `score_list` + +```python +score_list(req: ScoreListReq) → Iterator[ScoreReadRes] +``` + +--- + + + +### method `score_read` + +```python +score_read(req: ScoreReadReq) → ScoreReadRes +``` + +--- + + + +### method `scorer_create` + +```python +scorer_create(req: ScorerCreateReq) → ScorerCreateRes +``` + +--- + + + +### method `scorer_delete` + +```python +scorer_delete(req: ScorerDeleteReq) → ScorerDeleteRes +``` + +--- + + + +### method `scorer_list` + +```python +scorer_list(req: ScorerListReq) → Iterator[ScorerReadRes] +``` + +--- + + + +### method `scorer_read` + +```python +scorer_read(req: ScorerReadReq) → ScorerReadRes +``` + +--- + + + +## class `ObjectVersionFilter` + +**Pydantic Fields:** + +- `base_object_classes`: `list[str] | None` +- `exclude_base_object_classes`: `list[str] | None` +- `leaf_object_classes`: `list[str] | None` +- `object_ids`: `list[str] | None` +- `is_op`: `bool | None` +- `latest_only`: `bool | None` + +--- + + + +## class `OpCreateBody` +Request body for creating an Op object via REST API. + +This model excludes project_id since it comes from the URL path in RESTful endpoints. + +**Pydantic Fields:** + +- `name`: `str | None` +- `source_code`: `str | None` + +--- + + + +## class `OpCreateReq` +Request model for creating an Op object. + +Extends OpCreateBody by adding project_id for internal API usage. + +**Pydantic Fields:** + +- `name`: `str | None` +- `source_code`: `str | None` +- `project_id`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `OpCreateRes` +Response model for creating an Op object. + +**Pydantic Fields:** + +- `digest`: `` +- `object_id`: `` +- `version_index`: `` + +--- + + + +## class `OpDeleteReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digests`: `list[str] | None` +- `wb_user_id`: `str | None` + +--- + + + +## class `OpDeleteRes` + +**Pydantic Fields:** + +- `num_deleted`: `` + +--- + + + +## class `OpListReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` + +--- + + + +## class `OpReadReq` + +**Pydantic Fields:** + +- `project_id`: `` +- `object_id`: `` +- `digest`: `` +- `wb_user_id`: `str | None` + +--- + + + +## class `OpReadRes` +Response model for reading an Op object. + +The code field contains the actual source code of the op. + +**Pydantic Fields:** + +- `object_id`: `` +- `digest`: `` +- `version_index`: `` +- `created_at`: `` +- `code`: `` --- - + -## class `FileCreateRes` +## class `OtelExportReq` **Pydantic Fields:** -- `digest`: `` - ------- +- `project_id`: `` +- `traces`: `typing.Any` +- `wb_run_id`: `str | None` +- `wb_user_id`: `str | None` --- - + -## class `FilesStatsReq` +## class `OtelExportRes` **Pydantic Fields:** -- `project_id`: `` - ------- +- `partial_success`: `ExportTracePartialSuccess | None` --- - + -## class `FilesStatsRes` +## class `PredictionCreateBody` +Request body for creating a Prediction via REST API. -**Pydantic Fields:** +This model excludes project_id since it comes from the URL path in RESTful endpoints. -- `total_size_bytes`: `` +**Pydantic Fields:** ------- +- `model`: `` +- `inputs`: `dict[str, typing.Any]` +- `output`: `typing.Any` +- `evaluation_run_id`: `str | None` --- - + -## class `ImageGenerationCreateReq` +## class `PredictionCreateReq` +Request model for creating a Prediction. + +Extends PredictionCreateBody by adding project_id for internal API usage. **Pydantic Fields:** +- `model`: `` +- `inputs`: `dict[str, typing.Any]` +- `output`: `typing.Any` +- `evaluation_run_id`: `str | None` - `project_id`: `` -- `inputs`: `` -- `wb_user_id`: `typing.Optional[str]` -- `track_llm_call`: `typing.Optional[bool]` - ------- +- `wb_user_id`: `str | None` --- - + -## class `ImageGenerationCreateRes` +## class `PredictionCreateRes` **Pydantic Fields:** -- `response`: `dict[str, typing.Any]` -- `weave_call_id`: `typing.Optional[str]` - ------- +- `prediction_id`: `` --- - + -## class `ImageGenerationRequestInputs` +## class `PredictionDeleteReq` **Pydantic Fields:** -- `model`: `` -- `prompt`: `` -- `n`: `typing.Optional[int]` - ------- +- `project_id`: `` +- `prediction_ids`: `list[str]` +- `wb_user_id`: `str | None` --- - - -## class `LLMCostSchema` + ---- +## class `PredictionDeleteRes` - +**Pydantic Fields:** -## class `LLMUsageSchema` +- `num_deleted`: `` --- - + -## class `ObjCreateReq` +## class `PredictionFinishReq` **Pydantic Fields:** -- `obj`: `` - ------- +- `project_id`: `` +- `prediction_id`: `` +- `wb_user_id`: `str | None` --- - + -## class `ObjCreateRes` +## class `PredictionFinishRes` **Pydantic Fields:** -- `digest`: `` - ------- +- `success`: `` --- - + -## class `ObjDeleteReq` +## class `PredictionListReq` **Pydantic Fields:** - `project_id`: `` -- `object_id`: `` -- `digests`: `typing.Optional[list[str]]` - ------- +- `evaluation_run_id`: `str | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` --- - + -## class `ObjDeleteRes` +## class `PredictionListRes` **Pydantic Fields:** -- `num_deleted`: `` - ------- +- `predictions`: `list[PredictionReadRes]` --- - + -## class `ObjQueryReq` +## class `PredictionReadReq` **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[ObjectVersionFilter]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` -- `sort_by`: `typing.Optional[list[SortBy]]` -- `metadata_only`: `typing.Optional[bool]` -- `include_storage_size`: `typing.Optional[bool]` - ------- +- `prediction_id`: `` +- `wb_user_id`: `str | None` --- - + -## class `ObjQueryRes` +## class `PredictionReadRes` **Pydantic Fields:** -- `objs`: `list[ObjSchema]` - ------- +- `prediction_id`: `` +- `model`: `` +- `inputs`: `dict[str, typing.Any]` +- `output`: `typing.Any` +- `evaluation_run_id`: `str | None` +- `wb_user_id`: `str | None` --- - + -## class `ObjReadReq` +## class `ProjectStatsReq` **Pydantic Fields:** - `project_id`: `` -- `object_id`: `` -- `digest`: `` -- `metadata_only`: `typing.Optional[bool]` - ------- +- `include_trace_storage_size`: `bool | None` +- `include_object_storage_size`: `bool | None` +- `include_table_storage_size`: `bool | None` +- `include_file_storage_size`: `bool | None` --- - + -## class `ObjReadRes` +## class `ProjectStatsRes` **Pydantic Fields:** -- `obj`: `` - ------- +- `trace_storage_size_bytes`: `` +- `objects_storage_size_bytes`: `` +- `tables_storage_size_bytes`: `` +- `files_storage_size_bytes`: `` --- - + -## class `ObjSchema` +## class `RefsReadBatchReq` **Pydantic Fields:** -- `project_id`: `` -- `object_id`: `` -- `created_at`: `` -- `deleted_at`: `typing.Optional[datetime.datetime]` -- `digest`: `` -- `version_index`: `` -- `is_latest`: `` -- `kind`: `` -- `base_object_class`: `typing.Optional[str]` -- `leaf_object_class`: `typing.Optional[str]` -- `val`: `typing.Any` -- `wb_user_id`: `typing.Optional[str]` -- `size_bytes`: `typing.Optional[int]` - ------- +- `refs`: `list[str]` --- - + -## class `ObjSchemaForInsert` +## class `RefsReadBatchRes` **Pydantic Fields:** -- `project_id`: `` -- `object_id`: `` -- `val`: `typing.Any` -- `builtin_object_class`: `typing.Optional[str]` -- `set_base_object_class`: `typing.Optional[str]` -- `wb_user_id`: `typing.Optional[str]` +- `vals`: `list[typing.Any]` ---------- +--- - + -### method `model_post_init` +## class `ScoreCreateBody` +Request body for creating a Score via REST API. -```python -model_post_init(_ObjSchemaForInsert__context: Any) → None -``` +This model excludes project_id since it comes from the URL path in RESTful endpoints. + +**Pydantic Fields:** + +- `prediction_id`: `` +- `scorer`: `` +- `value`: `` +- `evaluation_run_id`: `str | None` --- - + -## class `ObjectVersionFilter` +## class `ScoreCreateReq` +Request model for creating a Score. -**Pydantic Fields:** +Extends ScoreCreateBody by adding project_id for internal API usage. -- `base_object_classes`: `typing.Optional[list[str]]` -- `exclude_base_object_classes`: `typing.Optional[list[str]]` -- `leaf_object_classes`: `typing.Optional[list[str]]` -- `object_ids`: `typing.Optional[list[str]]` -- `is_op`: `typing.Optional[bool]` -- `latest_only`: `typing.Optional[bool]` +**Pydantic Fields:** ------- +- `prediction_id`: `` +- `scorer`: `` +- `value`: `` +- `evaluation_run_id`: `str | None` +- `project_id`: `` +- `wb_user_id`: `str | None` --- - + -## class `OpCreateReq` +## class `ScoreCreateRes` **Pydantic Fields:** -- `op_obj`: `` - ------- +- `score_id`: `` --- - + -## class `OpCreateRes` +## class `ScoreDeleteReq` **Pydantic Fields:** -- `digest`: `` - ------- +- `project_id`: `` +- `score_ids`: `list[str]` +- `wb_user_id`: `str | None` --- - + -## class `OpQueryReq` +## class `ScoreDeleteRes` **Pydantic Fields:** -- `project_id`: `` -- `filter`: `typing.Optional[OpVersionFilter]` - ------- +- `num_deleted`: `` --- - + -## class `OpQueryRes` +## class `ScoreListReq` **Pydantic Fields:** -- `op_objs`: `list[ObjSchema]` - ------- +- `project_id`: `` +- `evaluation_run_id`: `str | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` --- - + -## class `OpReadReq` +## class `ScoreReadReq` **Pydantic Fields:** - `project_id`: `` -- `name`: `` -- `digest`: `` - ------- +- `score_id`: `` +- `wb_user_id`: `str | None` --- - + -## class `OpReadRes` +## class `ScoreReadRes` **Pydantic Fields:** -- `op_obj`: `` - ------- +- `score_id`: `` +- `scorer`: `` +- `value`: `` +- `evaluation_run_id`: `str | None` +- `wb_user_id`: `str | None` --- - + -## class `OpVersionFilter` +## class `ScorerCreateBody` **Pydantic Fields:** -- `op_names`: `typing.Optional[list[str]]` -- `latest_only`: `typing.Optional[bool]` - ------- +- `name`: `` +- `description`: `str | None` +- `op_source_code`: `` --- - + -## class `OtelExportReq` +## class `ScorerCreateReq` **Pydantic Fields:** +- `name`: `` +- `description`: `str | None` +- `op_source_code`: `` - `project_id`: `` -- `traces`: `typing.Any` -- `wb_user_id`: `typing.Optional[str]` - ------- +- `wb_user_id`: `str | None` --- - + -## class `OtelExportRes` +## class `ScorerCreateRes` **Pydantic Fields:** -- `partial_success`: `typing.Optional[ExportTracePartialSuccess]` - ------- +- `digest`: `` +- `object_id`: `` +- `version_index`: `` +- `scorer`: `` --- - + -## class `ProjectStatsReq` +## class `ScorerDeleteReq` **Pydantic Fields:** - `project_id`: `` -- `include_trace_storage_size`: `typing.Optional[bool]` -- `include_object_storage_size`: `typing.Optional[bool]` -- `include_table_storage_size`: `typing.Optional[bool]` -- `include_file_storage_size`: `typing.Optional[bool]` - ------- +- `object_id`: `` +- `digests`: `list[str] | None` +- `wb_user_id`: `str | None` --- - + -## class `ProjectStatsRes` +## class `ScorerDeleteRes` **Pydantic Fields:** -- `trace_storage_size_bytes`: `` -- `objects_storage_size_bytes`: `` -- `tables_storage_size_bytes`: `` -- `files_storage_size_bytes`: `` - ------- +- `num_deleted`: `` --- - + -## class `RefsReadBatchReq` +## class `ScorerListReq` **Pydantic Fields:** -- `refs`: `list[str]` - ------- +- `project_id`: `` +- `limit`: `int | None` +- `offset`: `int | None` +- `wb_user_id`: `str | None` --- - + -## class `RefsReadBatchRes` +## class `ScorerReadReq` **Pydantic Fields:** -- `vals`: `list[typing.Any]` - ------- +- `project_id`: `` +- `object_id`: `` +- `digest`: `` +- `wb_user_id`: `str | None` --- - + -## class `SortBy` +## class `ScorerReadRes` **Pydantic Fields:** -- `field`: `` -- `direction`: `typing.Literal['asc', 'desc']` - ------- +- `object_id`: `` +- `digest`: `` +- `version_index`: `` +- `created_at`: `` +- `name`: `` +- `description`: `str | None` +- `score_op`: `` --- - + ## class `StartedCallSchemaForInsert` **Pydantic Fields:** - `project_id`: `` -- `id`: `typing.Optional[str]` +- `id`: `str | None` - `op_name`: `` -- `display_name`: `typing.Optional[str]` -- `trace_id`: `typing.Optional[str]` -- `parent_id`: `typing.Optional[str]` -- `thread_id`: `typing.Optional[str]` -- `turn_id`: `typing.Optional[str]` +- `display_name`: `str | None` +- `trace_id`: `str | None` +- `parent_id`: `str | None` +- `thread_id`: `str | None` +- `turn_id`: `str | None` - `started_at`: `` - `attributes`: `dict[str, typing.Any]` - `inputs`: `dict[str, typing.Any]` -- `wb_user_id`: `typing.Optional[str]` -- `wb_run_id`: `typing.Optional[str]` -- `wb_run_step`: `typing.Optional[int]` - ------- +- `otel_dump`: `dict[str, typing.Any] | None` +- `wb_user_id`: `str | None` +- `wb_run_id`: `str | None` +- `wb_run_step`: `int | None` --- - + ## class `SummaryInsertMap` --- - + ## class `SummaryMap` --- - + ## class `TableAppendSpec` @@ -1382,11 +3496,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `append`: `` ------- - --- - + ## class `TableAppendSpecPayload` @@ -1394,11 +3506,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `row`: `dict[str, typing.Any]` ------- - --- - + ## class `TableCreateFromDigestsReq` @@ -1407,11 +3517,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `project_id`: `` - `row_digests`: `list[str]` ------- - --- - + ## class `TableCreateFromDigestsRes` @@ -1419,11 +3527,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `digest`: `` ------- - --- - + ## class `TableCreateReq` @@ -1431,11 +3537,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `table`: `` ------- - --- - + ## class `TableCreateRes` @@ -1444,11 +3548,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `digest`: `` - `row_digests`: `list[str]` ------- - --- - + ## class `TableInsertSpec` @@ -1456,11 +3558,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `insert`: `` ------- - --- - + ## class `TableInsertSpecPayload` @@ -1469,11 +3569,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `index`: `` - `row`: `dict[str, typing.Any]` ------- - --- - + ## class `TablePopSpec` @@ -1481,11 +3579,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `pop`: `` ------- - --- - + ## class `TablePopSpecPayload` @@ -1493,11 +3589,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `index`: `` ------- - --- - + ## class `TableQueryReq` @@ -1505,16 +3599,14 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `project_id`: `` - `digest`: `` -- `filter`: `typing.Optional[TableRowFilter]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` -- `sort_by`: `typing.Optional[list[SortBy]]` - ------- +- `filter`: `TableRowFilter | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` --- - + ## class `TableQueryRes` @@ -1522,25 +3614,21 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `rows`: `list[TableRowSchema]` ------- - --- - + ## class `TableQueryStatsBatchReq` **Pydantic Fields:** - `project_id`: `` -- `digests`: `typing.Optional[list[str]]` -- `include_storage_size`: `typing.Optional[bool]` - ------- +- `digests`: `list[str] | None` +- `include_storage_size`: `bool | None` --- - + ## class `TableQueryStatsBatchRes` @@ -1548,11 +3636,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `tables`: `list[TableStatsRow]` ------- - --- - + ## class `TableQueryStatsReq` @@ -1561,11 +3647,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `project_id`: `` - `digest`: `` ------- - --- - + ## class `TableQueryStatsRes` @@ -1573,23 +3657,19 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `count`: `` ------- - --- - + ## class `TableRowFilter` **Pydantic Fields:** -- `row_digests`: `typing.Optional[list[str]]` - ------- +- `row_digests`: `list[str] | None` --- - + ## class `TableRowSchema` @@ -1597,13 +3677,11 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `digest`: `` - `val`: `typing.Any` -- `original_index`: `typing.Optional[int]` - ------- +- `original_index`: `int | None` --- - + ## class `TableSchemaForInsert` @@ -1612,11 +3690,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `project_id`: `` - `rows`: `list[dict[str, typing.Any]]` ------- - --- - + ## class `TableStatsRow` @@ -1624,13 +3700,11 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `count`: `` - `digest`: `` -- `storage_size_bytes`: `typing.Optional[int]` - ------- +- `storage_size_bytes`: `int | None` --- - + ## class `TableUpdateReq` @@ -1638,13 +3712,11 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `project_id`: `` - `base_digest`: `` -- `updates`: `list[typing.Union[TableAppendSpec, TablePopSpec, TableInsertSpec]]` - ------- +- `updates`: `list[TableAppendSpec | TablePopSpec | TableInsertSpec]` --- - + ## class `TableUpdateRes` @@ -1653,11 +3725,9 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `digest`: `` - `updated_row_digests`: `list[str]` ------- - --- - + ## class `ThreadSchema` @@ -1667,30 +3737,26 @@ model_post_init(_ObjSchemaForInsert__context: Any) → None - `turn_count`: `` - `start_time`: `` - `last_updated`: `` -- `first_turn_id`: `typing.Optional[str]` -- `last_turn_id`: `typing.Optional[str]` -- `p50_turn_duration_ms`: `typing.Optional[float]` -- `p99_turn_duration_ms`: `typing.Optional[float]` - ------- +- `first_turn_id`: `str | None` +- `last_turn_id`: `str | None` +- `p50_turn_duration_ms`: `float | None` +- `p99_turn_duration_ms`: `float | None` --- - + ## class `ThreadsQueryFilter` **Pydantic Fields:** -- `after_datetime`: `typing.Optional[datetime.datetime]` -- `before_datetime`: `typing.Optional[datetime.datetime]` -- `thread_ids`: `typing.Optional[list[str]]` - ------- +- `after_datetime`: `datetime.datetime | None` +- `before_datetime`: `datetime.datetime | None` +- `thread_ids`: `list[str] | None` --- - + ## class `ThreadsQueryReq` Query threads with aggregated statistics based on turn calls only. @@ -1700,22 +3766,20 @@ Turn calls are the immediate children of thread contexts (where call.id == turn_ **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[ThreadsQueryFilter]` -- `limit`: `typing.Optional[int]` -- `offset`: `typing.Optional[int]` -- `sort_by`: `typing.Optional[list[SortBy]]` - ------- +- `filter`: `ThreadsQueryFilter | None` +- `limit`: `int | None` +- `offset`: `int | None` +- `sort_by`: `list[weave.trace_server.common_interface.SortBy] | None` --- - + ## class `TraceServerInterface` --- - + ### method `actions_execute_batch` @@ -1725,7 +3789,89 @@ actions_execute_batch(req: ActionsExecuteBatchReq) → ActionsExecuteBatchRes --- - + + +### method `annotation_queue_add_calls` + +```python +annotation_queue_add_calls( + req: AnnotationQueueAddCallsReq +) → AnnotationQueueAddCallsRes +``` + +--- + + + +### method `annotation_queue_create` + +```python +annotation_queue_create( + req: AnnotationQueueCreateReq +) → AnnotationQueueCreateRes +``` + +--- + + + +### method `annotation_queue_items_query` + +```python +annotation_queue_items_query( + req: AnnotationQueueItemsQueryReq +) → AnnotationQueueItemsQueryRes +``` + +--- + + + +### method `annotation_queue_read` + +```python +annotation_queue_read(req: AnnotationQueueReadReq) → AnnotationQueueReadRes +``` + +--- + + + +### method `annotation_queues_query_stream` + +```python +annotation_queues_query_stream( + req: AnnotationQueuesQueryReq +) → Iterator[AnnotationQueueSchema] +``` + +--- + + + +### method `annotation_queues_stats` + +```python +annotation_queues_stats( + req: AnnotationQueuesStatsReq +) → AnnotationQueuesStatsRes +``` + +--- + + + +### method `annotator_queue_items_progress_update` + +```python +annotator_queue_items_progress_update( + req: AnnotatorQueueItemsProgressUpdateReq +) → AnnotatorQueueItemsProgressUpdateRes +``` + +--- + + ### method `call_end` @@ -1735,7 +3881,7 @@ call_end(req: CallEndReq) → CallEndRes --- - + ### method `call_read` @@ -1745,7 +3891,7 @@ call_read(req: CallReadReq) → CallReadRes --- - + ### method `call_start` @@ -1755,7 +3901,7 @@ call_start(req: CallStartReq) → CallStartRes --- - + ### method `call_start_batch` @@ -1765,7 +3911,7 @@ call_start_batch(req: CallCreateBatchReq) → CallCreateBatchRes --- - + ### method `call_update` @@ -1775,7 +3921,7 @@ call_update(req: CallUpdateReq) → CallUpdateRes --- - + ### method `calls_delete` @@ -1785,7 +3931,7 @@ calls_delete(req: CallsDeleteReq) → CallsDeleteRes --- - + ### method `calls_query` @@ -1795,7 +3941,7 @@ calls_query(req: CallsQueryReq) → CallsQueryRes --- - + ### method `calls_query_stats` @@ -1805,7 +3951,7 @@ calls_query_stats(req: CallsQueryStatsReq) → CallsQueryStatsRes --- - + ### method `calls_query_stream` @@ -1815,7 +3961,7 @@ calls_query_stream(req: CallsQueryReq) → Iterator[CallSchema] --- - + ### method `completions_create` @@ -1825,7 +3971,7 @@ completions_create(req: CompletionsCreateReq) → CompletionsCreateRes --- - + ### method `completions_create_stream` @@ -1835,7 +3981,7 @@ completions_create_stream(req: CompletionsCreateReq) → Iterator[dict[str, Any] --- - + ### method `cost_create` @@ -1845,7 +3991,7 @@ cost_create(req: CostCreateReq) → CostCreateRes --- - + ### method `cost_purge` @@ -1855,7 +4001,7 @@ cost_purge(req: CostPurgeReq) → CostPurgeRes --- - + ### method `cost_query` @@ -1865,7 +4011,7 @@ cost_query(req: CostQueryReq) → CostQueryRes --- - + ### method `ensure_project_exists` @@ -1875,7 +4021,7 @@ ensure_project_exists(entity: str, project: str) → EnsureProjectExistsRes --- - + ### method `evaluate_model` @@ -1885,7 +4031,7 @@ evaluate_model(req: EvaluateModelReq) → EvaluateModelRes --- - + ### method `evaluation_status` @@ -1895,7 +4041,7 @@ evaluation_status(req: EvaluationStatusReq) → EvaluationStatusRes --- - + ### method `feedback_create` @@ -1905,7 +4051,7 @@ feedback_create(req: FeedbackCreateReq) → FeedbackCreateRes --- - + ### method `feedback_create_batch` @@ -1915,7 +4061,7 @@ feedback_create_batch(req: FeedbackCreateBatchReq) → FeedbackCreateBatchRes --- - + ### method `feedback_purge` @@ -1925,7 +4071,7 @@ feedback_purge(req: FeedbackPurgeReq) → FeedbackPurgeRes --- - + ### method `feedback_query` @@ -1935,7 +4081,7 @@ feedback_query(req: FeedbackQueryReq) → FeedbackQueryRes --- - + ### method `feedback_replace` @@ -1945,7 +4091,7 @@ feedback_replace(req: FeedbackReplaceReq) → FeedbackReplaceRes --- - + ### method `file_content_read` @@ -1955,7 +4101,7 @@ file_content_read(req: FileContentReadReq) → FileContentReadRes --- - + ### method `file_create` @@ -1965,7 +4111,7 @@ file_create(req: FileCreateReq) → FileCreateRes --- - + ### method `files_stats` @@ -1975,7 +4121,7 @@ files_stats(req: FilesStatsReq) → FilesStatsRes --- - + ### method `image_create` @@ -1985,7 +4131,7 @@ image_create(req: ImageGenerationCreateReq) → ImageGenerationCreateRes --- - + ### method `obj_create` @@ -1995,7 +4141,7 @@ obj_create(req: ObjCreateReq) → ObjCreateRes --- - + ### method `obj_delete` @@ -2005,7 +4151,7 @@ obj_delete(req: ObjDeleteReq) → ObjDeleteRes --- - + ### method `obj_read` @@ -2015,7 +4161,7 @@ obj_read(req: ObjReadReq) → ObjReadRes --- - + ### method `objs_query` @@ -2025,37 +4171,7 @@ objs_query(req: ObjQueryReq) → ObjQueryRes --- - - -### method `op_create` - -```python -op_create(req: OpCreateReq) → OpCreateRes -``` - ---- - - - -### method `op_read` - -```python -op_read(req: OpReadReq) → OpReadRes -``` - ---- - - - -### method `ops_query` - -```python -ops_query(req: OpQueryReq) → OpQueryRes -``` - ---- - - + ### method `otel_export` @@ -2065,7 +4181,7 @@ otel_export(req: OtelExportReq) → OtelExportRes --- - + ### method `project_stats` @@ -2075,7 +4191,7 @@ project_stats(req: ProjectStatsReq) → ProjectStatsRes --- - + ### method `refs_read_batch` @@ -2085,7 +4201,7 @@ refs_read_batch(req: RefsReadBatchReq) → RefsReadBatchRes --- - + ### method `table_create` @@ -2095,7 +4211,7 @@ table_create(req: TableCreateReq) → TableCreateRes --- - + ### method `table_create_from_digests` @@ -2107,7 +4223,7 @@ table_create_from_digests( --- - + ### method `table_query` @@ -2117,7 +4233,7 @@ table_query(req: TableQueryReq) → TableQueryRes --- - + ### method `table_query_stats` @@ -2127,7 +4243,7 @@ table_query_stats(req: TableQueryStatsReq) → TableQueryStatsRes --- - + ### method `table_query_stats_batch` @@ -2137,7 +4253,7 @@ table_query_stats_batch(req: TableQueryStatsBatchReq) → TableQueryStatsBatchRe --- - + ### method `table_query_stream` @@ -2147,7 +4263,7 @@ table_query_stream(req: TableQueryReq) → Iterator[TableRowSchema] --- - + ### method `table_update` @@ -2157,7 +4273,7 @@ table_update(req: TableUpdateReq) → TableUpdateRes --- - + ### method `threads_query_stream` @@ -2167,13 +4283,13 @@ threads_query_stream(req: ThreadsQueryReq) → Iterator[ThreadSchema] --- - + ## class `TraceStatus` --- - + ## class `WeaveSummarySchema` diff --git a/weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server.mdx b/weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server.mdx index b548360151..970f61c29d 100644 --- a/weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server.mdx +++ b/weave/reference/python-sdk/trace_server_bindings/remote_http_trace_server.mdx @@ -3,16 +3,18 @@ title: "remote_http_trace_server" description: "Python SDK reference for weave.trace_server_bindings.remote_http_trace_server" --- +import { SourceLink } from '/snippets/en/_includes/source-link.mdx'; + # API Overview --- - + ## class `RemoteHTTPTraceServer` - + ### method `__init__` @@ -21,56 +23,136 @@ __init__( trace_server_url: str, should_batch: bool = False, remote_request_bytes_limit: int = 32505856, - auth: Optional[tuple[str, str]] = None, - extra_headers: Optional[dict[str, str]] = None + auth: tuple[str, str] | None = None, + extra_headers: dict[str, str] | None = None ) ``` --- - + ### method `actions_execute_batch` ```python -actions_execute_batch( - req: Union[ActionsExecuteBatchReq, dict[str, Any]] -) → ActionsExecuteBatchRes +actions_execute_batch(req: ActionsExecuteBatchReq) → ActionsExecuteBatchRes +``` + +--- + + + +### method `annotation_queue_add_calls` + +```python +annotation_queue_add_calls( + req: AnnotationQueueAddCallsReq +) → AnnotationQueueAddCallsRes +``` + +--- + + + +### method `annotation_queue_create` + +```python +annotation_queue_create( + req: AnnotationQueueCreateReq +) → AnnotationQueueCreateRes ``` --- - + + +### method `annotation_queue_items_query` + +```python +annotation_queue_items_query( + req: AnnotationQueueItemsQueryReq +) → AnnotationQueueItemsQueryRes +``` + +--- + + + +### method `annotation_queue_read` + +```python +annotation_queue_read(req: AnnotationQueueReadReq) → AnnotationQueueReadRes +``` + +--- + + + +### method `annotation_queues_query_stream` + +```python +annotation_queues_query_stream( + req: AnnotationQueuesQueryReq +) → Iterator[AnnotationQueueSchema] +``` + +--- + + + +### method `annotation_queues_stats` + +```python +annotation_queues_stats( + req: AnnotationQueuesStatsReq +) → AnnotationQueuesStatsRes +``` + +--- + + + +### method `annotator_queue_items_progress_update` + +```python +annotator_queue_items_progress_update( + req: AnnotatorQueueItemsProgressUpdateReq +) → AnnotatorQueueItemsProgressUpdateRes +``` + +--- + + ### method `call_end` ```python -call_end(req: Union[CallEndReq, dict[str, Any]]) → CallEndRes +call_end(req: CallEndReq) → CallEndRes ``` --- - + ### method `call_read` ```python -call_read(req: Union[CallReadReq, dict[str, Any]]) → CallReadRes +call_read(req: CallReadReq) → CallReadRes ``` --- - + ### method `call_start` ```python -call_start(req: Union[CallStartReq, dict[str, Any]]) → CallStartRes +call_start(req: CallStartReq) → CallStartRes ``` --- - + ### method `call_start_batch` @@ -80,61 +162,57 @@ call_start_batch(req: CallCreateBatchReq) → CallCreateBatchRes --- - + ### method `call_update` ```python -call_update(req: Union[CallUpdateReq, dict[str, Any]]) → CallUpdateRes +call_update(req: CallUpdateReq) → CallUpdateRes ``` --- - + ### method `calls_delete` ```python -calls_delete(req: Union[CallsDeleteReq, dict[str, Any]]) → CallsDeleteRes +calls_delete(req: CallsDeleteReq) → CallsDeleteRes ``` --- - + ### method `calls_query` ```python -calls_query(req: Union[CallsQueryReq, dict[str, Any]]) → CallsQueryRes +calls_query(req: CallsQueryReq) → CallsQueryRes ``` --- - + ### method `calls_query_stats` ```python -calls_query_stats( - req: Union[CallsQueryStatsReq, dict[str, Any]] -) → CallsQueryStatsRes +calls_query_stats(req: CallsQueryStatsReq) → CallsQueryStatsRes ``` --- - + ### method `calls_query_stream` ```python -calls_query_stream( - req: Union[CallsQueryReq, dict[str, Any]] -) → Iterator[CallSchema] +calls_query_stream(req: CallsQueryReq) → Iterator[CallSchema] ``` --- - + ### method `completions_create` @@ -144,7 +222,7 @@ completions_create(req: CompletionsCreateReq) → CompletionsCreateRes --- - + ### method `completions_create_stream` @@ -154,37 +232,87 @@ completions_create_stream(req: CompletionsCreateReq) → Iterator[dict[str, Any] --- - + ### method `cost_create` ```python -cost_create(req: Union[CostCreateReq, dict[str, Any]]) → CostCreateRes +cost_create(req: CostCreateReq) → CostCreateRes ``` --- - + ### method `cost_purge` ```python -cost_purge(req: Union[CostPurgeReq, dict[str, Any]]) → CostPurgeRes +cost_purge(req: CostPurgeReq) → CostPurgeRes ``` --- - + ### method `cost_query` ```python -cost_query(req: Union[CostQueryReq, dict[str, Any]]) → CostQueryRes +cost_query(req: CostQueryReq) → CostQueryRes +``` + +--- + + + +### method `dataset_create` + +```python +dataset_create(req: DatasetCreateReq) → DatasetCreateRes +``` + +--- + + + +### method `dataset_delete` + +```python +dataset_delete(req: DatasetDeleteReq) → DatasetDeleteRes +``` + +--- + + + +### method `dataset_list` + +```python +dataset_list(req: DatasetListReq) → Iterator[DatasetReadRes] +``` + +--- + + + +### method `dataset_read` + +```python +dataset_read(req: DatasetReadReq) → DatasetReadRes ``` --- - + + +### method `delete` + +```python +delete(url: str, *args: Any, **kwargs: Any) → Response +``` + +--- + + ### method `ensure_project_exists` @@ -194,7 +322,7 @@ ensure_project_exists(entity: str, project: str) → EnsureProjectExistsRes --- - + ### method `evaluate_model` @@ -204,7 +332,97 @@ evaluate_model(req: EvaluateModelReq) → EvaluateModelRes --- - + + +### method `evaluation_create` + +```python +evaluation_create(req: EvaluationCreateReq) → EvaluationCreateRes +``` + +--- + + + +### method `evaluation_delete` + +```python +evaluation_delete(req: EvaluationDeleteReq) → EvaluationDeleteRes +``` + +--- + + + +### method `evaluation_list` + +```python +evaluation_list(req: EvaluationListReq) → Iterator[EvaluationReadRes] +``` + +--- + + + +### method `evaluation_read` + +```python +evaluation_read(req: EvaluationReadReq) → EvaluationReadRes +``` + +--- + + + +### method `evaluation_run_create` + +```python +evaluation_run_create(req: EvaluationRunCreateReq) → EvaluationRunCreateRes +``` + +--- + + + +### method `evaluation_run_delete` + +```python +evaluation_run_delete(req: EvaluationRunDeleteReq) → EvaluationRunDeleteRes +``` + +--- + + + +### method `evaluation_run_finish` + +```python +evaluation_run_finish(req: EvaluationRunFinishReq) → EvaluationRunFinishRes +``` + +--- + + + +### method `evaluation_run_list` + +```python +evaluation_run_list(req: EvaluationRunListReq) → Iterator[EvaluationRunReadRes] +``` + +--- + + + +### method `evaluation_run_read` + +```python +evaluation_run_read(req: EvaluationRunReadReq) → EvaluationRunReadRes +``` + +--- + + ### method `evaluation_status` @@ -214,19 +432,17 @@ evaluation_status(req: EvaluationStatusReq) → EvaluationStatusRes --- - + ### method `feedback_create` ```python -feedback_create( - req: Union[FeedbackCreateReq, dict[str, Any]] -) → FeedbackCreateRes +feedback_create(req: FeedbackCreateReq) → FeedbackCreateRes ``` --- - + ### method `feedback_create_batch` @@ -236,39 +452,37 @@ feedback_create_batch(req: FeedbackCreateBatchReq) → FeedbackCreateBatchRes --- - + ### method `feedback_purge` ```python -feedback_purge(req: Union[FeedbackPurgeReq, dict[str, Any]]) → FeedbackPurgeRes +feedback_purge(req: FeedbackPurgeReq) → FeedbackPurgeRes ``` --- - + ### method `feedback_query` ```python -feedback_query(req: Union[FeedbackQueryReq, dict[str, Any]]) → FeedbackQueryRes +feedback_query(req: FeedbackQueryReq) → FeedbackQueryRes ``` --- - + ### method `feedback_replace` ```python -feedback_replace( - req: Union[FeedbackReplaceReq, dict[str, Any]] -) → FeedbackReplaceRes +feedback_replace(req: FeedbackReplaceReq) → FeedbackReplaceRes ``` --- - + ### method `file_content_read` @@ -278,7 +492,7 @@ file_content_read(req: FileContentReadReq) → FileContentReadRes --- - + ### method `file_create` @@ -288,7 +502,7 @@ file_create(req: FileCreateReq) → FileCreateRes --- - + ### method `files_stats` @@ -298,17 +512,17 @@ files_stats(req: FilesStatsReq) → FilesStatsRes --- - + ### classmethod `from_env` ```python -from_env(should_batch: bool = False) → RemoteHTTPTraceServer +from_env(should_batch: bool = False) → Self ``` --- - + ### method `get` @@ -318,31 +532,31 @@ get(url: str, *args: Any, **kwargs: Any) → Response --- - + ### method `get_call_processor` ```python -get_call_processor() → Optional[AsyncBatchProcessor] +get_call_processor() → AsyncBatchProcessor | None ``` Custom method not defined on the formal TraceServerInterface to expose the underlying call processor. Should be formalized in a client-side interface. --- - + ### method `get_feedback_processor` ```python -get_feedback_processor() → Optional[AsyncBatchProcessor] +get_feedback_processor() → AsyncBatchProcessor | None ``` Custom method not defined on the formal TraceServerInterface to expose the underlying feedback processor. Should be formalized in a client-side interface. --- - + ### method `image_create` @@ -352,17 +566,57 @@ image_create(req: ImageGenerationCreateReq) → ImageGenerationCreateRes --- - + + +### method `model_create` + +```python +model_create(req: ModelCreateReq) → ModelCreateRes +``` + +--- + + + +### method `model_delete` + +```python +model_delete(req: ModelDeleteReq) → ModelDeleteRes +``` + +--- + + + +### method `model_list` + +```python +model_list(req: ModelListReq) → Iterator[ModelReadRes] +``` + +--- + + + +### method `model_read` + +```python +model_read(req: ModelReadReq) → ModelReadRes +``` + +--- + + ### method `obj_create` ```python -obj_create(req: Union[ObjCreateReq, dict[str, Any]]) → ObjCreateRes +obj_create(req: ObjCreateReq) → ObjCreateRes ``` --- - + ### method `obj_delete` @@ -372,57 +626,67 @@ obj_delete(req: ObjDeleteReq) → ObjDeleteRes --- - + ### method `obj_read` ```python -obj_read(req: Union[ObjReadReq, dict[str, Any]]) → ObjReadRes +obj_read(req: ObjReadReq) → ObjReadRes ``` --- - + ### method `objs_query` ```python -objs_query(req: Union[ObjQueryReq, dict[str, Any]]) → ObjQueryRes +objs_query(req: ObjQueryReq) → ObjQueryRes ``` --- - + ### method `op_create` ```python -op_create(req: Union[OpCreateReq, dict[str, Any]]) → OpCreateRes +op_create(req: OpCreateReq) → OpCreateRes ``` --- - + -### method `op_read` +### method `op_delete` ```python -op_read(req: Union[OpReadReq, dict[str, Any]]) → OpReadRes +op_delete(req: OpDeleteReq) → OpDeleteRes ``` --- - + -### method `ops_query` +### method `op_list` ```python -ops_query(req: Union[OpQueryReq, dict[str, Any]]) → OpQueryRes +op_list(req: OpListReq) → Iterator[OpReadRes] ``` --- - + + +### method `op_read` + +```python +op_read(req: OpReadReq) → OpReadRes +``` + +--- + + ### method `otel_export` @@ -432,7 +696,7 @@ otel_export(req: OtelExportReq) → OtelExportRes --- - + ### method `post` @@ -442,7 +706,57 @@ post(url: str, *args: Any, **kwargs: Any) → Response --- - + + +### method `prediction_create` + +```python +prediction_create(req: PredictionCreateReq) → PredictionCreateRes +``` + +--- + + + +### method `prediction_delete` + +```python +prediction_delete(req: PredictionDeleteReq) → PredictionDeleteRes +``` + +--- + + + +### method `prediction_finish` + +```python +prediction_finish(req: PredictionFinishReq) → PredictionFinishRes +``` + +--- + + + +### method `prediction_list` + +```python +prediction_list(req: PredictionListReq) → Iterator[PredictionReadRes] +``` + +--- + + + +### method `prediction_read` + +```python +prediction_read(req: PredictionReadReq) → PredictionReadRes +``` + +--- + + ### method `project_stats` @@ -452,17 +766,97 @@ project_stats(req: ProjectStatsReq) → ProjectStatsRes --- - + ### method `refs_read_batch` ```python -refs_read_batch(req: Union[RefsReadBatchReq, dict[str, Any]]) → RefsReadBatchRes +refs_read_batch(req: RefsReadBatchReq) → RefsReadBatchRes +``` + +--- + + + +### method `score_create` + +```python +score_create(req: ScoreCreateReq) → ScoreCreateRes +``` + +--- + + + +### method `score_delete` + +```python +score_delete(req: ScoreDeleteReq) → ScoreDeleteRes +``` + +--- + + + +### method `score_list` + +```python +score_list(req: ScoreListReq) → Iterator[ScoreReadRes] +``` + +--- + + + +### method `score_read` + +```python +score_read(req: ScoreReadReq) → ScoreReadRes +``` + +--- + + + +### method `scorer_create` + +```python +scorer_create(req: ScorerCreateReq) → ScorerCreateRes +``` + +--- + + + +### method `scorer_delete` + +```python +scorer_delete(req: ScorerDeleteReq) → ScorerDeleteRes +``` + +--- + + + +### method `scorer_list` + +```python +scorer_list(req: ScorerListReq) → Iterator[ScorerReadRes] +``` + +--- + + + +### method `scorer_read` + +```python +scorer_read(req: ScorerReadReq) → ScorerReadRes ``` --- - + ### method `server_info` @@ -472,7 +866,7 @@ server_info() → ServerInfoRes --- - + ### method `set_auth` @@ -482,23 +876,23 @@ set_auth(auth: tuple[str, str]) → None --- - + ### method `table_create` ```python -table_create(req: Union[TableCreateReq, dict[str, Any]]) → TableCreateRes +table_create(req: TableCreateReq) → TableCreateRes ``` --- - + ### method `table_create_from_digests` ```python table_create_from_digests( - req: Union[TableCreateFromDigestsReq, dict[str, Any]] + req: TableCreateFromDigestsReq ) → TableCreateFromDigestsRes ``` @@ -506,41 +900,37 @@ Create a table by specifying row digests instead of actual rows. --- - + ### method `table_query` ```python -table_query(req: Union[TableQueryReq, dict[str, Any]]) → TableQueryRes +table_query(req: TableQueryReq) → TableQueryRes ``` --- - + ### method `table_query_stats` ```python -table_query_stats( - req: Union[TableQueryStatsReq, dict[str, Any]] -) → TableQueryStatsRes +table_query_stats(req: TableQueryStatsReq) → TableQueryStatsRes ``` --- - + ### method `table_query_stats_batch` ```python -table_query_stats_batch( - req: Union[TableQueryStatsReq, dict[str, Any]] -) → TableQueryStatsRes +table_query_stats_batch(req: TableQueryStatsReq) → TableQueryStatsRes ``` --- - + ### method `table_query_stream` @@ -550,7 +940,7 @@ table_query_stream(req: TableQueryReq) → Iterator[TableRowSchema] --- - + ### method `table_update` @@ -562,7 +952,7 @@ Similar to `calls/batch_upsert`, we can dynamically adjust the payload size due --- - + ### method `threads_query_stream` diff --git a/weave/reference/python-sdk/weave/index.mdx b/weave/reference/python-sdk/weave/index.mdx deleted file mode 100644 index d46fe09319..0000000000 --- a/weave/reference/python-sdk/weave/index.mdx +++ /dev/null @@ -1,6825 +0,0 @@ ---- -title: weave ---- - -# weave - -## Functions - -### `as_op(fn: 'Callable[P, R]') -> 'Op[P, R]'` - -Given a @weave.op() decorated function, return its Op. - -@weave.op() decorated functions are instances of Op already, so this -function should be a no-op at runtime. But you can use it to satisfy type checkers -if you need to access OpDef attributes in a typesafe way. - -Args: - fn: A weave.op() decorated function. - -Returns: - The Op of the function. - -### `attributes(attributes: 'dict[str, Any]') -> 'Iterator'` - -Context manager for setting attributes on a call. - -Example: -```python -with weave.attributes({'env': 'production'}): - print(my_function.call("World")) -``` - -### `finish() -> 'None'` - -Stops logging to weave. - -Following finish, calls of weave.op() decorated functions will no longer be logged. You will need to run weave.init() again to resume logging. - -### `get(uri: 'str | ObjectRef') -> 'Any'` - -A convenience function for getting an object from a URI. - -Many objects logged by Weave are automatically registered with the Weave -server. This function allows you to retrieve those objects by their URI. - -Args: - uri: A fully-qualified weave ref URI. - -Returns: - The object. - -Example: -```python -weave.init("weave_get_example") -dataset = weave.Dataset(rows=[{"a": 1, "b": 2}]) -ref = weave.publish(dataset) - -dataset2 = weave.get(ref) # same as dataset! -``` - -### `get_client() -> 'weave_client.WeaveClient | None'` - -No description available. - -### `get_current_call() -> 'Call | None'` - -Get the Call object for the currently executing Op, within that Op. - -Returns: - The Call object for the currently executing Op, or - None if tracking has not been initialized or this method is - invoked outside an Op. - -Note: - The returned Call's ``attributes`` dictionary becomes immutable - once the call starts. Use :func:`weave.attributes` to set - call metadata before invoking an Op. The ``summary`` field may - be updated while the Op executes and will be merged with - computed summary information when the call finishes. - -### `init(project_name: 'str', *, settings: 'UserSettings | dict[str, Any] | None' = None, autopatch_settings: 'AutopatchSettings | None' = None, global_postprocess_inputs: 'PostprocessInputsFunc | None' = None, global_postprocess_output: 'PostprocessOutputFunc | None' = None, global_attributes: 'dict[str, Any] | None' = None) -> 'weave_client.WeaveClient'` - -Initialize weave tracking, logging to a wandb project. - -Logging is initialized globally, so you do not need to keep a reference -to the return value of init. - -Following init, calls of weave.op() decorated functions will be logged -to the specified project. - -Args: - project_name: The name of the Weights & Biases team and project to log to. If you don't - specify a team, your default entity is used. - To find or update your default entity, refer to [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team) in the W&B Models documentation. - settings: Configuration for the Weave client generally. - autopatch_settings: (Deprecated) Configuration for autopatch integrations. Use explicit patching instead. - global_postprocess_inputs: A function that will be applied to all inputs of all ops. - global_postprocess_output: A function that will be applied to all outputs of all ops. - global_attributes: A dictionary of attributes that will be applied to all traces. - -NOTE: Global postprocessing settings are applied to all ops after each op's own -postprocessing. The order is always: -1. Op-specific postprocessing -2. Global postprocessing - -Returns: - A Weave client. - -### `op(func: 'Callable[P, R] | None' = None, *, name: 'str | None' = None, call_display_name: 'str | CallDisplayNameFunc | None' = None, postprocess_inputs: 'PostprocessInputsFunc | None' = None, postprocess_output: 'PostprocessOutputFunc | None' = None, tracing_sample_rate: 'float' = 1.0, enable_code_capture: 'bool' = True, accumulator: 'Callable[[Any | None, Any], Any] | None' = None) -> 'Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]'` - -A decorator to weave op-ify a function or method. Works for both sync and async. -Automatically detects iterator functions and applies appropriate behavior. - -### `publish(obj: 'Any', name: 'str | None' = None) -> 'ObjectRef'` - -Save and version a Python object. - -Weave creates a new version of the object if the object's name already exists and its content hash does -not match the latest version of that object. - -Args: - obj: The object to save and version. - name: The name to save the object under. - -Returns: - A Weave Ref to the saved object. - -### `ref(location: 'str') -> 'ObjectRef'` - -Creates a Ref to an existing Weave object. This does not directly retrieve -the object but allows you to pass it to other Weave API functions. - -Args: - location: A Weave Ref URI, or if `weave.init()` has been called, `name:version` or `name`. If no version is provided, `latest` is used. - -Returns: - A Weave Ref to the object. - -### `require_current_call() -> 'Call'` - -Get the Call object for the currently executing Op, within that Op. - -This allows you to access attributes of the Call such as its id or feedback -while it is running. - -```python -@weave.op -def hello(name: str) -> None: - print(f"Hello {name}!") - current_call = weave.require_current_call() - print(current_call.id) -``` - -It is also possible to access a Call after the Op has returned. - -If you have the Call's id, perhaps from the UI, you can use the `get_call` method on the -`WeaveClient` returned from `weave.init` to retrieve the Call object. - -```python -client = weave.init("") -mycall = client.get_call("") -``` - -Alternately, after defining your Op you can use its `call` method. For example: - -```python -@weave.op -def add(a: int, b: int) -> int: - return a + b - -result, call = add.call(1, 2) -print(call.id) -``` - -Returns: - The Call object for the currently executing Op - -Raises: - NoCurrentCallError: If tracking has not been initialized or this method is - invoked outside an Op. - -### `set_view(name: 'str', content: 'Content | str', *, extension: 'str | None' = None, mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None, encoding: 'str' = 'utf-8') -> 'None'` - -Attach a custom view to the current call summary at `_weave.views.`. - -Args: - name: The view name (key under `summary._weave.views`). - content: A `weave.Content` instance or raw string. Strings are wrapped via - `Content.from_text` using the supplied extension or mimetype. - extension: Optional file extension to use when `content` is a string. - mimetype: Optional MIME type to use when `content` is a string. - metadata: Optional metadata to attach when creating `Content` from text. - encoding: Text encoding to apply when creating `Content` from text. - -Returns: - None - -Examples: - >>> import weave - >>> weave.init("proj") - >>> @weave.op - ... def foo(): - ... weave.set_view("readme", "# Hello", extension="md") - ... return 1 - >>> foo() - -### `thread(thread_id: 'str | None | object' = ) -> 'Iterator[ThreadContext]'` - -Context manager for setting thread_id on calls within the context. - -Examples: -```python -# Auto-generate thread_id -with weave.thread() as t: - print(f"Thread ID: {t.thread_id}") - result = my_function("input") # This call will have the auto-generated thread_id - print(f"Current turn: {t.turn_id}") - -# Explicit thread_id -with weave.thread("custom_thread") as t: - result = my_function("input") # This call will have thread_id="custom_thread" - -# Disable threading -with weave.thread(None) as t: - result = my_function("input") # This call will have thread_id=None -``` - -Args: - thread_id: The thread identifier to associate with calls in this context. - If not provided, a UUID v7 will be auto-generated. - If None, thread tracking will be disabled. - -Yields: - ThreadContext: An object providing access to thread_id and current turn_id. - -### `wandb_init_hook() -> None` - -No description available. - -## Classes - -### Agent - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `step(self, state: weave.agent.agent.AgentState) -> weave.agent.agent.AgentState` - -Run a step of the agent. - -Args: - state: The current state of the environment. - action: The action to take. - -Returns: - The new state of the environment. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### AgentState - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### AnnotationSpec - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `preprocess_field_schema(data: dict) -> dict` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -##### `validate_field_schema(schema: dict) -> dict` - -No description available. - -##### `value_is_valid(self, payload: Any) -> bool` - -Validates a payload against this annotation spec's schema. - -Args: - payload: The data to validate against the schema - -Returns: - bool: True if validation succeeds, False otherwise - -### Audio - -A class representing audio data in a supported format (wav or mp3). - -This class handles audio data storage and provides methods for loading from -different sources and exporting to files. - -Attributes: - format: The audio format (currently supports 'wav' or 'mp3') - data: The raw audio data as bytes - -Args: - data: The audio data (bytes or base64 encoded string) - format: The audio format ('wav' or 'mp3') - validate_base64: Whether to attempt base64 decoding of the input data - -Raises: - ValueError: If audio data is empty or format is not supported - -#### Methods - -##### `__init__(self, data: 'bytes', format: 'SUPPORTED_FORMATS_TYPE', validate_base64: 'bool' = True) -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -##### `export(self, path: 'str | bytes | Path | os.PathLike') -> 'None'` - -Export audio data to a file. - -Args: - path: Path where the audio file should be written - -##### `from_data(data: 'str | bytes', format: 'str') -> 'Audio'` - -Create an Audio object from raw data and specified format. - -Args: - data: Audio data as bytes or base64 encoded string - format: Audio format ('wav' or 'mp3') - -Returns: - Audio: A new Audio instance - -Raises: - ValueError: If format is not supported - -##### `from_path(path: 'str | bytes | Path | os.PathLike') -> 'Audio'` - -Create an Audio object from a file path. - -Args: - path: Path to an audio file (must have .wav or .mp3 extension) - -Returns: - Audio: A new Audio instance loaded from the file - -Raises: - ValueError: If file doesn't exist or has unsupported extension - -### Content - -A class to represent content from various sources, resolving them -to a unified byte-oriented representation with associated metadata. - -This class must be instantiated using one of its classmethods: -- from_path() -- from_bytes() -- from_text() -- from_url() -- from_base64() -- from_data_url() - -#### Methods - -##### `__init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'` - -Direct initialization is disabled. -Please use a classmethod like `Content.from_path()` to create an instance. - -##### `as_string(self) -> 'str'` - -Display the data as a string. Bytes are decoded using the `encoding` attribute -If base64, the data will be re-encoded to base64 bytes then decoded to an ASCII string -Returns: - str. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_base64(b64_data: 'str | bytes', /, extension: 'str | None' = None, mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None) -> 'Self'` - -Initializes Content from a base64 encoded string or bytes. - -##### `from_bytes(data: 'bytes', /, extension: 'str | None' = None, mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None, encoding: 'str' = 'utf-8') -> 'Self'` - -Initializes Content from raw bytes. - -##### `from_data_url(url: 'str', /, metadata: 'dict[str, Any] | None' = None) -> 'Self'` - -Initializes Content from a data URL. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_path(path: 'str | Path', /, encoding: 'str' = 'utf-8', mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None) -> 'Self'` - -Initializes Content from a local file path. - -##### `from_text(text: 'str', /, extension: 'str | None' = None, mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None, encoding: 'str' = 'utf-8') -> 'Self'` - -Initializes Content from a string of text. - -##### `from_url(url: 'str', /, headers: 'dict[str, Any] | None' = None, timeout: 'int | None' = 30, metadata: 'dict[str, Any] | None' = None) -> 'Self'` - -Initializes Content by fetching bytes from an HTTP(S) URL. - -Downloads the content, infers mimetype/extension from headers, URL path, -and data, and constructs a Content object from the resulting bytes. - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `init_private_attributes(self: 'BaseModel', context: 'Any', /) -> 'None'` - -This function is meant to behave like a BaseModel method to initialise private attributes. - -It takes context as an argument since that's what pydantic-core passes when calling it. - -Args: - self: The BaseModel instance. - context: The context. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'dict[str, Any] | None' = None) -> 'Self'` - -Override model_validate to handle Content reconstruction from dict. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'dict[str, Any] | None' = None) -> 'Self'` - -Override model_validate_json to handle Content reconstruction from JSON. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `open(self) -> 'bool'` - -Open the file using the operating system's default application. - -This method uses the platform-specific mechanism to open the file with -the default application associated with the file's type. - -Returns: - bool: True if the file was successfully opened, False otherwise. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `save(self, dest: 'str | Path') -> 'None'` - -Copy the file to the specified destination path. -Updates the filename and the path of the content to reflect the last saved copy. - -Args: - dest: Destination path where the file will be copied to (string or pathlib.Path) - The destination path can be a file or a directory. - If dest has no file extension (e.g. .txt), destination will be considered a directory. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `serialize_data(self, data: 'bytes') -> 'str'` - -When dumping model in json mode - -##### `to_data_url(self, use_base64: 'bool' = True) -> 'str'` - -Constructs a data URL from the content. - -Args: - use_base64: If True, the data will be base64 encoded. - Otherwise, it will be percent-encoded. Defaults to True. - -Returns: - A data URL string. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Dataset - -Dataset object with easy saving and automatic versioning. - -Examples: -```python -# Create a dataset -dataset = Dataset(name='grammar', rows=[ - {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."}, - {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."}, - {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."} -]) - -# Publish the dataset -weave.publish(dataset) - -# Retrieve the dataset -dataset_ref = weave.ref('grammar').get() - -# Access a specific example -example_label = dataset_ref.rows[2]['sentence'] -``` - -#### Methods - -##### `__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. - -##### `add_rows(self, rows: collections.abc.Iterable) -> 'Dataset'` - -Create a new dataset version by appending rows to the existing dataset. - -This is useful for adding examples to large datasets without having to -load the entire dataset into memory. - -Args: - rows: The rows to add to the dataset. - -Returns: - The updated dataset. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description available. - -##### `convert_to_table(rows: Any) -> Union[weave.trace.table.Table, weave.trace.vals.WeaveTable]` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_calls(calls: collections.abc.Iterable) -> typing_extensions.Self` - -No description available. - -##### `from_hf(hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')]) -> typing_extensions.Self` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_pandas(df: 'pd.DataFrame') -> typing_extensions.Self` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `select(self, indices: collections.abc.Iterable) -> typing_extensions.Self` - -Select rows from the dataset based on the provided indices. - -Args: - indices: An iterable of integer indices specifying which rows to select. - -Returns: - A new Dataset object containing only the selected rows. - -##### `to_hf(self) -> 'HFDataset'` - -No description available. - -##### `to_pandas(self) -> 'pd.DataFrame'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EasyPrompt - -A more or less complete user-defined wrapper around list objects. - -#### Methods - -##### `__init__(self, content: Union[str, dict, list, NoneType] = None, *, role: Optional[str] = None, dedent: bool = False, **kwargs: Any) -> None` - -Initialize self. See help(type(self)) for accurate signature. - -##### `append(self, item: Any, role: Optional[str] = None, dedent: bool = False) -> None` - -S.append(value) -- append value to the end of the sequence - -##### `as_dict(self) -> dict` - -No description available. - -##### `as_pydantic_dict(self) -> dict` - -No description available. - -##### `bind(self, *args: Any, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `bind_rows(self, dataset: Union[list[dict], Any]) -> list` - -No description available. - -##### `clear(self)` - -S.clear() -> None -- remove all items from S - -##### `config_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -##### `configure(self, config: Optional[dict] = None, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description available. - -##### `copy(self)` - -No description available. - -##### `count(self, item)` - -S.count(value) -> integer -- return number of occurrences of value - -##### `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 description available. - -##### `dump(self, fp: ) -> None` - -No description available. - -##### `dump_file(self, filepath: Union[str, pathlib.Path]) -> None` - -No description available. - -##### `extend(self, other)` - -S.extend(iterable) -- extend sequence by appending elements from the iterable - -##### `format(self, **kwargs: Any) -> Any` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `index(self, item, *args)` - -S.index(value, [start, [stop]]) -> integer -- return first index of value. -Raises ValueError if the value is not present. - -Supporting start and stop arguments is optional, but -recommended. - -##### `insert(self, i, item)` - -S.insert(index, value) -- insert value before index - -##### `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 description available. - -##### `load(fp: ) -> typing_extensions.Self` - -No description available. - -##### `load_file(filepath: Union[str, pathlib.Path]) -> typing_extensions.Self` - -No description available. - -##### `messages_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `init_private_attributes(self: 'BaseModel', context: 'Any', /) -> 'None'` - -This function is meant to behave like a BaseModel method to initialise private attributes. - -It takes context as an argument since that's what pydantic-core passes when calling it. - -Args: - self: The BaseModel instance. - context: The context. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `pop(self, i=-1)` - -S.pop([index]) -> item -- remove and return item at index (default last). -Raise IndexError if list is empty or index is out of range. - -##### `print(self) -> str` - -No description available. - -##### `publish(self, name: Optional[str] = None) -> weave.trace.refs.ObjectRef` - -No description available. - -##### `remove(self, item)` - -S.remove(value) -- remove first occurrence of value. -Raise ValueError if the value is not present. - -##### `require(self, param_name: str, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `reverse(self)` - -S.reverse() -- reverse *IN PLACE* - -##### `run(self) -> Any` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `sort(self, /, *args, **kwds)` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -##### `validate_requirement(self, key: str, value: Any) -> list` - -No description available. - -##### `validate_requirements(self, values: dict) -> list` - -No description available. - -##### `values_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -### Evaluation - -Sets up an evaluation which includes a set of scorers and a dataset. - -Calling evaluation.evaluate(model) will pass in rows from a dataset into a model matching - the names of the columns of the dataset to the argument names in model.predict. - -Then it will call all of the scorers and save the results in weave. - -If you want to preprocess the rows from the dataset you can pass in a function -to preprocess_model_input. - -Examples: -```python -# Collect your examples -examples = [ - {"question": "What is the capital of France?", "expected": "Paris"}, - {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"}, - {"question": "What is the square root of 64?", "expected": "8"}, -] - -# Define any custom scoring function -@weave.op() -def match_score1(expected: str, model_output: dict) -> dict: - # Here is where you'd define the logic to score the model output - return {'match': expected == model_output['generated_text']} - -@weave.op() -def function_to_evaluate(question: str): - # here's where you would add your LLM call and return the output - return {'generated_text': 'Paris'} - -# Score your examples using scoring functions -evaluation = Evaluation( - dataset=examples, scorers=[match_score1] -) - -# Start tracking the evaluation -weave.init('intro-example') -# Run the evaluation -asyncio.run(evaluation.evaluate(function_to_evaluate)) -``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `evaluate(self, model: Union[weave.trace.op_protocol.Op, weave.flow.model.Model]) -> dict` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `get_eval_results(self, model: Union[weave.trace.op_protocol.Op, weave.flow.model.Model]) -> weave.evaluation.eval.EvaluationResults` - -No description available. - -##### `get_evaluate_calls(self) -> weave.utils.paginated_iterator.PaginatedIterator[weave.trace_server.trace_server_interface.CallSchema, weave.trace.vals.WeaveObject]` - -Retrieve all evaluation calls that used this Evaluation object. - -Note that this returns a CallsIter instead of a single call because it's -possible to have multiple evaluation calls for a single evaluation (e.g. -if you run the same evaluation multiple times). - -Returns: - CallsIter: An iterator over Call objects representing evaluation runs. - -Raises: - ValueError: If the evaluation has no ref (hasn't been saved/run yet). - -Examples: - ```python - evaluation = Evaluation(dataset=examples, scorers=[scorer]) - await evaluation.evaluate(model) # Run evaluation first - calls = evaluation.get_evaluate_calls() - for call in calls: - print(f"Evaluation run: {call.id} at {call.started_at}") - ``` - -##### `get_score_calls(self) -> dict` - -Retrieve scorer calls for each evaluation run, grouped by trace ID. - -Returns: - dict[str, list[Call]]: A dictionary mapping trace IDs to lists of scorer Call objects. - Each trace ID represents one evaluation run, and the list contains all scorer - calls executed during that run. - -Examples: - ```python - evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) - await evaluation.evaluate(model) - score_calls = evaluation.get_score_calls() - for trace_id, calls in score_calls.items(): - print(f"Trace {trace_id}: {len(calls)} scorer calls") - for call in calls: - scorer_name = call.summary.get("weave", {}).get("trace_name") - print(f" Scorer: {scorer_name}, Output: {call.output}") - ``` - -##### `get_scores(self) -> dict` - -Extract and organize scorer outputs from evaluation runs. - -Returns: - dict[str, dict[str, list[Any]]]: A nested dictionary structure where: - - First level keys are trace IDs (evaluation runs) - - Second level keys are scorer names - - Values are lists of scorer outputs for that run and scorer - -Examples: - ```python - evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer]) - await evaluation.evaluate(model) - scores = evaluation.get_scores() - # Access scores by trace and scorer - for trace_id, trace_scores in scores.items(): - print(f"Evaluation run {trace_id}:") - for scorer_name, outputs in trace_scores.items(): - print(f" {scorer_name}: {outputs}") - ``` - - Expected output: - - ``` - { - "trace_123": { - "accuracy_scorer": [{"accuracy": 0.85}], - "f1_scorer": [{"f1": 0.78}] - } - } - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `model_post_init(self, _Evaluation__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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `predict_and_score(self, model: Union[weave.trace.op_protocol.Op, weave.flow.model.Model], example: dict) -> dict` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `summarize(self, eval_table: weave.evaluation.eval.EvaluationResults) -> dict` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationLogger - -This class provides an imperative interface for logging evaluations. - -An evaluation is started automatically when the first prediction is logged -using the `log_prediction` method, and finished when the `log_summary` method -is called. - -Each time you log a prediction, you will get back a `ScoreLogger` object. -You can use this object to log scores and metadata for that specific -prediction. For more information, see the `ScoreLogger` class. - -Basic usage - log predictions with inputs and outputs directly: - -```python -ev = EvaluationLogger() - -# Log predictions with known inputs/outputs -pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'}) -pred.log_score("correctness", 0.9) - -# Finish the evaluation -ev.log_summary({"avg_score": 0.9}) -``` - -Advanced usage - use context manager for dynamic outputs and nested operations: - -```python -ev = EvaluationLogger() - -# Use context manager when you need to capture nested operations -with ev.log_prediction(inputs={'q': 'Hello'}) as pred: - # Any operations here (like LLM calls) automatically become - # children of the predict call - response = your_llm_call(...) - pred.output = response.content - pred.log_score("correctness", 0.9) - -# Finish the evaluation -ev.log_summary({"avg_score": 0.9}) -``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `fail(self, exception: 'BaseException') -> 'None'` - -Convenience method to fail the evaluation with an exception. - -##### `finish(self, exception: 'BaseException | None' = None) -> 'None'` - -Clean up the evaluation resources explicitly without logging a summary. - -Ensures all prediction calls and the main evaluation call are finalized. -This is automatically called if the logger is used as a context manager. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `log_prediction(self, inputs: 'dict[str, Any]', output: 'Any | _NotSetType' = ) -> 'ScoreLogger | _LogPredictionContext'` - -Log a prediction to the Evaluation. - -If output is provided, returns a ScoreLogger for direct use. -If output is not provided, returns a PredictionContext for use as a context manager. - -Args: - inputs: The input data for the prediction - output: The output value. If not provided, use as context manager to set later. - -Returns: - ScoreLogger if output provided, PredictionContext if not. - -Example (direct): - pred = ev.log_prediction(\{'q': '...'\}, output="answer") - pred.log_score("correctness", 0.9) - pred.finish() - -Example (context manager): - with ev.log_prediction(\{'q': '...'\}) as pred: - response = model(...) - pred.output = response - pred.log_score("correctness", 0.9) - -##### `log_summary(self, summary: 'dict | None' = None, auto_summarize: 'bool' = True) -> 'None'` - -Log a summary dict to the Evaluation. - -This will calculate the summary, call the summarize op, and then finalize -the evaluation, meaning no more predictions or scores can be logged. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `model_post_init(self, _EvaluationLogger__context: 'Any') -> 'None'` - -Initialize the pseudo evaluation with the dataset from the model. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `set_view(self, name: 'str', content: 'Content | str', *, extension: 'str | None' = None, mimetype: 'str | None' = None, metadata: 'dict[str, Any] | None' = None, encoding: 'str' = 'utf-8') -> 'None'` - -Attach a view to the evaluation's main call summary under `weave.views`. - -Saves the provided content as an object in the project and writes its -reference URI under `summary.weave.views.` for the evaluation's -`evaluate` call. String inputs are wrapped as text content using -`Content.from_text` with the provided extension or mimetype. - -Args: - name: The view name to display, used as the key under `summary.weave.views`. - content: A `weave.Content` instance or string to serialize. - extension: Optional file extension for string content inputs. - mimetype: Optional MIME type for string content inputs. - metadata: Optional metadata attached to newly created `Content`. - encoding: Text encoding for string content inputs. - -Returns: - None - -Examples: - >>> import weave - >>> ev = weave.EvaluationLogger() - >>> ev.set_view("report", "# Report", extension="md") - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### File - -A class representing a file with path, mimetype, and size information. - -#### Methods - -##### `__init__(self, path: 'str | Path', mimetype: 'str | None' = None)` - -Initialize a File object. - -Args: - path: Path to the file (string or pathlib.Path) - mimetype: Optional MIME type of the file - will be inferred from extension if not provided - -##### `open(self) -> 'bool'` - -Open the file using the operating system's default application. - -This method uses the platform-specific mechanism to open the file with -the default application associated with the file's type. - -Returns: - bool: True if the file was successfully opened, False otherwise. - -##### `save(self, dest: 'str | Path') -> 'None'` - -Copy the file to the specified destination path. - -Args: - dest: Destination path where the file will be copied to (string or pathlib.Path) - The destination path can be a file or a directory. - -### Markdown - -A Markdown renderable. - -Args: - markup (str): A string containing markdown. - code_theme (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes. - justify (JustifyMethod, optional): Justify value for paragraphs. Defaults to None. - style (Union[str, Style], optional): Optional style to apply to markdown. - hyperlinks (bool, optional): Enable hyperlinks. Defaults to ``True``. - inline_code_lexer: (str, optional): Lexer to use if inline code highlighting is - enabled. Defaults to None. - inline_code_theme: (Optional[str], optional): Pygments theme for inline code - highlighting, or None for no highlighting. Defaults to None. - -#### Methods - -##### `__init__(self, markup: 'str', code_theme: 'str' = 'monokai', justify: 'JustifyMethod | None' = None, style: 'str | Style' = 'none', hyperlinks: 'bool' = True, inline_code_lexer: 'str | None' = None, inline_code_theme: 'str | None' = None) -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -### MessagesPrompt - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__init__(self, messages: list)` - -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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `format(self, **kwargs: Any) -> list` - -No description available. - -##### `format_message(self, message: dict, **kwargs: Any) -> dict` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Model - -Intended to capture a combination of code and data the operates on an input. -For example it might call an LLM with a prompt to make a prediction or generate -text. - -When you change the attributes or the code that defines your model, these changes -will be logged and the version will be updated. This ensures that you can compare -the predictions across different versions of your model. Use this to iterate on -prompts or to try the latest LLM and compare predictions across different settings - -Examples: -```python -class YourModel(Model): - attribute1: str - attribute2: int - - @weave.op() - def predict(self, input_data: str) -> dict: - # Model logic goes here - prediction = self.attribute1 + ' ' + input_data - return {'pred': prediction} -``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `get_infer_method(self) -> Callable` - -No description available. - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Monitor - -Sets up a monitor to score incoming calls automatically. - -Examples: -```python -import weave -from weave.scorers import ValidJSONScorer - -json_scorer = ValidJSONScorer() - -my_monitor = weave.Monitor( - name="my-monitor", - description="This is a test monitor", - sampling_rate=0.5, - op_names=["my_op"], - query={ - "$expr": { - "$gt": [ - { - "$getField": "started_at" - }, - { - "$literal": 1742540400 - } - ] - } - } - }, - scorers=[json_scorer], -) - -my_monitor.activate() -``` - -#### Methods - -##### `__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. - -##### `activate(self) -> weave.trace.refs.ObjectRef` - -Activates the monitor. - -Returns: - The ref to the monitor. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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. - -##### `deactivate(self) -> weave.trace.refs.ObjectRef` - -Deactivates the monitor. - -Returns: - The ref to the monitor. - -##### `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 description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Object - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjectRef - -ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `delete(self) -> 'None'` - -No description available. - -##### `get(self, *, objectify: 'bool' = True) -> 'Any'` - -No description available. - -##### `is_descended_from(self, potential_ancestor: 'ObjectRef') -> 'bool'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'ObjectRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -##### `with_attr(self, attr: 'str') -> 'Self'` - -No description available. - -##### `with_extra(self, extra: 'tuple[str | Future[str], ...]') -> 'Self'` - -No description available. - -##### `with_index(self, index: 'int') -> 'Self'` - -No description available. - -##### `with_item(self, item_digest: 'str | Future[str]') -> 'Self'` - -No description available. - -##### `with_key(self, key: 'str') -> 'Self'` - -No description available. - -### P - -A more or less complete user-defined wrapper around list objects. - -#### Methods - -##### `__init__(self, content: Union[str, dict, list, NoneType] = None, *, role: Optional[str] = None, dedent: bool = False, **kwargs: Any) -> None` - -Initialize self. See help(type(self)) for accurate signature. - -##### `append(self, item: Any, role: Optional[str] = None, dedent: bool = False) -> None` - -S.append(value) -- append value to the end of the sequence - -##### `as_dict(self) -> dict` - -No description available. - -##### `as_pydantic_dict(self) -> dict` - -No description available. - -##### `bind(self, *args: Any, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `bind_rows(self, dataset: Union[list[dict], Any]) -> list` - -No description available. - -##### `clear(self)` - -S.clear() -> None -- remove all items from S - -##### `config_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -##### `configure(self, config: Optional[dict] = None, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description available. - -##### `copy(self)` - -No description available. - -##### `count(self, item)` - -S.count(value) -> integer -- return number of occurrences of value - -##### `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 description available. - -##### `dump(self, fp: ) -> None` - -No description available. - -##### `dump_file(self, filepath: Union[str, pathlib.Path]) -> None` - -No description available. - -##### `extend(self, other)` - -S.extend(iterable) -- extend sequence by appending elements from the iterable - -##### `format(self, **kwargs: Any) -> Any` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `index(self, item, *args)` - -S.index(value, [start, [stop]]) -> integer -- return first index of value. -Raises ValueError if the value is not present. - -Supporting start and stop arguments is optional, but -recommended. - -##### `insert(self, i, item)` - -S.insert(index, value) -- insert value before index - -##### `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 description available. - -##### `load(fp: ) -> typing_extensions.Self` - -No description available. - -##### `load_file(filepath: Union[str, pathlib.Path]) -> typing_extensions.Self` - -No description available. - -##### `messages_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `init_private_attributes(self: 'BaseModel', context: 'Any', /) -> 'None'` - -This function is meant to behave like a BaseModel method to initialise private attributes. - -It takes context as an argument since that's what pydantic-core passes when calling it. - -Args: - self: The BaseModel instance. - context: The context. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `pop(self, i=-1)` - -S.pop([index]) -> item -- remove and return item at index (default last). -Raise IndexError if list is empty or index is out of range. - -##### `print(self) -> str` - -No description available. - -##### `publish(self, name: Optional[str] = None) -> weave.trace.refs.ObjectRef` - -No description available. - -##### `remove(self, item)` - -S.remove(value) -- remove first occurrence of value. -Raise ValueError if the value is not present. - -##### `require(self, param_name: str, **kwargs: Any) -> 'Prompt'` - -No description available. - -##### `reverse(self)` - -S.reverse() -- reverse *IN PLACE* - -##### `run(self) -> Any` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `sort(self, /, *args, **kwds)` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -##### `validate_requirement(self, key: str, value: Any) -> list` - -No description available. - -##### `validate_requirements(self, values: dict) -> list` - -No description available. - -##### `values_table(self, title: Optional[str] = None) -> weave.trace.display.display.Table` - -No description available. - -### Prompt - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `format(self, **kwargs: Any) -> Any` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### SavedView - -A fluent-style class for working with SavedView objects. - -#### Methods - -##### `__init__(self, view_type: 'str' = 'traces', label: 'str' = 'SavedView') -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -##### `add_column(self, path: 'str | ObjectPath', label: 'str | None' = None) -> 'SavedView'` - -No description available. - -##### `add_columns(self, *columns: 'str') -> 'SavedView'` - -Convenience method for adding multiple columns to the grid. - -##### `add_filter(self, field: 'str', operator: 'str', value: 'Any | None' = None) -> 'SavedView'` - -No description available. - -##### `add_sort(self, field: 'str', direction: 'SortDirection') -> 'SavedView'` - -No description available. - -##### `column_index(self, path: 'int | str | ObjectPath') -> 'int'` - -No description available. - -##### `filter_op(self, op_name: 'str | None') -> 'SavedView'` - -No description available. - -##### `get_calls(self, limit: 'int | None' = None, offset: 'int | None' = None, include_costs: 'bool' = False, include_feedback: 'bool' = False, all_columns: 'bool' = False) -> 'CallsIter'` - -Get calls matching this saved view's filters and settings. - -##### `get_known_columns(self, *, num_calls_to_query: 'int | None' = None) -> 'list[str]'` - -Get the set of columns that are known to exist. - -##### `get_table_columns(self) -> 'list[TableColumn]'` - -No description available. - -##### `hide_column(self, col_name: 'str') -> 'SavedView'` - -No description available. - -##### `insert_column(self, idx: 'int', path: 'str | ObjectPath', label: 'str | None' = None) -> 'SavedView'` - -No description available. - -##### `load(ref: 'str') -> 'SavedView'` - -No description available. - -##### `page_size(self, page_size: 'int') -> 'SavedView'` - -No description available. - -##### `pin_column_left(self, col_name: 'str') -> 'SavedView'` - -No description available. - -##### `pin_column_right(self, col_name: 'str') -> 'SavedView'` - -No description available. - -##### `remove_column(self, path: 'int | str | ObjectPath') -> 'SavedView'` - -No description available. - -##### `remove_columns(self, *columns: 'str') -> 'SavedView'` - -Remove columns from the saved view. - -##### `remove_filter(self, index_or_field: 'int | str') -> 'SavedView'` - -No description available. - -##### `remove_filters(self) -> 'SavedView'` - -Remove all filters from the saved view. - -##### `rename(self, label: 'str') -> 'SavedView'` - -No description available. - -##### `rename_column(self, path: 'int | str | ObjectPath', label: 'str') -> 'SavedView'` - -No description available. - -##### `save(self) -> 'SavedView'` - -Publish the saved view to the server. - -##### `set_columns(self, *columns: 'str') -> 'SavedView'` - -Set the columns to be displayed in the grid. - -##### `show_column(self, col_name: 'str') -> 'SavedView'` - -No description available. - -##### `sort_by(self, field: 'str', direction: 'SortDirection') -> 'SavedView'` - -No description available. - -##### `to_grid(self, limit: 'int | None' = None) -> 'Grid'` - -No description available. - -##### `to_rich_table_str(self) -> 'str'` - -No description available. - -##### `ui_url(self) -> 'str | None'` - -URL to show this saved view in the UI. - -Note this is the "result" page with traces etc, not the URL for the view object. - -##### `unpin_column(self, col_name: 'str') -> 'SavedView'` - -No description available. - -### Scorer - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `model_post_init(self, _Scorer__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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `score(self, *, output: Any, **kwargs: Any) -> Any` - -No description available. - -##### `summarize(self, score_rows: list) -> Optional[dict]` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### StringPrompt - -Base class for Weave objects that can be tracked and versioned. - -This class extends Pydantic's BaseModel to provide Weave-specific functionality -for object tracking, referencing, and serialization. Objects can have names, -descriptions, and references that allow them to be stored and retrieved from -the Weave system. - -Attributes: - name (Optional[str]): A human-readable name for the object. - description (Optional[str]): A description of what the object represents. - ref (Optional[ObjectRef]): A reference to the object in the Weave system. - -Examples: - ```python - # Create a simple object - obj = Object(name="my_object", description="A test object") - - # Create an object from a URI - obj = Object.from_uri("weave:///entity/project/object:digest") - ``` - -#### Methods - -##### `__init__(self, content: str)` - -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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `format(self, **kwargs: Any) -> str` - -No description available. - -##### `from_obj(obj: weave.trace.vals.WeaveObject) -> typing_extensions.Self` - -No description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description available. - -##### `from_uri(uri: str, *, objectify: bool = True) -> typing_extensions.Self` - -Create an object instance from a Weave URI. - -Args: - uri (str): The Weave URI pointing to the object. - objectify (bool): Whether to objectify the result. Defaults to True. - -Returns: - Self: An instance of the class created from the URI. - -Raises: - NotImplementedError: If the class doesn't implement the required - methods for deserialization. - -Examples: - ```python - obj = MyObject.from_uri("weave:///entity/project/object:digest") - ``` - -##### `handle_relocatable_object(v: Any, handler: pydantic_core.core_schema.ValidatorFunctionWrapHandler, info: pydantic_core.core_schema.ValidationInfo) -> Any` - -Handle validation of relocatable objects including ObjectRef and WeaveObject. - -This validator handles special cases where the input is an ObjectRef or -WeaveObject that needs to be properly converted to a standard Object instance. -It ensures that references are preserved and that ignored types are handled -correctly during the validation process. - -Args: - v (Any): The value to validate. - handler (ValidatorFunctionWrapHandler): The standard pydantic validation handler. - info (ValidationInfo): Validation context information. - -Returns: - Any: The validated object instance. - -Examples: - This method is called automatically during object creation and validation. - It handles cases like: - ```python - # When an ObjectRef is passed - obj = MyObject(some_object_ref) - - # When a WeaveObject is passed - obj = MyObject(some_weave_object) - ``` - -##### `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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Table - -No description available. - -#### Methods - -##### `__init__(self, rows: 'list[dict]') -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -##### `append(self, row: 'dict') -> 'None'` - -Add a row to the table. - -##### `pop(self, index: 'int') -> 'None'` - -Remove a row at the given index from the table. - -### Thread - -A Thread that runs functions with the context of the caller. - -This is a drop-in replacement for threading.Thread that ensures calls behave -as expected inside the thread. Weave requires certain contextvars to be set -(see call_context.py), but new threads do not automatically copy context from -the parent, which can cause the call context to be lost -- not good! This -class automates contextvar copying so using this thread "just works" as the -user probably expects. - -You can achieve the same effect without this class by instead writing: - -```python -def run_with_context(func, *args, **kwargs): - context = copy_context() - def wrapper(): - context.run(func, *args, **kwargs) - return wrapper - -thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs)) -thread.start() -``` - -#### Methods - -##### `__init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'` - -This constructor should always be called with keyword arguments. Arguments are: - -*group* should be None; reserved for future extension when a ThreadGroup -class is implemented. - -*target* is the callable object to be invoked by the run() -method. Defaults to None, meaning nothing is called. - -*name* is the thread name. By default, a unique name is constructed of -the form "Thread-N" where N is a small decimal number. - -*args* is the argument tuple for the target invocation. Defaults to (). - -*kwargs* is a dictionary of keyword arguments for the target -invocation. Defaults to \{\}. - -If a subclass overrides the constructor, it must make sure to invoke -the base class constructor (Thread.__init__()) before doing anything -else to the thread. - -##### `getName(self)` - -No description available. - -##### `isDaemon(self)` - -No description available. - -##### `is_alive(self)` - -Return whether the thread is alive. - -This method returns True just before the run() method starts until just -after the run() method terminates. See also the module function -enumerate(). - -##### `join(self, timeout=None)` - -Wait until the thread terminates. - -This blocks the calling thread until the thread whose join() method is -called terminates -- either normally or through an unhandled exception -or until the optional timeout occurs. - -When the timeout argument is present and not None, it should be a -floating point number specifying a timeout for the operation in seconds -(or fractions thereof). As join() always returns None, you must call -is_alive() after join() to decide whether a timeout happened -- if the -thread is still alive, the join() call timed out. - -When the timeout argument is not present or None, the operation will -block until the thread terminates. - -A thread can be join()ed many times. - -join() raises a RuntimeError if an attempt is made to join the current -thread as that would cause a deadlock. It is also an error to join() a -thread before it has been started and attempts to do so raises the same -exception. - -##### `run(self) -> 'None'` - -Method representing the thread's activity. - -You may override this method in a subclass. The standard run() method -invokes the callable object passed to the object's constructor as the -target argument, if any, with sequential and keyword arguments taken -from the args and kwargs arguments, respectively. - -##### `setDaemon(self, daemonic)` - -No description available. - -##### `setName(self, name)` - -No description available. - -##### `start(self)` - -Start the thread's activity. - -It must be called at most once per thread object. It arranges for the -object's run() method to be invoked in a separate thread of control. - -This method will raise a RuntimeError if called more than once on the -same thread object. - -### ThreadContext - -Context object providing access to current thread and turn information. - -#### Methods - -##### `__init__(self, thread_id: 'str | None')` - -Initialize ThreadContext with the specified thread_id. - -Args: - thread_id: The thread identifier for this context, or None if disabled. - -### ThreadPoolExecutor - -A ThreadPoolExecutor that runs functions with the context of the caller. - -This is a drop-in replacement for concurrent.futures.ThreadPoolExecutor that -ensures weave calls behave as expected inside the executor. Weave requires -certain contextvars to be set (see call_context.py), but new threads do not -automatically copy context from the parent, which can cause the call context -to be lost -- not good! This class automates contextvar copying so using -this executor "just works" as the user probably expects. - -You can achieve the same effect without this class by instead writing: - -```python -with concurrent.futures.ThreadPoolExecutor() as executor: - contexts = [copy_context() for _ in range(len(vals))] - - def _wrapped_fn(*args): - return contexts.pop().run(fn, *args) - - executor.map(_wrapped_fn, vals) -``` - -#### Methods - -##### `__init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'` - -Initializes a new ThreadPoolExecutor instance. - -Args: - max_workers: The maximum number of threads that can be used to - execute the given calls. - thread_name_prefix: An optional name prefix to give our threads. - initializer: A callable used to initialize worker threads. - initargs: A tuple of arguments to pass to the initializer. - -##### `map(self, fn: 'Callable', *iterables: 'Iterable[Any]', timeout: 'float | None' = None, chunksize: 'int' = 1) -> 'Iterator'` - -Returns an iterator equivalent to map(fn, iter). - -Args: - fn: A callable that will take as many arguments as there are - passed iterables. - timeout: The maximum number of seconds to wait. If None, then there - is no limit on the wait time. - chunksize: The size of the chunks the iterable will be broken into - before being passed to a child process. This argument is only - used by ProcessPoolExecutor; it is ignored by - ThreadPoolExecutor. - -Returns: - An iterator equivalent to: map(func, *iterables) but the calls may - be evaluated out-of-order. - -Raises: - TimeoutError: If the entire result iterator could not be generated - before the given timeout. - Exception: If fn(*args) raises for any values. - -##### `shutdown(self, wait=True, *, cancel_futures=False)` - -Clean-up the resources associated with the Executor. - -It is safe to call this method several times. Otherwise, no other -methods can be called after this one. - -Args: - wait: If True then shutdown will not return until all running - futures have finished executing and the resources used by the - executor have been reclaimed. - cancel_futures: If True then shutdown will cancel all pending - futures. Futures that are completed or running will not be - cancelled. - -##### `submit(self, fn: 'Callable', *args: 'Any', **kwargs: 'Any') -> 'Any'` - -Submits a callable to be executed with the given arguments. - -Schedules the callable to be executed as fn(*args, **kwargs) and returns -a Future instance representing the execution of the callable. - -Returns: - A Future representing the given call. - diff --git a/weave/reference/python-sdk/weave/trace/op.mdx b/weave/reference/python-sdk/weave/trace/op.mdx deleted file mode 100644 index 5730ce6609..0000000000 --- a/weave/reference/python-sdk/weave/trace/op.mdx +++ /dev/null @@ -1,553 +0,0 @@ ---- -title: weave.trace.op ---- - -# weave.trace.op - -## Functions - -### `TypedDict(typename, fields=None, /, *, total=True, **kwargs)` - -A simple typed namespace. At runtime it is equivalent to a plain dict. - -TypedDict creates a dictionary type that expects all of its -instances to have a certain set of keys, where each key is -associated with a value of a consistent type. This expectation -is not checked at runtime but is only enforced by type checkers. -Usage:: - - class Point2D(TypedDict): - x: int - y: int - label: str - - a: Point2D = \{'x': 1, 'y': 2, 'label': 'good'\} # OK - b: Point2D = \{'z': 3, 'label': 'bad'\} # Fails type check - - assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first') - -The type info can be accessed via the Point2D.__annotations__ dict, and -the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. -TypedDict supports two additional equivalent forms:: - - Point2D = TypedDict('Point2D', x=int, y=int, label=str) - Point2D = TypedDict('Point2D', \{'x': int, 'y': int, 'label': str\}) - -By default, all keys must be present in a TypedDict. It is possible -to override this by specifying totality. -Usage:: - - class point2D(TypedDict, total=False): - x: int - y: int - -This means that a point2D TypedDict can have any of the keys omitted.A type -checker is only expected to support a literal False or True as the value of -the total argument. True is the default, and makes all items defined in the -class body be required. - -The class syntax is only supported in Python 3.6+, while two other -syntax forms work for Python 2.7 and 3.2+ - -### `aiter(obj: 'AsyncIterator[V]') -> 'AsyncIterator[V]'` - -No description available. - -### `anext(obj: 'AsyncIterator[V]', default: 'V | None' = None) -> 'V'` - -No description available. - -### `as_op(fn: 'Callable[P, R]') -> 'Op[P, R]'` - -Given a @weave.op() decorated function, return its Op. - -@weave.op() decorated functions are instances of Op already, so this -function should be a no-op at runtime. But you can use it to satisfy type checkers -if you need to access OpDef attributes in a typesafe way. - -Args: - fn: A weave.op() decorated function. - -Returns: - The Op of the function. - -### `call(op: 'Op', *args: 'Any', __weave: 'WeaveKwargs | None' = None, __should_raise: 'bool' = False, __require_explicit_finish: 'bool' = False, **kwargs: 'Any') -> 'tuple[Any, Call] | Coroutine[Any, Any, tuple[Any, Call]]'` - -Executes the op and returns both the result and a Call representing the execution. - -This function will never raise. Any errors are captured in the Call object. - -This method is automatically bound to any function decorated with `@weave.op`, -allowing for usage like: - -```python -@weave.op -def add(a: int, b: int) -> int: - return a + b - -result, call = add.call(1, 2) -``` - -### `calls(op: 'Op') -> 'CallsIter'` - -Get an iterator over all calls to this op. - -This method is automatically bound to any function decorated with `@weave.op`, -allowing for usage like: - -```python -@weave.op -def add(a: int, b: int) -> int: - return a + b - -calls = add.calls() -for call in calls: - print(call) -``` - -### `cast(typ, val)` - -Cast a value to a type. - -This returns the value unchanged. To the type checker this -signals that the return value has the designated type, but at -runtime we intentionally don't check anything (we want this -to be as fast as possible). - -### `dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)` - -Returns the same class as was passed in, with dunder methods -added based on the fields defined in the class. - -Examines PEP 526 __annotations__ to determine fields. - -If init is true, an __init__() method is added to the class. If -repr is true, a __repr__() method is added. If order is true, rich -comparison dunder methods are added. If unsafe_hash is true, a -__hash__() method function is added. If frozen is true, fields may -not be assigned to after instance creation. - -### `get_captured_code(op: 'Op') -> 'str'` - -Get the captured code of the op. - -This only works when you get an op back from a ref. The pattern is: - -ref = weave.publish(func) -op = ref.get() -captured_code = op.get_captured_code() - -### `get_raise_on_captured_errors() -> bool` - -No description available. - -### `get_tracing_enabled() -> 'bool'` - -No description available. - -### `is_op(obj: 'Any') -> 'TypeIs[Op]'` - -Check if an object is an Op. - -### `is_placeholder_call(call: 'Call') -> 'TypeIs[NoOpCall]'` - -No description available. - -### `is_tracing_setting_disabled() -> 'bool'` - -No description available. - -### `log_once(log_method: 'Callable[[str], None]', message: 'str') -> 'None'` - -Logs a message once, suppressing subsequent messages of the same type. This -is useful for notifying the user about errors without spamming the logs. - -This is mostly useful for cases where the same error message might occur many times. -For example, if an op fails to save, it is likely going to happen every time that op is -called. Or, if we have an error in our patched iterator, then it likely happens every time -we iterate over the result. This allows use to inform the user about the error without -clogging up their logs. - -Args: - log_method: The method to use to log the message. This should accept a string argument. - message: The message to log. - -Example: -```python -log_once(logger.error, "Failed to save op") -``` - -### `maybe_bind_method(func: 'Callable', self: 'Any' = None) -> 'Callable | MethodType'` - -Bind a function to any object (even if it's not a class). - -If self is None, return the function as is. - -### `maybe_unbind_method(oplike: 'Op | MethodType | partial') -> 'Op'` - -Unbind an Op-like method or partial to a plain Op function. - -For: -- methods, remove set `self` param -- partials, remove any preset params - -### `op(func: 'Callable[P, R] | None' = None, *, name: 'str | None' = None, call_display_name: 'str | CallDisplayNameFunc | None' = None, postprocess_inputs: 'PostprocessInputsFunc | None' = None, postprocess_output: 'PostprocessOutputFunc | None' = None, tracing_sample_rate: 'float' = 1.0, enable_code_capture: 'bool' = True, accumulator: 'Callable[[Any | None, Any], Any] | None' = None) -> 'Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]'` - -A decorator to weave op-ify a function or method. Works for both sync and async. -Automatically detects iterator functions and applies appropriate behavior. - -### `overload(func)` - -Decorator for overloaded functions/methods. - -In a stub file, place two or more stub definitions for the same -function in a row, each decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - -In a non-stub file (i.e. a regular .py file), do the same but -follow it with an implementation. The implementation should *not* -be decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - def utf8(value): - # implementation goes here - -### `placeholder_call() -> 'Call'` - -No description available. - -### `setup_dunder_weave_dict(d: 'WeaveKwargs | None' = None) -> 'WeaveKwargs'` - -Sets up a __weave dict used to pass WeaveKwargs to ops. - -### `should_skip_tracing_for_op(op: 'Op') -> 'bool'` - -No description available. - -### `tracing_disabled() -> 'Iterator[None]'` - -No description available. - -### `wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',))` - -Decorator factory to apply update_wrapper() to a wrapper function - -Returns a decorator that invokes update_wrapper() with the decorated -function as the wrapper argument and the arguments to wraps() as the -remaining arguments. Default arguments are as for update_wrapper(). -This is a convenience function to simplify applying partial() to -update_wrapper(). - -## Classes - -### AsyncGenerator - -No description available. - -#### Methods - -##### `aclose(self)` - -Raise GeneratorExit inside coroutine. - - -##### `asend(self, value)` - -Send a value into the asynchronous generator. -Return next yielded value or raise StopAsyncIteration. - -##### `athrow(self, typ, val=None, tb=None)` - -Raise an exception in the asynchronous generator. -Return next yielded value or raise StopAsyncIteration. - -### AsyncIterator - -No description available. - -### Coroutine - -No description available. - -#### Methods - -##### `close(self)` - -Raise GeneratorExit inside coroutine. - - -##### `send(self, value)` - -Send a value into the coroutine. -Return next yielded value or raise StopIteration. - -##### `throw(self, typ, val=None, tb=None)` - -Raise an exception in the coroutine. -Return next yielded value or raise StopIteration. - -### DisplayNameFuncError - -Inappropriate argument value (of correct type). - -### Generator - -No description available. - -#### Methods - -##### `close(self)` - -Raise GeneratorExit inside generator. - - -##### `send(self, value)` - -Send a value into the generator. -Return next yielded value or raise StopIteration. - -##### `throw(self, typ, val=None, tb=None)` - -Raise an exception in the generator. -Return next yielded value or raise StopIteration. - -### Generic - -Abstract base class for generic types. - -A generic type is typically declared by inheriting from -this class parameterized with one or more type variables. -For example, a generic mapping type might be defined as:: - - class Mapping(Generic[KT, VT]): - def __getitem__(self, key: KT) -> VT: - ... - # Etc. - -This class can then be used as follows:: - - def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: - try: - return mapping[key] - except KeyError: - return default - -### Iterator - -No description available. - -### Mapping - -No description available. - -#### Methods - -##### `get(self, key, default=None)` - -D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - -##### `items(self)` - -D.items() -> a set-like object providing a view on D's items - -##### `keys(self)` - -D.keys() -> a set-like object providing a view on D's keys - -##### `values(self)` - -D.values() -> an object providing a view on D's values - -### MethodType - -method(function, instance) - -Create a bound instance method object. - -### Op - -The interface for Op-ified functions and methods. - -Op was previously a class, and has been converted to a Protocol to allow -functions to pass for Op. This is needed because many popular packages are -using the `inspect` module for control flow, and Op instances don't always -pass those checks. In particular, `inspect.iscoroutinefunction` always -fails for classes, even ones that implement async methods or protocols. - -Some of the attributes are carry-overs from when Op was a class. We should -consider removing the unnecessary ones where possible. -- resolve_fn (I think you can just use the func itself?) -- _set_on_output_handler (does this have to be on the op?) -- _on_output_handler (does this have to be on the op?) - -#### Methods - -##### `_no_init(self, *args, **kwargs)` - -No description available. - -### OpCallError - -Common base class for all non-exit exceptions. - -### ParamSpec - -Parameter specification variable. - -Usage:: - - P = ParamSpec('P') - -Parameter specification variables exist primarily for the benefit of static -type checkers. They are used to forward the parameter types of one -callable to another callable, a pattern commonly found in higher order -functions and decorators. They are only valid when used in ``Concatenate``, -or s the first argument to ``Callable``. In Python 3.10 and higher, -they are also supported in user-defined Generics at runtime. -See class Generic for more information on generic types. An -example for annotating a decorator:: - - T = TypeVar('T') - P = ParamSpec('P') - - def add_logging(f: Callable[P, T]) -> Callable[P, T]: - '''A type-safe decorator to add logging to a function.''' - def inner(*args: P.args, **kwargs: P.kwargs) -> T: - logging.info(f'\{f.__name__\} was called') - return f(*args, **kwargs) - return inner - - @add_logging - def add_two(x: float, y: float) -> float: - '''Add two numbers together.''' - return x + y - -Parameter specification variables defined with covariant=True or -contravariant=True can be used to declare covariant or contravariant -generic types. These keyword arguments are valid, but their actual semantics -are yet to be decided. See PEP 612 for details. - -Parameter specification variables can be introspected. e.g.: - - P.__name__ == 'T' - P.__bound__ == None - P.__covariant__ == False - P.__contravariant__ == False - -Note that only parameter specification variables defined in global scope can -be pickled. - -#### Methods - -##### `__init__(self, name, *, bound=None, covariant=False, contravariant=False, infer_variance=False, default=typing_extensions.NoDefault)` - -Initialize self. See help(type(self)) for accurate signature. - -### ProcessedInputs - -ProcessedInputs(original_args: 'tuple', original_kwargs: 'dict[str, Any]', args: 'tuple', kwargs: 'dict[str, Any]', inputs: 'dict[str, Any]') - -#### Methods - -##### `__init__(self, original_args: 'tuple', original_kwargs: 'dict[str, Any]', args: 'tuple', kwargs: 'dict[str, Any]', inputs: 'dict[str, Any]') -> None` - -No description available. - -### Sentinel - -Sentinel(package: 'str', path: 'str', name: 'str') - -#### Methods - -##### `__init__(self, package: 'str', path: 'str', name: 'str') -> None` - -No description available. - -### TypeVar - -Type variable. - -Usage:: - - T = TypeVar('T') # Can be anything - A = TypeVar('A', str, bytes) # Must be str or bytes - -Type variables exist primarily for the benefit of static type -checkers. They serve as the parameters for generic types as well -as for generic function definitions. See class Generic for more -information on generic types. Generic functions work as follows: - - def repeat(x: T, n: int) -> List[T]: - '''Return a list containing n references to x.''' - return [x]*n - - def longest(x: A, y: A) -> A: - '''Return the longest of two strings.''' - return x if len(x) >= len(y) else y - -The latter example's signature is essentially the overloading -of (str, str) -> str and (bytes, bytes) -> bytes. Also note -that if the arguments are instances of some subclass of str, -the return type is still plain str. - -At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError. - -Type variables defined with covariant=True or contravariant=True -can be used to declare covariant or contravariant generic types. -See PEP 484 for more details. By default generic types are invariant -in all type variables. - -Type variables can be introspected. e.g.: - - T.__name__ == 'T' - T.__constraints__ == () - T.__covariant__ == False - T.__contravariant__ = False - A.__constraints__ == (str, bytes) - -Note that only type variables defined in global scope can be pickled. - -#### Methods - -##### `__init__(self, name, *constraints, bound=None, covariant=False, contravariant=False)` - -Initialize self. See help(type(self)) for accurate signature. - -### WeaveKwargs - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### defaultdict - -defaultdict(default_factory=None, /, [...]) --> dict with default factory - -The default factory is called without arguments to produce -a new value when a key is not present, in __getitem__ only. -A defaultdict compares equal to a dict with the same items. -All remaining arguments are treated the same as if they were -passed to the dict constructor, including keyword arguments. - -### partial - -partial(func, *args, **keywords) - new function with partial application -of the given arguments and keywords. - diff --git a/weave/reference/python-sdk/weave/trace/weave_client.mdx b/weave/reference/python-sdk/weave/trace/weave_client.mdx deleted file mode 100644 index f553b56786..0000000000 --- a/weave/reference/python-sdk/weave/trace/weave_client.mdx +++ /dev/null @@ -1,11749 +0,0 @@ ---- -title: weave.trace.weave_client ---- - -# weave.trace.weave_client - -## Functions - -### `TypedDict(typename, fields=None, /, *, total=True, **kwargs)` - -A simple typed namespace. At runtime it is equivalent to a plain dict. - -TypedDict creates a dictionary type that expects all of its -instances to have a certain set of keys, where each key is -associated with a value of a consistent type. This expectation -is not checked at runtime but is only enforced by type checkers. -Usage:: - - class Point2D(TypedDict): - x: int - y: int - label: str - - a: Point2D = \{'x': 1, 'y': 2, 'label': 'good'\} # OK - b: Point2D = \{'z': 3, 'label': 'bad'\} # Fails type check - - assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first') - -The type info can be accessed via the Point2D.__annotations__ dict, and -the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. -TypedDict supports two additional equivalent forms:: - - Point2D = TypedDict('Point2D', x=int, y=int, label=str) - Point2D = TypedDict('Point2D', \{'x': int, 'y': int, 'label': str\}) - -By default, all keys must be present in a TypedDict. It is possible -to override this by specifying totality. -Usage:: - - class point2D(TypedDict, total=False): - x: int - y: int - -This means that a point2D TypedDict can have any of the keys omitted.A type -checker is only expected to support a literal False or True as the value of -the total argument. True is the default, and makes all items defined in the -class body be required. - -The class syntax is only supported in Python 3.6+, while two other -syntax forms work for Python 2.7 and 3.2+ - -### `as_op(fn: 'Callable[P, R]') -> 'Op[P, R]'` - -Given a @weave.op() decorated function, return its Op. - -@weave.op() decorated functions are instances of Op already, so this -function should be a no-op at runtime. But you can use it to satisfy type checkers -if you need to access OpDef attributes in a typesafe way. - -Args: - fn: A weave.op() decorated function. - -Returns: - The Op of the function. - -### `cast(typ, val)` - -Cast a value to a type. - -This returns the value unchanged. To the type checker this -signals that the return value has the designated type, but at -runtime we intentionally don't check anything (we want this -to be as fast as possible). - -### `check_endpoint_exists(func: Callable, test_req: Any, cache_key: Optional[str] = None) -> bool` - -Check if a function/endpoint exists and works by calling it with a test request. - -This allows bypassing retry logic by passing the unwrapped function directly, -or testing any callable with consistent caching and error handling. - -Args: - func: The function to test (e.g., server.table_create_from_digests or - server._generic_request_executor.__wrapped__) - test_req: A test request to use for checking the function - cache_key: Optional cache key. If not provided, uses id(func) - -Returns: - True if function exists and works, False otherwise - -### `check_wandb_run_matches(wandb_run_id: 'str | None', weave_entity: 'str', weave_project: 'str') -> 'None'` - -No description available. - -### `client_parallelism() -> Optional[int]` - -No description available. - -### `dataclass_object_record(obj: 'Any') -> 'ObjectRecord'` - -No description available. - -### `deprecated(new_name: 'str') -> 'Callable[[Callable[..., Any]], Callable[..., Any]]'` - -Decorator to mark a function as deprecated and redirect users to `new_name`. - -### `elide_display_name(name: 'str') -> 'str'` - -No description available. - -### `exception_to_json_str(exception: 'BaseException') -> 'str'` - -No description available. - -### `exists_expr(expr: Union[weave.trace_server.interface.query.LiteralOperation, weave.trace_server.interface.query.GetFieldOperator, weave.trace_server.interface.query.ConvertOperation, weave.trace_server.interface.query.AndOperation, weave.trace_server.interface.query.OrOperation, weave.trace_server.interface.query.NotOperation, weave.trace_server.interface.query.EqOperation, weave.trace_server.interface.query.GtOperation, weave.trace_server.interface.query.GteOperation, weave.trace_server.interface.query.InOperation, weave.trace_server.interface.query.ContainsOperation]) -> weave.trace_server.interface.query.NotOperation` - -No description available. - -### `from_json(obj: 'Any', project_id: 'str', server: 'TraceServerInterface') -> 'Any'` - -No description available. - -### `generate_id() -> str` - -Should be used to generate IDs for trace calls. -We use UUIDv7, which has a timestamp prefix, so that the IDs, while random, -are sortable by time. See RFC9562 https://www.rfc-editor.org/rfc/rfc9562. - -Random space is 2^74, which is less than 2^122 (UUIDv4), but still plenty -for our use case. - -### `get_field_expr(field: str) -> weave.trace_server.interface.query.GetFieldOperator` - -No description available. - -### `get_obj_name(val: 'Any') -> 'str'` - -No description available. - -### `get_parallelism_settings() -> 'tuple[int | None, int | None]'` - -No description available. - -### `get_ref(obj: 'Any') -> 'ObjectRef | None'` - -No description available. - -### `get_serializer_for_obj(obj: 'Any') -> 'Serializer | None'` - -No description available. - -### `is_op(obj: 'Any') -> 'TypeIs[Op]'` - -Check if an object is an Op. - -### `is_placeholder_call(call: 'Call') -> 'TypeIs[NoOpCall]'` - -No description available. - -### `is_tracing_setting_disabled() -> 'bool'` - -No description available. - -### `isinstance_namedtuple(obj: 'Any') -> 'bool'` - -No description available. - -### `literal_expr(value: Any) -> weave.trace_server.interface.query.LiteralOperation` - -No description available. - -### `make_client_call(entity: 'str', project: 'str', server_call: 'CallSchema', server: 'TraceServerInterface') -> 'WeaveObject'` - -No description available. - -### `make_trace_obj(val: Any, new_ref: Optional[weave.trace.refs.RefWithExtra], server: weave.trace_server.trace_server_interface.TraceServerInterface, root: Optional[weave.trace.vals.Traceable], parent: Any = None) -> Any` - -No description available. - -### `map_to_refs(obj: 'Any') -> 'Any'` - -No description available. - -### `maybe_objectify(obj: 'WeaveObject') -> 'T_co | WeaveObject'` - -No description available. - -### `maybe_unbind_method(oplike: 'Op | MethodType | partial') -> 'Op'` - -Unbind an Op-like method or partial to a plain Op function. - -For: -- methods, remove set `self` param -- partials, remove any preset params - -### `op(func: 'Callable[P, R] | None' = None, *, name: 'str | None' = None, call_display_name: 'str | CallDisplayNameFunc | None' = None, postprocess_inputs: 'PostprocessInputsFunc | None' = None, postprocess_output: 'PostprocessOutputFunc | None' = None, tracing_sample_rate: 'float' = 1.0, enable_code_capture: 'bool' = True, accumulator: 'Callable[[Any | None, Any], Any] | None' = None) -> 'Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]'` - -A decorator to weave op-ify a function or method. Works for both sync and async. -Automatically detects iterator functions and applies appropriate behavior. - -### `placeholder_call() -> 'Call'` - -No description available. - -### `print_call_link(call: 'Call') -> 'None'` - -No description available. - -### `pydantic_object_record(obj: 'BaseModel') -> 'ObjectRecord'` - -No description available. - -### `redact_sensitive_keys(obj: 'Any') -> 'Any'` - -No description available. - -### `remove_ref(obj: 'Any') -> 'None'` - -No description available. - -### `runnable_feedback_output_selector(name: str) -> str` - -No description available. - -### `runnable_feedback_runnable_ref_selector(name: str) -> str` - -No description available. - -### `safe_current_wb_run_id() -> 'str | None'` - -No description available. - -### `safe_current_wb_run_step() -> 'int | None'` - -No description available. - -### `sanitize_object_name(name: 'str') -> 'str'` - -No description available. - -### `set_ref(obj: 'Any', ref: 'Ref | None') -> 'None'` - -Try to set the ref on "any" object. - -We use increasingly complex methods to try to set the ref -to support different kinds of objects. This will still -fail for python primitives, but those can't be traced anyway. - -### `should_capture_client_info() -> bool` - -No description available. - -### `should_capture_system_info() -> bool` - -No description available. - -### `should_print_call_link() -> bool` - -No description available. - -### `should_redact(key: str) -> bool` - -Return whether a given key should be redacted. - -Args: - key: The key name to check. - -Returns: - True if the key is configured to be redacted (case-insensitive), False otherwise. - -Examples: - >>> from weave.utils import sanitize - >>> sanitize.should_redact("API_KEY") - True - >>> sanitize.should_redact("random_key") - False - -### `should_redact_pii() -> bool` - -No description available. - -### `should_skip_tracing_for_op(op: 'Op') -> 'bool'` - -No description available. - -### `should_use_parallel_table_upload() -> bool` - -Returns whether parallel table upload chunking should be used. - -### `sum_dict_leaves(dicts: list) -> dict` - -Recursively combines multiple dictionaries by summing their leaf values. - -This function takes a list of dictionaries and combines them by: -1. For non-dict values: extending lists or summing numbers -2. For nested dictionaries: recursively combining them - -Args: - dicts: A list of dictionaries to combine - -Returns: - A single dictionary with combined values - -Examples: - >>> # Combining status counts from multiple runs - >>> dicts = [ - ... \{"status_counts": \{"SUCCESS": 5, "FAILED": 1\}\}, - ... \{"status_counts": \{"SUCCESS": 3, "FAILED": 2, "PENDING": 1\}\} - ... ] - >>> sum_dict_leaves(dicts) - \{'status_counts': \{'SUCCESS': 8, 'FAILED': 3, 'PENDING': 1\}\} - - >>> # Combining metrics with nested structure - >>> dicts = [ - ... \{"metrics": \{"accuracy": 0.95, "loss": 0.1, "details": \{"precision": 0.9, "recall": 0.8\}\}\}, - ... \{"metrics": \{"accuracy": 0.97, "loss": 0.08, "details": \{"precision": 0.92, "f1": 0.85\}\}\} - ... ] - >>> sum_dict_leaves(dicts) - \{'metrics': \{'accuracy': 1.92, 'loss': 0.18, 'details': \{'precision': 1.82, 'recall': 0.8, 'f1': 0.85\}\}\} - -### `to_json(obj: 'Any', project_id: 'str', client: 'WeaveClient', use_dictify: 'bool' = False) -> 'Any'` - -No description available. - -### `zip_dicts(base_dict: dict, new_dict: dict) -> dict` - -No description available. - -## Classes - -### AttributesDict - -A dict representing the attributes of a call. - -The ``weave`` key is reserved for internal use and cannot be set directly. -Attributes become immutable once the call is created. Any attempt to modify -the dictionary after call start will raise :class:`TypeError`. Use the -:func:`weave.attributes` context manager or the ``attributes`` parameter of -:meth:`WeaveClient.create_call` to supply metadata before the call begins. - -#### Methods - -##### `__init__(self, **kwargs: Any) -> None` - -Initialize self. See help(type(self)) for accurate signature. - -##### `freeze(self) -> None` - -No description available. - -##### `unwrap(self) -> dict` - -No description available. - -##### `update(self, *args: Any, **kwargs: Any) -> None` - -D.update([E, ]**F) -> None. Update D from dict/iterable E and F. -If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] -If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v -In either case, this is followed by: for k in F: D[k] = F[k] - -### Call - -A Call represents a single operation executed as part of a trace. - -``attributes`` are frozen once the call is created. Use -:func:`weave.attributes` or ``create_call(..., attributes=...)`` to -populate metadata beforehand. The ``summary`` dictionary may be -modified while the call is running; its contents are deep-merged -with computed summary values when :meth:`WeaveClient.finish_call` -is invoked. - -#### Methods - -##### `__init__(self, _op_name: 'str | Future[str]', trace_id: 'str', project_id: 'str', parent_id: 'str | None', inputs: 'dict[str, Any]', id: 'str | None' = None, output: 'Any' = None, exception: 'str | None' = None, summary: 'dict[str, Any] | None' = , _display_name: 'str | Callable[[Call], str] | None' = None, attributes: 'dict[str, Any] | None' = None, started_at: 'datetime.datetime | None' = None, ended_at: 'datetime.datetime | None' = None, deleted_at: 'datetime.datetime | None' = None, thread_id: 'str | None' = None, turn_id: 'str | None' = None, wb_run_id: 'str | None' = None, wb_run_step: 'int | None' = None, wb_run_step_end: 'int | None' = None, _children: 'list[Call]' = , _feedback: 'RefFeedbackQuery | None' = None) -> None` - -No description available. - -##### `apply_scorer(self, scorer: 'Op | Scorer', additional_scorer_kwargs: 'dict[str, Any] | None' = None) -> 'ApplyScorerResult'` - -`apply_scorer` is a method that applies a Scorer to a Call. This is useful -for guarding application logic with a scorer and/or monitoring the quality -of critical ops. Scorers are automatically logged to Weave as Feedback and -can be used in queries & analysis. - -Args: - scorer: The Scorer to apply. - additional_scorer_kwargs: Additional kwargs to pass to the scorer. This is - useful for passing in additional context that is not part of the call - inputs.useful for passing in additional context that is not part of the call - inputs. - -Returns: - The result of the scorer application in the form of an `ApplyScorerResult`. - -```python -class ApplyScorerSuccess: - result: Any - score_call: Call -``` - -Example usage: - -```python -my_scorer = ... # construct a scorer -prediction, prediction_call = my_op.call(input_data) -result, score_call = prediction.apply_scorer(my_scorer) -``` - -##### `children(self, *, page_size: 'int' = 1000) -> 'CallsIter'` - -Get the children of the call. - -Args: - page_size: Tune performance by changing the number of calls fetched at a time. - -Returns: - An iterator of calls. - -##### `delete(self) -> 'bool'` - -Delete the call. - -##### `remove_display_name(self) -> 'None'` - -No description available. - -##### `set_display_name(self, name: 'str | None') -> 'None'` - -Set the display name for the call. - -Args: - name: The display name to set for the call. - -Example: -```python -result, call = my_function.call("World") -call.set_display_name("My Custom Display Name") -``` - -##### `to_dict(self) -> 'CallDict'` - -No description available. - -### CallEndReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallRef - -CallRef(entity: 'str', project: 'str', id: 'str', _extra: 'tuple[str | Future[str], ...]' = ()) - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', id: 'str', _extra: 'tuple[str | Future[str], ...]' = ()) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'CallRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -##### `with_attr(self, attr: 'str') -> 'Self'` - -No description available. - -##### `with_extra(self, extra: 'tuple[str | Future[str], ...]') -> 'Self'` - -No description available. - -##### `with_index(self, index: 'int') -> 'Self'` - -No description available. - -##### `with_item(self, item_digest: 'str | Future[str]') -> 'Self'` - -No description available. - -##### `with_key(self, key: 'str') -> 'Self'` - -No description available. - -### CallStartReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallUpdateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsDeleteReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Chat - -No description available. - -#### Methods - -##### `__init__(self, client: 'WeaveClient')` - -This class exists to mirror openai.resources.chat.chat.Chat -so we can have a drop-in compatible client.chat.completions.create call. - -### ChunkingConfig - -Configuration for table chunking behavior. - -#### Methods - -##### `__init__(self, use_chunking: bool, use_parallel_chunks: bool) -> None` - -No description available. - -### CostCreateInput - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostPurgeReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostQueryOutput - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EndedCallSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `serialize_typed_dicts(self, v: dict) -> dict` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackQuery - -Lazy-loading object for fetching feedback from the server. - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', query: 'Query', offset: 'int | None' = None, limit: 'int | None' = None, show_refs: 'bool' = False)` - -Initialize self. See help(type(self)) for accurate signature. - -##### `execute(self) -> 'Feedbacks'` - -No description available. - -##### `refresh(self) -> 'Feedbacks'` - -No description available. - -##### `refs(self) -> 'Refs'` - -No description available. - -### FileCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FileCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FlushStatus - -Status information about the current flush operation. - -### Future - -Represents the result of an asynchronous computation. - -#### Methods - -##### `__init__(self)` - -Initializes the future. Should not be called by clients. - -##### `add_done_callback(self, fn)` - -Attaches a callable that will be called when the future finishes. - -Args: - fn: A callable that will be called with this future as its only - argument when the future completes or is cancelled. The callable - will always be called by a thread in the same process in which - it was added. If the future has already completed or been - cancelled then the callable will be called immediately. These - callables are called in the order that they were added. - -##### `cancel(self)` - -Cancel the future if possible. - -Returns True if the future was cancelled, False otherwise. A future -cannot be cancelled if it is running or has already completed. - -##### `cancelled(self)` - -Return True if the future was cancelled. - -##### `done(self)` - -Return True of the future was cancelled or finished executing. - -##### `exception(self, timeout=None)` - -Return the exception raised by the call that the future represents. - -Args: - timeout: The number of seconds to wait for the exception if the - future isn't done. If None, then there is no limit on the wait - time. - -Returns: - The exception raised by the call that the future represents or None - if the call completed without raising. - -Raises: - CancelledError: If the future was cancelled. - TimeoutError: If the future didn't finish executing before the given - timeout. - -##### `result(self, timeout=None)` - -Return the result of the call that the future represents. - -Args: - timeout: The number of seconds to wait for the result if the future - isn't done. If None, then there is no limit on the wait time. - -Returns: - The result of the call that the future represents. - -Raises: - CancelledError: If the future was cancelled. - TimeoutError: If the future didn't finish executing before the given - timeout. - Exception: If the call raised then that exception will be raised. - -##### `running(self)` - -Return True if the future is currently executing. - -##### `set_exception(self, exception)` - -Sets the result of the future as being the given exception. - -Should only be used by Executor implementations and unit tests. - -##### `set_result(self, result)` - -Sets the return value of work associated with the future. - -Should only be used by Executor implementations and unit tests. - -##### `set_running_or_notify_cancel(self)` - -Mark the future as running or process any cancel notifications. - -Should only be used by Executor implementations and unit tests. - -If the future has been cancelled (cancel() was called and returned -True) then any threads waiting on the future completing (though calls -to as_completed() or wait()) are notified and False is returned. - -If the future was not cancelled then it is put in the running state -(future calls to running() will return True) and True is returned. - -This method should be called by Executor implementations before -executing the work associated with this future. If this method returns -False then the work should not be executed. - -Returns: - False if the Future was cancelled, True otherwise. - -Raises: - RuntimeError: if this method was already called or if set_result() - or set_exception() was called. - -### FutureExecutor - -A utility for thread-local threadpool execution and promise-like chaining. - -This class provides a thread-safe way to submit and execute jobs asynchronously -using thread-local ThreadPoolExecutors. It ensures proper shutdown of the executors when the -object is deleted or when the program exits. - -Args: - max_workers (Optional[int]): The maximum number of worker threads to use per executor. - Defaults to None. If set to 0, all tasks will be executed - directly in the current thread. - thread_name_prefix (str): The prefix for thread names. Defaults to "WeaveThreadPool". - -#### Methods - -##### `__init__(self, max_workers: 'int | None' = None, thread_name_prefix: 'str' = 'WeaveThreadPool')` - -Initialize self. See help(type(self)) for accurate signature. - -##### `defer(self, f: 'Callable[..., T]', *args: 'Any', **kwargs: 'Any') -> 'Future[T]'` - -Defer a function to be executed in a thread pool. - -This is useful for long-running or I/O-bound functions where the result is not needed immediately. - -Args: - f (Callable[..., T]): The function to be executed. - *args: Positional arguments to pass to the function. - **kwargs: Keyword arguments to pass to the function. - -Returns: - Future[T]: A Future object representing the eventual result of the function. - -##### `flush(self, timeout: 'float | None' = None) -> 'bool'` - -Block until all currently submitted items are complete or timeout is reached. - -This method allows new submissions while waiting, ensuring that -submitted jobs can enqueue more items if needed to complete. - -Args: - timeout (Optional[float]): Maximum time to wait in seconds. If None, wait indefinitely. - -Returns: - bool: True if all tasks completed - -Raises: - RuntimeError: If called from within a thread context. - TimeoutError: If the timeout is reached. - -##### `then(self, futures: 'list[Future[T]]', g: 'Callable[[list[T]], U]') -> 'Future[U]'` - -Execute a function on the results of a list of futures. - -This is useful when the results of one or more futures are needed for further processing. - -Args: - futures (list[Future[T]]): A list of Future objects. - g (Callable[[list[T]], U]): A function that takes the results of the futures and returns a value of type U. - -Returns: - Future[U]: A new Future object representing the result of applying g to the results of the futures. - -### HTTPError - -An HTTP error occurred. - -#### Methods - -##### `__init__(self, *args, **kwargs)` - -Initialize RequestException with `request` and `response` objects. - -### InferenceModels - -No description available. - -#### Methods - -##### `__init__(self, client: 'WeaveClient')` - -This class exists to mirror openai.resources.models.Models. - -It is not a drop-in replacement because of the terminology conflict -with Weave's "Model". - -##### `list(self) -> Union[weave.chat.types.models.ModelsResponseSuccess, weave.chat.types.models.ModelsResponseError]` - -No description available. - -### ObjCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjDeleteReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjReadReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjSchema - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `model_post_init(self, _ObjSchemaForInsert__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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjectRecord - -No description available. - -#### Methods - -##### `__init__(self, attrs: 'dict[str, Any]') -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -##### `map_values(self, fn: 'Callable') -> 'ObjectRecord'` - -No description available. - -##### `unwrap(self) -> 'dict[str, Any]'` - -No description available. - -### ObjectRef - -ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `delete(self) -> 'None'` - -No description available. - -##### `get(self, *, objectify: 'bool' = True) -> 'Any'` - -No description available. - -##### `is_descended_from(self, potential_ancestor: 'ObjectRef') -> 'bool'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'ObjectRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -##### `with_attr(self, attr: 'str') -> 'Self'` - -No description available. - -##### `with_extra(self, extra: 'tuple[str | Future[str], ...]') -> 'Self'` - -No description available. - -##### `with_index(self, index: 'int') -> 'Self'` - -No description available. - -##### `with_item(self, item_digest: 'str | Future[str]') -> 'Self'` - -No description available. - -##### `with_key(self, key: 'str') -> 'Self'` - -No description available. - -### ObjectVersionFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Op - -The interface for Op-ified functions and methods. - -Op was previously a class, and has been converted to a Protocol to allow -functions to pass for Op. This is needed because many popular packages are -using the `inspect` module for control flow, and Op instances don't always -pass those checks. In particular, `inspect.iscoroutinefunction` always -fails for classes, even ones that implement async methods or protocols. - -Some of the attributes are carry-overs from when Op was a class. We should -consider removing the unnecessary ones where possible. -- resolve_fn (I think you can just use the func itself?) -- _set_on_output_handler (does this have to be on the op?) -- _on_output_handler (does this have to be on the op?) - -#### Methods - -##### `_no_init(self, *args, **kwargs)` - -No description available. - -### OpRef - -OpRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `delete(self) -> 'None'` - -No description available. - -##### `get(self, *, objectify: 'bool' = True) -> 'Any'` - -No description available. - -##### `is_descended_from(self, potential_ancestor: 'ObjectRef') -> 'bool'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'OpRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -##### `with_attr(self, attr: 'str') -> 'Self'` - -No description available. - -##### `with_extra(self, extra: 'tuple[str | Future[str], ...]') -> 'Self'` - -No description available. - -##### `with_index(self, index: 'int') -> 'Self'` - -No description available. - -##### `with_item(self, item_digest: 'str | Future[str]') -> 'Self'` - -No description available. - -##### `with_key(self, key: 'str') -> 'Self'` - -No description available. - -### PendingJobCounts - -Counts of pending jobs for each type. - -### Query - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Ref - -Ref() - -#### Methods - -##### `__init__(self) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'AnyRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -### RefsReadBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Sequence - -All the operations on a read-only sequence. - -Concrete subclasses must override __new__ or __init__, -__getitem__, and __len__. - -#### Methods - -##### `count(self, value)` - -S.count(value) -> integer -- return number of occurrences of value - -##### `index(self, value, start=0, stop=None)` - -S.index(value, [start, [stop]]) -> integer -- return first index of value. -Raises ValueError if the value is not present. - -Supporting start and stop arguments is optional, but -recommended. - -### StartedCallSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Table - -No description available. - -#### Methods - -##### `__init__(self, rows: 'list[dict]') -> 'None'` - -Initialize self. See help(type(self)) for accurate signature. - -##### `append(self, row: 'dict') -> 'None'` - -Add a row to the table. - -##### `pop(self, index: 'int') -> 'None'` - -Remove a row at the given index from the table. - -### TableAppendSpec - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableAppendSpecPayload - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableChunkManager - -Manages concurrent creation of table chunks with proper error handling. - -#### Methods - -##### `__init__(self, target_chunk_bytes: int = 10485760)` - -Initialize self. See help(type(self)) for accurate signature. - -##### `calculate_request_bytes(self, req: Any) -> int` - -Calculate the estimated size in bytes of a request. - -##### `calculate_row_bytes(self, row: object) -> int` - -Calculate the size in bytes of a single row. - -##### `create_chunks(self, rows: collections.abc.Sequence) -> list` - -Split rows into chunks based on target byte size. - -Args: - rows: List of rows to chunk - -Returns: - List of row chunks - -### TableCreateFromDigestsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableRef - -TableRef(entity: 'str', project: 'str', _digest: 'str | Future[str]', _row_digests: 'list[str] | Future[list[str]] | None' = None) - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', _digest: 'str | Future[str]', _row_digests: 'list[str] | Future[list[str]] | None' = None) -> None` - -No description available. - -##### `as_param_dict(self) -> 'dict'` - -No description available. - -##### `maybe_parse_uri(s: 'str') -> 'AnyRef | None'` - -No description available. - -##### `parse_uri(uri: 'str') -> 'TableRef'` - -No description available. - -##### `uri(self) -> 'str'` - -No description available. - -### TableSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableUpdateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TraceServerInterface - -Base class for protocol classes. - -Protocol classes are defined as:: - - class Proto(Protocol): - def meth(self) -> int: - ... - -Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing), for example:: - - class C: - def meth(self) -> int: - return 0 - - def func(x: Proto) -> int: - return x.meth() - - func(C()) # Passes static type check - -See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as:: - - class GenProto(Protocol[T]): - def meth(self) -> T: - ... - -#### Methods - -##### `_no_init(self, *args, **kwargs)` - -No description available. - -##### `actions_execute_batch(self, req: weave.trace_server.trace_server_interface.ActionsExecuteBatchReq) -> weave.trace_server.trace_server_interface.ActionsExecuteBatchRes` - -No description available. - -##### `call_end(self, req: weave.trace_server.trace_server_interface.CallEndReq) -> weave.trace_server.trace_server_interface.CallEndRes` - -No description available. - -##### `call_read(self, req: weave.trace_server.trace_server_interface.CallReadReq) -> weave.trace_server.trace_server_interface.CallReadRes` - -No description available. - -##### `call_start(self, req: weave.trace_server.trace_server_interface.CallStartReq) -> weave.trace_server.trace_server_interface.CallStartRes` - -No description available. - -##### `call_start_batch(self, req: weave.trace_server.trace_server_interface.CallCreateBatchReq) -> weave.trace_server.trace_server_interface.CallCreateBatchRes` - -No description available. - -##### `call_update(self, req: weave.trace_server.trace_server_interface.CallUpdateReq) -> weave.trace_server.trace_server_interface.CallUpdateRes` - -No description available. - -##### `calls_delete(self, req: weave.trace_server.trace_server_interface.CallsDeleteReq) -> weave.trace_server.trace_server_interface.CallsDeleteRes` - -No description available. - -##### `calls_query(self, req: weave.trace_server.trace_server_interface.CallsQueryReq) -> weave.trace_server.trace_server_interface.CallsQueryRes` - -No description available. - -##### `calls_query_stats(self, req: weave.trace_server.trace_server_interface.CallsQueryStatsReq) -> weave.trace_server.trace_server_interface.CallsQueryStatsRes` - -No description available. - -##### `calls_query_stream(self, req: weave.trace_server.trace_server_interface.CallsQueryReq) -> collections.abc.Iterator` - -No description available. - -##### `completions_create(self, req: weave.trace_server.trace_server_interface.CompletionsCreateReq) -> weave.trace_server.trace_server_interface.CompletionsCreateRes` - -No description available. - -##### `completions_create_stream(self, req: weave.trace_server.trace_server_interface.CompletionsCreateReq) -> collections.abc.Iterator` - -No description available. - -##### `cost_create(self, req: weave.trace_server.trace_server_interface.CostCreateReq) -> weave.trace_server.trace_server_interface.CostCreateRes` - -No description available. - -##### `cost_purge(self, req: weave.trace_server.trace_server_interface.CostPurgeReq) -> weave.trace_server.trace_server_interface.CostPurgeRes` - -No description available. - -##### `cost_query(self, req: weave.trace_server.trace_server_interface.CostQueryReq) -> weave.trace_server.trace_server_interface.CostQueryRes` - -No description available. - -##### `ensure_project_exists(self, entity: str, project: str) -> weave.trace_server.trace_server_interface.EnsureProjectExistsRes` - -No description available. - -##### `evaluate_model(self, req: weave.trace_server.trace_server_interface.EvaluateModelReq) -> weave.trace_server.trace_server_interface.EvaluateModelRes` - -No description available. - -##### `evaluation_status(self, req: weave.trace_server.trace_server_interface.EvaluationStatusReq) -> weave.trace_server.trace_server_interface.EvaluationStatusRes` - -No description available. - -##### `feedback_create(self, req: weave.trace_server.trace_server_interface.FeedbackCreateReq) -> weave.trace_server.trace_server_interface.FeedbackCreateRes` - -No description available. - -##### `feedback_create_batch(self, req: weave.trace_server.trace_server_interface.FeedbackCreateBatchReq) -> weave.trace_server.trace_server_interface.FeedbackCreateBatchRes` - -No description available. - -##### `feedback_purge(self, req: weave.trace_server.trace_server_interface.FeedbackPurgeReq) -> weave.trace_server.trace_server_interface.FeedbackPurgeRes` - -No description available. - -##### `feedback_query(self, req: weave.trace_server.trace_server_interface.FeedbackQueryReq) -> weave.trace_server.trace_server_interface.FeedbackQueryRes` - -No description available. - -##### `feedback_replace(self, req: weave.trace_server.trace_server_interface.FeedbackReplaceReq) -> weave.trace_server.trace_server_interface.FeedbackReplaceRes` - -No description available. - -##### `file_content_read(self, req: weave.trace_server.trace_server_interface.FileContentReadReq) -> weave.trace_server.trace_server_interface.FileContentReadRes` - -No description available. - -##### `file_create(self, req: weave.trace_server.trace_server_interface.FileCreateReq) -> weave.trace_server.trace_server_interface.FileCreateRes` - -No description available. - -##### `files_stats(self, req: weave.trace_server.trace_server_interface.FilesStatsReq) -> weave.trace_server.trace_server_interface.FilesStatsRes` - -No description available. - -##### `image_create(self, req: weave.trace_server.trace_server_interface.ImageGenerationCreateReq) -> weave.trace_server.trace_server_interface.ImageGenerationCreateRes` - -No description available. - -##### `obj_create(self, req: weave.trace_server.trace_server_interface.ObjCreateReq) -> weave.trace_server.trace_server_interface.ObjCreateRes` - -No description available. - -##### `obj_delete(self, req: weave.trace_server.trace_server_interface.ObjDeleteReq) -> weave.trace_server.trace_server_interface.ObjDeleteRes` - -No description available. - -##### `obj_read(self, req: weave.trace_server.trace_server_interface.ObjReadReq) -> weave.trace_server.trace_server_interface.ObjReadRes` - -No description available. - -##### `objs_query(self, req: weave.trace_server.trace_server_interface.ObjQueryReq) -> weave.trace_server.trace_server_interface.ObjQueryRes` - -No description available. - -##### `op_create(self, req: weave.trace_server.trace_server_interface.OpCreateReq) -> weave.trace_server.trace_server_interface.OpCreateRes` - -No description available. - -##### `op_read(self, req: weave.trace_server.trace_server_interface.OpReadReq) -> weave.trace_server.trace_server_interface.OpReadRes` - -No description available. - -##### `ops_query(self, req: weave.trace_server.trace_server_interface.OpQueryReq) -> weave.trace_server.trace_server_interface.OpQueryRes` - -No description available. - -##### `otel_export(self, req: weave.trace_server.trace_server_interface.OtelExportReq) -> weave.trace_server.trace_server_interface.OtelExportRes` - -No description available. - -##### `project_stats(self, req: weave.trace_server.trace_server_interface.ProjectStatsReq) -> weave.trace_server.trace_server_interface.ProjectStatsRes` - -No description available. - -##### `refs_read_batch(self, req: weave.trace_server.trace_server_interface.RefsReadBatchReq) -> weave.trace_server.trace_server_interface.RefsReadBatchRes` - -No description available. - -##### `table_create(self, req: weave.trace_server.trace_server_interface.TableCreateReq) -> weave.trace_server.trace_server_interface.TableCreateRes` - -No description available. - -##### `table_create_from_digests(self, req: weave.trace_server.trace_server_interface.TableCreateFromDigestsReq) -> weave.trace_server.trace_server_interface.TableCreateFromDigestsRes` - -No description available. - -##### `table_query(self, req: weave.trace_server.trace_server_interface.TableQueryReq) -> weave.trace_server.trace_server_interface.TableQueryRes` - -No description available. - -##### `table_query_stats(self, req: weave.trace_server.trace_server_interface.TableQueryStatsReq) -> weave.trace_server.trace_server_interface.TableQueryStatsRes` - -No description available. - -##### `table_query_stats_batch(self, req: weave.trace_server.trace_server_interface.TableQueryStatsBatchReq) -> weave.trace_server.trace_server_interface.TableQueryStatsBatchRes` - -No description available. - -##### `table_query_stream(self, req: weave.trace_server.trace_server_interface.TableQueryReq) -> collections.abc.Iterator` - -No description available. - -##### `table_update(self, req: weave.trace_server.trace_server_interface.TableUpdateReq) -> weave.trace_server.trace_server_interface.TableUpdateRes` - -No description available. - -##### `threads_query_stream(self, req: weave.trace_server.trace_server_interface.ThreadsQueryReq) -> collections.abc.Iterator` - -No description available. - -### TraceStatus - -An enumeration. - -### WeaveClient - -No description available. - -#### Methods - -##### `__init__(self, entity: 'str', project: 'str', server: 'TraceServerInterface', ensure_project_exists: 'bool' = True)` - -Initialize self. See help(type(self)) for accurate signature. - -##### `add_cost(self, llm_id: 'str', prompt_token_cost: 'float', completion_token_cost: 'float', effective_date: 'datetime.datetime | None' = None, prompt_token_cost_unit: 'str | None' = 'USD', completion_token_cost_unit: 'str | None' = 'USD', provider_id: 'str | None' = 'default') -> 'CostCreateRes'` - -Add a cost to the current project. - -Examples: - ```python - client.add_cost(llm_id="my_expensive_custom_model", prompt_token_cost=1, completion_token_cost=2) - client.add_cost(llm_id="my_expensive_custom_model", prompt_token_cost=500, completion_token_cost=1000, effective_date=datetime(1998, 10, 3)) - ``` - -Args: - llm_id: The ID of the LLM. eg "gpt-4o-mini-2024-07-18" - prompt_token_cost: The cost per prompt token. eg .0005 - completion_token_cost: The cost per completion token. eg .0015 - effective_date: Defaults to the current date. A datetime.datetime object. - provider_id: The provider of the LLM. Defaults to "default". eg "openai" - prompt_token_cost_unit: The unit of the cost for the prompt tokens. Defaults to "USD". (Currently unused, will be used in the future to specify the currency type for the cost eg "tokens" or "time") - completion_token_cost_unit: The unit of the cost for the completion tokens. Defaults to "USD". (Currently unused, will be used in the future to specify the currency type for the cost eg "tokens" or "time") - -Returns: - A CostCreateRes object. - Which has one field called a list of tuples called ids. - Each tuple contains the llm_id and the id of the created cost object. - -##### `call(self, call_id: 'str', include_costs: 'bool' = False) -> 'WeaveObject'` - -No description available. - -##### `calls(self, filter: 'CallsFilter | None' = None, include_costs: 'bool' = False) -> 'CallsIter'` - -No description available. - -##### `create_call(self, op: 'str | Op', inputs: 'dict[str, Any]', parent: 'Call | None' = None, attributes: 'dict[str, Any] | None' = None, display_name: 'str | Callable[[Call], str] | None' = None, *, use_stack: 'bool' = True, _call_id_override: 'str | None' = None) -> 'Call'` - -Create, log, and push a call onto the runtime stack. - -Args: - op: The operation producing the call, or the name of an anonymous operation. - inputs: The inputs to the operation. - parent: The parent call. If parent is not provided, the current run is used as the parent. - display_name: The display name for the call. Defaults to None. - attributes: The attributes for the call. Defaults to None. - use_stack: Whether to push the call onto the runtime stack. Defaults to True. - -Returns: - The created Call object. - -##### `delete_all_object_versions(self, object_name: 'str') -> 'int'` - -Delete all versions of an object. - -Args: - object_name: The name of the object whose versions should be deleted. - -Returns: - The number of versions deleted. - -##### `delete_all_op_versions(self, op_name: 'str') -> 'int'` - -Delete all versions of an op. - -Args: - op_name: The name of the op whose versions should be deleted. - -Returns: - The number of versions deleted. - -##### `delete_call(self, call: 'Call') -> 'None'` - -No description available. - -##### `delete_calls(self, call_ids: 'list[str]') -> 'None'` - -Delete calls by their IDs. - -Deleting a call will also delete all of its children. - -Args: - call_ids: A list of call IDs to delete. Ex: ["2F0193e107-8fcf-7630-b576-977cc3062e2e"] - -##### `delete_object_version(self, object: 'ObjectRef') -> 'None'` - -No description available. - -##### `delete_object_versions(self, object_name: 'str', digests: 'list[str]') -> 'int'` - -Delete specific versions of an object. - -Args: - object_name: The name of the object whose versions should be deleted. - digests: List of digests to delete. Can include aliases like "latest" or "v0". - -Returns: - The number of versions deleted. - -##### `delete_op_version(self, op: 'OpRef') -> 'None'` - -No description available. - -##### `fail_call(self, call: 'Call', exception: 'BaseException') -> 'None'` - -Fail a call with an exception. This is a convenience method for finish_call. - -##### `feedback(self, query: 'Query | str | None' = None, *, reaction: 'str | None' = None, offset: 'int' = 0, limit: 'int' = 100) -> 'FeedbackQuery'` - -No description available. - -##### `finish(self, use_progress_bar: 'bool' = True, callback: 'Callable[[FlushStatus], None] | None' = None) -> 'None'` - -Flushes all background tasks to ensure they are processed. - -This method blocks until all currently enqueued jobs are processed, -displaying a progress bar to show the status of the pending tasks. -It ensures parallel processing during main thread execution and can -improve performance when user code completes before data has been -uploaded to the server. - -Args: - use_progress_bar: Whether to display a progress bar during flush. - Set to False for environments where a progress bar - would not render well (e.g., CI environments). - callback: Optional callback function that receives status updates. - Overrides use_progress_bar. - -##### `finish_call(self, call: 'Call', output: 'Any' = None, exception: 'BaseException | None' = None, *, op: 'Op | None' = None) -> 'None'` - -Finalize a call and persist its results. - -Any values present in ``call.summary`` are deep-merged with computed -summary statistics (e.g. usage and status counts) before being written -to the database. - -##### `flush(self) -> 'None'` - -Flushes background asynchronous tasks, safe to call multiple times. - -##### `get(self, ref: 'ObjectRef', *, objectify: 'bool' = True) -> 'Any'` - -No description available. - -##### `get_call(self, call_id: 'str', include_costs: 'bool' = False, include_feedback: 'bool' = False, columns: 'list[str] | None' = None) -> 'WeaveObject'` - -Get a single call by its ID. - -Args: - call_id: The ID of the call to get. - include_costs: If true, cost info is included at summary.weave - include_feedback: If true, feedback info is included at summary.weave.feedback - columns: A list of columns to include in the response. If None, - all columns are included. Specifying fewer columns may be more performant. - Some columns are always included: id, project_id, trace_id, op_name, started_at - -Returns: - A call object. - -##### `get_calls(self, *, filter: 'CallsFilterLike | None' = None, limit: 'int | None' = None, offset: 'int | None' = None, sort_by: 'list[SortByLike] | None' = None, query: 'QueryLike | None' = None, include_costs: 'bool' = False, include_feedback: 'bool' = False, columns: 'list[str] | None' = None, expand_columns: 'list[str] | None' = None, return_expanded_column_values: 'bool' = True, scored_by: 'str | list[str] | None' = None, page_size: 'int' = 1000) -> 'CallsIter'` - -Retrieve a list of traced calls (operations) for this project. - -This method provides a powerful and flexible interface for querying trace data. -It supports pagination, filtering, sorting, field projection, and scoring metadata, -and can be used to power custom trace UIs or analysis tools. - -Performance Tip: Specify `columns` and use `filter` or `query` to reduce result size. - -Args: - `filter`: High-level filter for narrowing results by fields like `op_name`, `parent_ids`, etc. - `limit`: Maximum number of calls to return. - `offset`: Number of calls to skip before returning results (used for pagination). - `sort_by`: List of fields to sort the results by (e.g., `started_at desc`). - `query`: A mongo-like expression for advanced filtering. Not all Mongo operators are supported. - `include_costs`: If True, includes token/cost info in `summary.weave`. - `include_feedback`: If True, includes feedback in `summary.weave.feedback`. - `columns`: List of fields to return per call. Reducing this can significantly improve performance. - (Some fields like `id`, `trace_id`, `op_name`, and `started_at` are always included.) - `scored_by`: Filter by one or more scorers (name or ref URI). Multiple scorers are AND-ed. - `page_size`: Number of calls fetched per page. Tune this for performance in large queries. - -Returns: - `CallsIter`: An iterator over `Call` objects. Supports slicing, iteration, and `.to_pandas()`. - -Example: - ```python - calls = client.get_calls( - filter=CallsFilter(op_names=["my_op"]), - columns=["inputs", "output", "summary"], - limit=100, - ) - for call in calls: - print(call.inputs, call.output) - ``` - -##### `get_evaluation(self, uri: 'str') -> 'Evaluation'` - -Retrieve a specific Evaluation object by its URI. - -Evaluation URIs typically follow the format: -`weave:///entity/project/object/Evaluation:version` - -You can also get the evaluation by its "friendly" name: -get_evaluation("Evaluation:v1") - -Args: - uri (str): The unique resource identifier of the evaluation to retrieve. - -Returns: - Evaluation: The Evaluation object corresponding to the provided URI. - -Raises: - TypeError: If the object at the URI is not an Evaluation instance. - ValueError: If the URI is invalid or the object cannot be found. - -Examples: - ```python - client = weave.init("my-project") - evaluation = client.get_evaluation("weave:///entity/project/object/my-eval:v1") - print(evaluation.name) - ``` - -##### `get_evaluations(self) -> 'list[Evaluation]'` - -Retrieve all Evaluation objects from the current project. - -Returns: - list[Evaluation]: A list of all Evaluation objects in the current project. - Empty list if no evaluations are found or if all conversions fail. - -Examples: - ```python - client = weave.init("my-project") - evaluations = client.get_evaluations() - print(f"Found {len(evaluations)} evaluations") - for eval in evaluations: - print(f"Evaluation: {eval.name}") - ``` - -##### `get_feedback(self, query: 'Query | str | None' = None, *, reaction: 'str | None' = None, offset: 'int' = 0, limit: 'int' = 100) -> 'FeedbackQuery'` - -Query project for feedback. - -Examples: - ```python - # Fetch a specific feedback object. - # Note that this still returns a collection, which is expected - # to contain zero or one item(s). - client.get_feedback("1B4082A3-4EDA-4BEB-BFEB-2D16ED59AA07") - - # Find all feedback objects with a specific reaction. - client.get_feedback(reaction="👍", limit=10) - - # Find all feedback objects with a specific feedback type with - # mongo-style query. - from weave.trace_server.interface.query import Query - - query = Query( - **{ - "$expr": { - "$eq": [ - {"$getField": "feedback_type"}, - {"$literal": "wandb.reaction.1"}, - ], - } - } - ) - client.get_feedback(query=query) - ``` - -Args: - query: A mongo-style query expression. For convenience, also accepts a feedback UUID string. - reaction: For convenience, filter by a particular reaction emoji. - offset: The offset to start fetching feedback objects from. - limit: The maximum number of feedback objects to fetch. - -Returns: - A FeedbackQuery object. - -##### `purge_costs(self, ids: 'list[str] | str') -> 'None'` - -Purge costs from the current project. - -Examples: - ```python - client.purge_costs([ids]) - client.purge_costs(ids) - ``` - -Args: - ids: The cost IDs to purge. Can be a single ID or a list of IDs. - -##### `query_costs(self, query: 'Query | str | None' = None, llm_ids: 'list[str] | None' = None, offset: 'int' = 0, limit: 'int' = 100) -> 'list[CostQueryOutput]'` - -Query project for costs. - -Examples: - ```python - # Fetch a specific cost object. - # Note that this still returns a collection, which is expected - # to contain zero or one item(s). - client.query_costs("1B4082A3-4EDA-4BEB-BFEB-2D16ED59AA07") - - # Find all cost objects with a specific reaction. - client.query_costs(llm_ids=["gpt-4o-mini-2024-07-18"], limit=10) - ``` - -Args: - query: A mongo-style query expression. For convenience, also accepts a cost UUID string. - llm_ids: For convenience, filter for a set of llm_ids. - offset: The offset to start fetching cost objects from. - limit: The maximum number of cost objects to fetch. - -Returns: - A CostQuery object. - -##### `save(self, val: 'Any', name: 'str', branch: 'str' = 'latest') -> 'Any'` - -Do not call directly, use weave.publish() instead. - -Args: - val: The object to save. - name: The name to save the object under. - branch: The branch to save the object under. Defaults to "latest". - -Returns: - A deserialized version of the saved object. - -### WeaveClientSendFileCache - -Cache for file create requests and responses with LRU eviction policy. - -#### Methods - -##### `__init__(self, max_size: int = 1000) -> None` - -Initialize the file cache with a maximum size. - -Args: - max_size: Maximum number of items to store in the cache. - If set to 0, cache size is unlimited. - -##### `clear(self) -> None` - -Clear all items from the cache. - -##### `get(self, req: weave.trace_server.trace_server_interface.FileCreateReq) -> Optional[concurrent.futures._base.Future[weave.trace_server.trace_server_interface.FileCreateRes]]` - -Get a cached response for a file create request. - -Returns None if the request is not in the cache. - -##### `put(self, req: weave.trace_server.trace_server_interface.FileCreateReq, res: concurrent.futures._base.Future) -> None` - -Cache a response for a file create request. - -##### `size(self) -> int` - -Return the current number of items in the cache. - -### WeaveObject - -No description available. - -#### Methods - -##### `__init__(self, val: Any, ref: Optional[weave.trace.refs.RefWithExtra], server: weave.trace_server.trace_server_interface.TraceServerInterface, root: Optional[weave.trace.vals.Traceable], parent: Optional[weave.trace.vals.Traceable] = None) -> None` - -Initialize self. See help(type(self)) for accurate signature. - -##### `add_mutation(self, path: tuple, operation: Union[Literal['setitem'], Literal['setattr'], Literal['append']], *args: Any) -> None` - -No description available. - -##### `save(self) -> weave.trace.refs.ObjectRef` - -No description available. - -##### `unwrap(self) -> Any` - -No description available. - -### WeaveTable - -No description available. - -#### Methods - -##### `__init__(self, server: weave.trace_server.trace_server_interface.TraceServerInterface, table_ref: Optional[weave.trace.refs.TableRef] = None, ref: Optional[weave.trace.refs.RefWithExtra] = None, filter: Optional[weave.trace_server.trace_server_interface.TableRowFilter] = None, root: Optional[weave.trace.vals.Traceable] = None, parent: Optional[weave.trace.vals.Traceable] = None) -> None` - -Initialize self. See help(type(self)) for accurate signature. - -##### `add_mutation(self, path: tuple, operation: Union[Literal['setitem'], Literal['setattr'], Literal['append']], *args: Any) -> None` - -No description available. - -##### `append(self, val: dict) -> None` - -No description available. - -##### `pop(self, index: int) -> None` - -No description available. - -##### `save(self) -> weave.trace.refs.ObjectRef` - -No description available. - -##### `set_prefetched_rows(self, prefetched_rows: list) -> None` - -Sets the rows to a local cache of rows that can be used to -avoid a remote call. Should only be used by internal code. - -It is expected that these rows are the exact same rows that would -be returned by a query for this table. Failing to meet this expectation -will cause table operations to behave unexpectedly. - -##### `unwrap(self) -> Any` - -No description available. - -### cached_property - -No description available. - -#### Methods - -##### `__init__(self, func)` - -Initialize self. See help(type(self)) for accurate signature. - diff --git a/weave/reference/python-sdk/weave/trace_server/trace_server_interface.mdx b/weave/reference/python-sdk/weave/trace_server/trace_server_interface.mdx deleted file mode 100644 index ba11e1404d..0000000000 --- a/weave/reference/python-sdk/weave/trace_server/trace_server_interface.mdx +++ /dev/null @@ -1,36060 +0,0 @@ ---- -title: weave.trace_server.trace_server_interface ---- - -# weave.trace_server.trace_server_interface - -## Functions - -### `Field(default: 'Any' = PydanticUndefined, *, default_factory: 'Callable[[], Any] | Callable[[dict[str, Any]], Any] | None' = PydanticUndefined, alias: 'str | None' = PydanticUndefined, alias_priority: 'int | None' = PydanticUndefined, validation_alias: 'str | AliasPath | AliasChoices | None' = PydanticUndefined, serialization_alias: 'str | None' = PydanticUndefined, title: 'str | None' = PydanticUndefined, field_title_generator: 'Callable[[str, FieldInfo], str] | None' = PydanticUndefined, description: 'str | None' = PydanticUndefined, examples: 'list[Any] | None' = PydanticUndefined, exclude: 'bool | None' = PydanticUndefined, discriminator: 'str | types.Discriminator | None' = PydanticUndefined, deprecated: 'Deprecated | str | bool | None' = PydanticUndefined, json_schema_extra: 'JsonDict | Callable[[JsonDict], None] | None' = PydanticUndefined, frozen: 'bool | None' = PydanticUndefined, validate_default: 'bool | None' = PydanticUndefined, repr: 'bool' = PydanticUndefined, init: 'bool | None' = PydanticUndefined, init_var: 'bool | None' = PydanticUndefined, kw_only: 'bool | None' = PydanticUndefined, pattern: 'str | typing.Pattern[str] | None' = PydanticUndefined, strict: 'bool | None' = PydanticUndefined, coerce_numbers_to_str: 'bool | None' = PydanticUndefined, gt: 'annotated_types.SupportsGt | None' = PydanticUndefined, ge: 'annotated_types.SupportsGe | None' = PydanticUndefined, lt: 'annotated_types.SupportsLt | None' = PydanticUndefined, le: 'annotated_types.SupportsLe | None' = PydanticUndefined, multiple_of: 'float | None' = PydanticUndefined, allow_inf_nan: 'bool | None' = PydanticUndefined, max_digits: 'int | None' = PydanticUndefined, decimal_places: 'int | None' = PydanticUndefined, min_length: 'int | None' = PydanticUndefined, max_length: 'int | None' = PydanticUndefined, union_mode: "Literal['smart', 'left_to_right']" = PydanticUndefined, fail_fast: 'bool | None' = PydanticUndefined, **extra: 'Unpack[_EmptyKwargs]') -> 'Any'` - -!!! abstract "Usage Documentation" - Fields - -Create a field for objects that can be configured. - -Used to provide extra information about a field, either for the model schema or complex validation. Some arguments -apply only to number fields (`int`, `float`, `Decimal`) and some apply only to `str`. - -Note: - - Any `_Unset` objects will be replaced by the corresponding value defined in the `_DefaultValues` dictionary. If a key for the `_Unset` object is not found in the `_DefaultValues` dictionary, it will default to `None` - -Args: - default: Default value if the field is not set. - default_factory: A callable to generate the default value. The callable can either take 0 arguments - (in which case it is called as is) or a single argument containing the already validated data. - alias: The name to use for the attribute when validating or serializing by alias. - This is often used for things like converting between snake and camel case. - alias_priority: Priority of the alias. This affects whether an alias generator is used. - validation_alias: Like `alias`, but only affects validation, not serialization. - serialization_alias: Like `alias`, but only affects serialization, not validation. - title: Human-readable title. - field_title_generator: A callable that takes a field name and returns title for it. - description: Human-readable description. - examples: Example values for this field. - exclude: Whether to exclude the field from the model serialization. - discriminator: Field name or Discriminator for discriminating the type in a tagged union. - deprecated: A deprecation message, an instance of `warnings.deprecated` or the `typing_extensions.deprecated` backport, - or a boolean. If `True`, a default deprecation message will be emitted when accessing the field. - json_schema_extra: A dict or callable to provide extra JSON schema properties. - frozen: Whether the field is frozen. If true, attempts to change the value on an instance will raise an error. - validate_default: If `True`, apply validation to the default value every time you create an instance. - Otherwise, for performance reasons, the default value of the field is trusted and not validated. - repr: A boolean indicating whether to include the field in the `__repr__` output. - init: Whether the field should be included in the constructor of the dataclass. - (Only applies to dataclasses.) - init_var: Whether the field should _only_ be included in the constructor of the dataclass. - (Only applies to dataclasses.) - kw_only: Whether the field should be a keyword-only argument in the constructor of the dataclass. - (Only applies to dataclasses.) - coerce_numbers_to_str: Whether to enable coercion of any `Number` type to `str` (not applicable in `strict` mode). - strict: If `True`, strict validation is applied to the field. - See Strict Mode for details. - gt: Greater than. If set, value must be greater than this. Only applicable to numbers. - ge: Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers. - lt: Less than. If set, value must be less than this. Only applicable to numbers. - le: Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers. - multiple_of: Value must be a multiple of this. Only applicable to numbers. - min_length: Minimum length for iterables. - max_length: Maximum length for iterables. - pattern: Pattern for strings (a regular expression). - allow_inf_nan: Allow `inf`, `-inf`, `nan`. Only applicable to float and [`Decimal`][decimal.Decimal] numbers. - max_digits: Maximum number of allow digits for strings. - decimal_places: Maximum number of decimal places allowed for numbers. - union_mode: The strategy to apply when validating a union. Can be `smart` (the default), or `left_to_right`. - See Union Mode for details. - fail_fast: If `True`, validation will stop on the first error. If `False`, all validation errors will be collected. - This option can be applied only to iterable types (list, tuple, set, and frozenset). - extra: (Deprecated) Extra fields that will be included in the JSON schema. - - !!! warning Deprecated - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - -Returns: - A new [`FieldInfo`][pydantic.fields.FieldInfo]. The return annotation is `Any` so `Field` can be used on - type-annotated fields without causing a type error. - -### `field_serializer(*fields: 'str', mode: "Literal['plain', 'wrap']" = 'plain', return_type: 'Any' = PydanticUndefined, when_used: 'WhenUsed' = 'always', check_fields: 'bool | None' = None) -> 'Callable[[_FieldWrapSerializerT], _FieldWrapSerializerT] | Callable[[_FieldPlainSerializerT], _FieldPlainSerializerT]'` - -Decorator that enables custom field serialization. - -In the below example, a field of type `set` is used to mitigate duplication. A `field_serializer` is used to serialize the data as a sorted list. - -```python -from typing import Set - -from pydantic import BaseModel, field_serializer - -class StudentModel(BaseModel): - name: str = 'Jane' - courses: Set[str] - - @field_serializer('courses', when_used='json') - def serialize_courses_in_order(self, courses: Set[str]): - return sorted(courses) - -student = StudentModel(courses={'Math', 'Chemistry', 'English'}) -print(student.model_dump_json()) -#> {"name":"Jane","courses":["Chemistry","English","Math"]} -``` - -See Custom serializers for more information. - -Four signatures are supported: - -- `(self, value: Any, info: FieldSerializationInfo)` -- `(self, value: Any, nxt: SerializerFunctionWrapHandler, info: FieldSerializationInfo)` -- `(value: Any, info: SerializationInfo)` -- `(value: Any, nxt: SerializerFunctionWrapHandler, info: SerializationInfo)` - -Args: - fields: Which field(s) the method should be called on. - mode: The serialization mode. - - - `plain` means the function will be called instead of the default serialization logic, - - `wrap` means the function will be called with an argument to optionally call the - default serialization logic. - return_type: Optional return type for the function, if omitted it will be inferred from the type annotation. - when_used: Determines the serializer will be used for serialization. - check_fields: Whether to check that the fields actually exist on the model. - -Returns: - The decorator function. - -## Classes - -### ActionsExecuteBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ActionsExecuteBatchRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### BaseModel - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### BaseModelStrict - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallBatchEndMode - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallBatchStartMode - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallCreateBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallCreateBatchRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallEndReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallEndRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallReadReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallReadRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallSchema - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `serialize_typed_dicts(self, v: dict) -> dict` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallStartReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallStartRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallUpdateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallUpdateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsDeleteReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsDeleteRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsQueryStatsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CallsQueryStatsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CompletionsCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CompletionsCreateRequestInputs - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CompletionsCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ConfigDict - -A TypedDict for configuring Pydantic behaviour. - -### CostCreateInput - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostPurgeReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostPurgeRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostQueryOutput - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### CostQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EndedCallSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `serialize_typed_dicts(self, v: dict) -> dict` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EnsureProjectExistsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Enum - -Generic enumeration. - -Derive from this class to define new enumerations. - -### EvaluateModelReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluateModelRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusComplete - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusFailed - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusNotFound - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### EvaluationStatusRunning - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ExportTracePartialSuccess - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ExtraKeysTypedDict - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### Feedback - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackCreateBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackCreateBatchRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackDict - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### FeedbackPurgeReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackPurgeRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackReplaceReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FeedbackReplaceRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FileContentReadReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FileContentReadRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FileCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FileCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FilesStatsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### FilesStatsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ImageGenerationCreateReq - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ImageGenerationCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ImageGenerationRequestInputs - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Iterator - -No description available. - -### LLMCostSchema - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### LLMUsageSchema - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### ObjCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjDeleteReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjDeleteRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjReadReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjReadRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjSchema - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `model_post_init(self, _ObjSchemaForInsert__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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ObjectVersionFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpReadReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpReadRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OpVersionFilter - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OtelExportReq - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### OtelExportRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ProjectStatsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ProjectStatsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### Protocol - -Base class for protocol classes. - -Protocol classes are defined as:: - - class Proto(Protocol): - def meth(self) -> int: - ... - -Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing), for example:: - - class C: - def meth(self) -> int: - return 0 - - def func(x: Proto) -> int: - return x.meth() - - func(C()) # Passes static type check - -See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as:: - - class GenProto(Protocol[T]): - def meth(self) -> T: - ... - -### Query - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### RefsReadBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### RefsReadBatchRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### SortBy - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### StartedCallSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### SummaryInsertMap - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### SummaryMap - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - -### TableAppendSpec - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableAppendSpecPayload - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateFromDigestsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateFromDigestsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableCreateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableInsertSpec - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableInsertSpecPayload - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TablePopSpec - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TablePopSpecPayload - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryStatsBatchReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryStatsBatchRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryStatsReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableQueryStatsRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableRowFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableRowSchema - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableSchemaForInsert - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableStatsRow - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableUpdateReq - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TableUpdateRes - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ThreadSchema - -!!! 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. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ThreadsQueryFilter - -Base model with strict validation that forbids extra fields. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### ThreadsQueryReq - -Query threads with aggregated statistics based on turn calls only. - -Turn calls are the immediate children of thread contexts (where call.id == turn_id). -This provides meaningful conversation-level statistics rather than including all -nested implementation details. - -#### Methods - -##### `__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. - -##### `construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -No description 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: - -```python {test="skip" lint="skip"} -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 description available. - -##### `from_orm(obj: 'Any') -> 'Self'` - -No description 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 description available. - -##### `model_construct(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'` - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. - -!!! note - `model_construct()` generally respects the `model_config.extra` setting on the provided model. - That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` - and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. - Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in - an error if extra values are passed, but they will be ignored. - -Args: - _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, - this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. - Otherwise, the field names from the `values` argument will be used. - values: Trusted or pre-validated data dictionary. - -Returns: - A new instance of the `Model` class with validated data. - -##### `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_json_schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', schema_generator: 'type[GenerateJsonSchema]' = , mode: 'JsonSchemaMode' = 'validation') -> 'dict[str, Any]'` - -Generates a JSON schema for a model class. - -Args: - by_alias: Whether to use attribute aliases or not. - ref_template: The reference template. - schema_generator: To override the logic used to generate the JSON schema, as a subclass of - `GenerateJsonSchema` with your desired modifications - mode: The mode in which to generate the schema. - -Returns: - The JSON schema for the given model class. - -##### `model_parametrized_name(params: 'tuple[type[Any], ...]') -> 'str'` - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -Args: - params: Tuple of types of the class. Given a generic class - `Model` with 2 type variables and a concrete model `Model[str, int]`, - the value `(str, int)` would be passed to `params`. - -Returns: - String representing the new class where `params` are passed to `cls` as type variables. - -Raises: - TypeError: Raised when trying to generate concrete names for non-generic models. - -##### `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. - -##### `model_rebuild(*, force: 'bool' = False, raise_errors: 'bool' = True, _parent_namespace_depth: 'int' = 2, _types_namespace: 'MappingNamespace | None' = None) -> 'bool | None'` - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -Args: - force: Whether to force the rebuilding of the model schema, defaults to `False`. - raise_errors: Whether to raise errors, defaults to `True`. - _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. - _types_namespace: The types namespace, defaults to `None`. - -Returns: - Returns `None` if the schema is already "complete" and rebuilding was not required. - If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. - -##### `model_validate(obj: 'Any', *, strict: 'bool | None' = None, from_attributes: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate a pydantic model instance. - -Args: - obj: The object to validate. - strict: Whether to enforce types strictly. - from_attributes: Whether to extract data from object attributes. - context: Additional context to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Raises: - ValidationError: If the object could not be validated. - -Returns: - The validated model instance. - -##### `model_validate_json(json_data: 'str | bytes | bytearray', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -!!! abstract "Usage Documentation" - JSON Parsing - -Validate the given JSON data against the Pydantic model. - -Args: - json_data: The JSON data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -Raises: - ValidationError: If `json_data` is not a JSON string or the object could not be validated. - -##### `model_validate_strings(obj: 'Any', *, strict: 'bool | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, by_name: 'bool | None' = None) -> 'Self'` - -Validate the given object with string data against the Pydantic model. - -Args: - obj: The object containing string data to validate. - strict: Whether to enforce types strictly. - context: Extra variables to pass to the validator. - by_alias: Whether to use the field's alias when validating against the provided input data. - by_name: Whether to use the field's name when validating against the provided input data. - -Returns: - The validated Pydantic model. - -##### `parse_file(path: 'str | Path', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `parse_obj(obj: 'Any') -> 'Self'` - -No description available. - -##### `parse_raw(b: 'str | bytes', *, content_type: 'str | None' = None, encoding: 'str' = 'utf8', proto: 'DeprecatedParseProtocol | None' = None, allow_pickle: 'bool' = False) -> 'Self'` - -No description available. - -##### `schema(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'` - -No description available. - -##### `schema_json(*, by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}', **dumps_kwargs: 'Any') -> 'str'` - -No description available. - -##### `update_forward_refs(**localns: 'Any') -> 'None'` - -No description available. - -##### `validate(value: 'Any') -> 'Self'` - -No description available. - -### TraceServerInterface - -Base class for protocol classes. - -Protocol classes are defined as:: - - class Proto(Protocol): - def meth(self) -> int: - ... - -Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing), for example:: - - class C: - def meth(self) -> int: - return 0 - - def func(x: Proto) -> int: - return x.meth() - - func(C()) # Passes static type check - -See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as:: - - class GenProto(Protocol[T]): - def meth(self) -> T: - ... - -#### Methods - -##### `_no_init(self, *args, **kwargs)` - -No description available. - -##### `actions_execute_batch(self, req: weave.trace_server.trace_server_interface.ActionsExecuteBatchReq) -> weave.trace_server.trace_server_interface.ActionsExecuteBatchRes` - -No description available. - -##### `call_end(self, req: weave.trace_server.trace_server_interface.CallEndReq) -> weave.trace_server.trace_server_interface.CallEndRes` - -No description available. - -##### `call_read(self, req: weave.trace_server.trace_server_interface.CallReadReq) -> weave.trace_server.trace_server_interface.CallReadRes` - -No description available. - -##### `call_start(self, req: weave.trace_server.trace_server_interface.CallStartReq) -> weave.trace_server.trace_server_interface.CallStartRes` - -No description available. - -##### `call_start_batch(self, req: weave.trace_server.trace_server_interface.CallCreateBatchReq) -> weave.trace_server.trace_server_interface.CallCreateBatchRes` - -No description available. - -##### `call_update(self, req: weave.trace_server.trace_server_interface.CallUpdateReq) -> weave.trace_server.trace_server_interface.CallUpdateRes` - -No description available. - -##### `calls_delete(self, req: weave.trace_server.trace_server_interface.CallsDeleteReq) -> weave.trace_server.trace_server_interface.CallsDeleteRes` - -No description available. - -##### `calls_query(self, req: weave.trace_server.trace_server_interface.CallsQueryReq) -> weave.trace_server.trace_server_interface.CallsQueryRes` - -No description available. - -##### `calls_query_stats(self, req: weave.trace_server.trace_server_interface.CallsQueryStatsReq) -> weave.trace_server.trace_server_interface.CallsQueryStatsRes` - -No description available. - -##### `calls_query_stream(self, req: weave.trace_server.trace_server_interface.CallsQueryReq) -> collections.abc.Iterator` - -No description available. - -##### `completions_create(self, req: weave.trace_server.trace_server_interface.CompletionsCreateReq) -> weave.trace_server.trace_server_interface.CompletionsCreateRes` - -No description available. - -##### `completions_create_stream(self, req: weave.trace_server.trace_server_interface.CompletionsCreateReq) -> collections.abc.Iterator` - -No description available. - -##### `cost_create(self, req: weave.trace_server.trace_server_interface.CostCreateReq) -> weave.trace_server.trace_server_interface.CostCreateRes` - -No description available. - -##### `cost_purge(self, req: weave.trace_server.trace_server_interface.CostPurgeReq) -> weave.trace_server.trace_server_interface.CostPurgeRes` - -No description available. - -##### `cost_query(self, req: weave.trace_server.trace_server_interface.CostQueryReq) -> weave.trace_server.trace_server_interface.CostQueryRes` - -No description available. - -##### `ensure_project_exists(self, entity: str, project: str) -> weave.trace_server.trace_server_interface.EnsureProjectExistsRes` - -No description available. - -##### `evaluate_model(self, req: weave.trace_server.trace_server_interface.EvaluateModelReq) -> weave.trace_server.trace_server_interface.EvaluateModelRes` - -No description available. - -##### `evaluation_status(self, req: weave.trace_server.trace_server_interface.EvaluationStatusReq) -> weave.trace_server.trace_server_interface.EvaluationStatusRes` - -No description available. - -##### `feedback_create(self, req: weave.trace_server.trace_server_interface.FeedbackCreateReq) -> weave.trace_server.trace_server_interface.FeedbackCreateRes` - -No description available. - -##### `feedback_create_batch(self, req: weave.trace_server.trace_server_interface.FeedbackCreateBatchReq) -> weave.trace_server.trace_server_interface.FeedbackCreateBatchRes` - -No description available. - -##### `feedback_purge(self, req: weave.trace_server.trace_server_interface.FeedbackPurgeReq) -> weave.trace_server.trace_server_interface.FeedbackPurgeRes` - -No description available. - -##### `feedback_query(self, req: weave.trace_server.trace_server_interface.FeedbackQueryReq) -> weave.trace_server.trace_server_interface.FeedbackQueryRes` - -No description available. - -##### `feedback_replace(self, req: weave.trace_server.trace_server_interface.FeedbackReplaceReq) -> weave.trace_server.trace_server_interface.FeedbackReplaceRes` - -No description available. - -##### `file_content_read(self, req: weave.trace_server.trace_server_interface.FileContentReadReq) -> weave.trace_server.trace_server_interface.FileContentReadRes` - -No description available. - -##### `file_create(self, req: weave.trace_server.trace_server_interface.FileCreateReq) -> weave.trace_server.trace_server_interface.FileCreateRes` - -No description available. - -##### `files_stats(self, req: weave.trace_server.trace_server_interface.FilesStatsReq) -> weave.trace_server.trace_server_interface.FilesStatsRes` - -No description available. - -##### `image_create(self, req: weave.trace_server.trace_server_interface.ImageGenerationCreateReq) -> weave.trace_server.trace_server_interface.ImageGenerationCreateRes` - -No description available. - -##### `obj_create(self, req: weave.trace_server.trace_server_interface.ObjCreateReq) -> weave.trace_server.trace_server_interface.ObjCreateRes` - -No description available. - -##### `obj_delete(self, req: weave.trace_server.trace_server_interface.ObjDeleteReq) -> weave.trace_server.trace_server_interface.ObjDeleteRes` - -No description available. - -##### `obj_read(self, req: weave.trace_server.trace_server_interface.ObjReadReq) -> weave.trace_server.trace_server_interface.ObjReadRes` - -No description available. - -##### `objs_query(self, req: weave.trace_server.trace_server_interface.ObjQueryReq) -> weave.trace_server.trace_server_interface.ObjQueryRes` - -No description available. - -##### `op_create(self, req: weave.trace_server.trace_server_interface.OpCreateReq) -> weave.trace_server.trace_server_interface.OpCreateRes` - -No description available. - -##### `op_read(self, req: weave.trace_server.trace_server_interface.OpReadReq) -> weave.trace_server.trace_server_interface.OpReadRes` - -No description available. - -##### `ops_query(self, req: weave.trace_server.trace_server_interface.OpQueryReq) -> weave.trace_server.trace_server_interface.OpQueryRes` - -No description available. - -##### `otel_export(self, req: weave.trace_server.trace_server_interface.OtelExportReq) -> weave.trace_server.trace_server_interface.OtelExportRes` - -No description available. - -##### `project_stats(self, req: weave.trace_server.trace_server_interface.ProjectStatsReq) -> weave.trace_server.trace_server_interface.ProjectStatsRes` - -No description available. - -##### `refs_read_batch(self, req: weave.trace_server.trace_server_interface.RefsReadBatchReq) -> weave.trace_server.trace_server_interface.RefsReadBatchRes` - -No description available. - -##### `table_create(self, req: weave.trace_server.trace_server_interface.TableCreateReq) -> weave.trace_server.trace_server_interface.TableCreateRes` - -No description available. - -##### `table_create_from_digests(self, req: weave.trace_server.trace_server_interface.TableCreateFromDigestsReq) -> weave.trace_server.trace_server_interface.TableCreateFromDigestsRes` - -No description available. - -##### `table_query(self, req: weave.trace_server.trace_server_interface.TableQueryReq) -> weave.trace_server.trace_server_interface.TableQueryRes` - -No description available. - -##### `table_query_stats(self, req: weave.trace_server.trace_server_interface.TableQueryStatsReq) -> weave.trace_server.trace_server_interface.TableQueryStatsRes` - -No description available. - -##### `table_query_stats_batch(self, req: weave.trace_server.trace_server_interface.TableQueryStatsBatchReq) -> weave.trace_server.trace_server_interface.TableQueryStatsBatchRes` - -No description available. - -##### `table_query_stream(self, req: weave.trace_server.trace_server_interface.TableQueryReq) -> collections.abc.Iterator` - -No description available. - -##### `table_update(self, req: weave.trace_server.trace_server_interface.TableUpdateReq) -> weave.trace_server.trace_server_interface.TableUpdateRes` - -No description available. - -##### `threads_query_stream(self, req: weave.trace_server.trace_server_interface.ThreadsQueryReq) -> collections.abc.Iterator` - -No description available. - -### TraceStatus - -An enumeration. - -### WeaveSummarySchema - -dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's - (key, value) pairs -dict(iterable) -> new dictionary initialized as if via: - d = \{\} - for k, v in iterable: - d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs - in the keyword argument list. For example: dict(one=1, two=2) - diff --git a/weave/reference/service-api.mdx b/weave/reference/service-api.mdx index b470220ff7..dab32695a0 100644 --- a/weave/reference/service-api.mdx +++ b/weave/reference/service-api.mdx @@ -84,4 +84,4 @@ curl -H "Authorization: Bearer YOUR_API_KEY" https://trace.wandb.ai/... ### Completions - **[POST /completions/create](https://docs.wandb.ai/weave/reference/service-api/completions/completions-create)** - Completions Create -- **[POST /completions/create_stream](https://docs.wandb.ai/weave/reference/service-api/completions/completions-create-stream)** - Completions Create Stream \ No newline at end of file +- **[POST /completions/create_stream](https://docs.wandb.ai/weave/reference/service-api/completions/completions-create-stream)** - Completions Create Stream diff --git a/weave/reference/typescript-sdk.mdx b/weave/reference/typescript-sdk.mdx index 2413f7fa71..022de0abb2 100644 --- a/weave/reference/typescript-sdk.mdx +++ b/weave/reference/typescript-sdk.mdx @@ -43,6 +43,7 @@ weave - [requirecurrentchildsummary](./typescript-sdk/functions/requirecurrentchildsummary) - [weaveaudio](./typescript-sdk/functions/weaveaudio) - [weaveimage](./typescript-sdk/functions/weaveimage) +- [withattributes](./typescript-sdk/functions/withattributes) - [wrapopenai](./typescript-sdk/functions/wrapopenai) ## Type Aliases diff --git a/weave/reference/typescript-sdk/classes/dataset.mdx b/weave/reference/typescript-sdk/classes/dataset.mdx index b754b0487c..c9672f7f31 100644 --- a/weave/reference/typescript-sdk/classes/dataset.mdx +++ b/weave/reference/typescript-sdk/classes/dataset.mdx @@ -93,7 +93,7 @@ const ref = await dataset.save() #### Defined in -[dataset.ts:51](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L51) +[dataset.ts:51](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L51) ## Properties @@ -107,7 +107,7 @@ const ref = await dataset.save() #### Defined in -[weaveObject.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L49) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L73) ___ @@ -117,7 +117,7 @@ ___ #### Defined in -[dataset.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L49) +[dataset.ts:49](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L49) ## Accessors @@ -135,7 +135,7 @@ WeaveObject.description #### Defined in -[weaveObject.ts:76](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L76) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L100) ___ @@ -149,7 +149,7 @@ ___ #### Defined in -[dataset.ts:64](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L64) +[dataset.ts:64](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L64) ___ @@ -167,7 +167,7 @@ WeaveObject.name #### Defined in -[weaveObject.ts:72](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L72) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -181,7 +181,7 @@ WeaveObject.name #### Defined in -[dataset.ts:68](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L68) +[dataset.ts:68](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L68) ___ @@ -201,7 +201,7 @@ ___ #### Defined in -[dataset.ts:74](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L74) +[dataset.ts:74](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L74) ___ @@ -215,7 +215,7 @@ ___ #### Defined in -[dataset.ts:60](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/dataset.ts#L60) +[dataset.ts:60](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/dataset.ts#L60) ___ @@ -233,4 +233,4 @@ ___ #### Defined in -[weaveObject.ts:53](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L53) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/evaluation.mdx b/weave/reference/typescript-sdk/classes/evaluation.mdx index f8ebfdfd98..8aa10336b0 100644 --- a/weave/reference/typescript-sdk/classes/evaluation.mdx +++ b/weave/reference/typescript-sdk/classes/evaluation.mdx @@ -112,7 +112,7 @@ const results = await evaluation.evaluate({ model }); #### Defined in -[evaluation.ts:148](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluation.ts#L148) +[evaluation.ts:148](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluation.ts#L148) ## Properties @@ -126,7 +126,7 @@ const results = await evaluation.evaluate({ model }); #### Defined in -[weaveObject.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L49) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L73) ## Accessors @@ -144,7 +144,7 @@ WeaveObject.description #### Defined in -[weaveObject.ts:76](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L76) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L100) ___ @@ -162,7 +162,7 @@ WeaveObject.name #### Defined in -[weaveObject.ts:72](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L72) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -185,7 +185,7 @@ WeaveObject.name #### Defined in -[evaluation.ts:163](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluation.ts#L163) +[evaluation.ts:163](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluation.ts#L163) ___ @@ -208,7 +208,7 @@ ___ #### Defined in -[evaluation.ts:231](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluation.ts#L231) +[evaluation.ts:231](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluation.ts#L231) ___ @@ -226,4 +226,4 @@ ___ #### Defined in -[weaveObject.ts:53](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L53) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx index 2a2b94e30e..1660dd9f4c 100644 --- a/weave/reference/typescript-sdk/classes/evaluationlogger.mdx +++ b/weave/reference/typescript-sdk/classes/evaluationlogger.mdx @@ -60,7 +60,7 @@ await ev.logSummary(); #### Defined in -[evaluationLogger.ts:554](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L554) +[evaluationLogger.ts:554](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L554) ## Methods @@ -98,7 +98,7 @@ await evalLogger.logSummary(); // Waits for everything #### Defined in -[evaluationLogger.ts:641](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L641) +[evaluationLogger.ts:641](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L641) ___ @@ -134,7 +134,7 @@ await scoreLogger.finish(); #### Defined in -[evaluationLogger.ts:666](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L666) +[evaluationLogger.ts:666](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L666) ___ @@ -160,4 +160,4 @@ it will wait for all pending operations to complete. #### Defined in -[evaluationLogger.ts:767](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L767) \ No newline at end of file +[evaluationLogger.ts:767](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L767) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/messagesprompt.mdx b/weave/reference/typescript-sdk/classes/messagesprompt.mdx index f0caa627f7..0b70c6fd94 100644 --- a/weave/reference/typescript-sdk/classes/messagesprompt.mdx +++ b/weave/reference/typescript-sdk/classes/messagesprompt.mdx @@ -33,6 +33,7 @@ description: "TypeScript SDK reference" - [format](./messagesprompt#format) - [saveAttrs](./messagesprompt#saveattrs) +- [get](./messagesprompt#get) ## Constructors @@ -56,7 +57,7 @@ Prompt.constructor #### Defined in -[prompt.ts:33](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L33) +[prompt.ts:40](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L40) ## Properties @@ -70,7 +71,7 @@ Prompt.\_\_savedRef #### Defined in -[weaveObject.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L49) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L73) ___ @@ -80,7 +81,7 @@ ___ #### Defined in -[prompt.ts:31](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L31) +[prompt.ts:38](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L38) ## Accessors @@ -98,7 +99,7 @@ Prompt.description #### Defined in -[weaveObject.ts:76](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L76) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L100) ___ @@ -116,7 +117,7 @@ Prompt.name #### Defined in -[weaveObject.ts:72](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L72) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -136,7 +137,7 @@ Prompt.name #### Defined in -[prompt.ts:60](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L60) +[prompt.ts:67](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L67) ___ @@ -154,4 +155,25 @@ Prompt.saveAttrs #### Defined in -[weaveObject.ts:53](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L53) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L77) + +___ + +### get + +▸ **get**(`client`, `uri`): `Promise`\<[`MessagesPrompt`](./messagesprompt)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `client` | [`WeaveClient`](./weaveclient) | +| `uri` | `string` | + +#### Returns + +`Promise`\<[`MessagesPrompt`](./messagesprompt)\> + +#### Defined in + +[prompt.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L73) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/objectref.mdx b/weave/reference/typescript-sdk/classes/objectref.mdx index f6d1d03a99..3803d9406a 100644 --- a/weave/reference/typescript-sdk/classes/objectref.mdx +++ b/weave/reference/typescript-sdk/classes/objectref.mdx @@ -38,6 +38,7 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 - [get](./objectref#get) - [ui\_url](./objectref#ui_url) - [uri](./objectref#uri) +- [fromUri](./objectref#fromuri) ## Constructors @@ -59,7 +60,7 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 #### Defined in -[weaveObject.ts:25](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L25) +[weaveObject.ts:26](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L26) ## Properties @@ -69,7 +70,7 @@ const uri = ref.uri(); // weave:///my-project/object/abc123:def456 #### Defined in -[weaveObject.ts:28](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L28) +[weaveObject.ts:29](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L29) ___ @@ -79,7 +80,7 @@ ___ #### Defined in -[weaveObject.ts:27](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L27) +[weaveObject.ts:28](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L28) ___ @@ -89,7 +90,7 @@ ___ #### Defined in -[weaveObject.ts:26](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L26) +[weaveObject.ts:27](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L27) ## Methods @@ -103,7 +104,7 @@ ___ #### Defined in -[weaveObject.ts:42](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L42) +[weaveObject.ts:66](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L66) ___ @@ -117,7 +118,7 @@ ___ #### Defined in -[weaveObject.ts:37](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L37) +[weaveObject.ts:61](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L61) ___ @@ -131,4 +132,38 @@ ___ #### Defined in -[weaveObject.ts:33](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L33) \ No newline at end of file +[weaveObject.ts:57](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L57) + +___ + +### fromUri + +▸ **fromUri**(`uri`): [`ObjectRef`](./objectref) + +Creates an ObjectRef from a Weave URI string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `uri` | `string` | A Weave URI in the format: weave:///entity/project/object/name:digest | + +#### Returns + +[`ObjectRef`](./objectref) + +A new ObjectRef instance + +`Throws` + +Error if the URI format is invalid or not an object ref + +`Example` + +```ts +const ref = ObjectRef.fromUri('weave:///my-entity/my-project/object/my-dataset:abc123'); +``` + +#### Defined in + +[weaveObject.ts:44](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L44) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/scorelogger.mdx b/weave/reference/typescript-sdk/classes/scorelogger.mdx index 2acd31fe6f..6ac96b8973 100644 --- a/weave/reference/typescript-sdk/classes/scorelogger.mdx +++ b/weave/reference/typescript-sdk/classes/scorelogger.mdx @@ -52,7 +52,7 @@ await pred.finish(); // Finalizes the prediction #### Defined in -[evaluationLogger.ts:319](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L319) +[evaluationLogger.ts:319](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L319) ## Accessors @@ -69,7 +69,7 @@ Used by EvaluationLogger to detect unfinished predictions. #### Defined in -[evaluationLogger.ts:349](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L349) +[evaluationLogger.ts:349](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L349) ## Methods @@ -87,7 +87,7 @@ Updates incremental aggregates and frees memory. #### Defined in -[evaluationLogger.ts:451](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L451) +[evaluationLogger.ts:451](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L451) ___ @@ -111,4 +111,4 @@ Creates a scorer call as a child of predict_and_score. #### Defined in -[evaluationLogger.ts:360](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/evaluationLogger.ts#L360) \ No newline at end of file +[evaluationLogger.ts:360](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/evaluationLogger.ts#L360) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/stringprompt.mdx b/weave/reference/typescript-sdk/classes/stringprompt.mdx index d5aa35cd8a..5a4bd8c354 100644 --- a/weave/reference/typescript-sdk/classes/stringprompt.mdx +++ b/weave/reference/typescript-sdk/classes/stringprompt.mdx @@ -33,6 +33,7 @@ description: "TypeScript SDK reference" - [format](./stringprompt#format) - [saveAttrs](./stringprompt#saveattrs) +- [get](./stringprompt#get) ## Constructors @@ -56,7 +57,7 @@ Prompt.constructor #### Defined in -[prompt.ts:16](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L16) +[prompt.ts:17](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L17) ## Properties @@ -70,7 +71,7 @@ Prompt.\_\_savedRef #### Defined in -[weaveObject.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L49) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L73) ___ @@ -80,7 +81,7 @@ ___ #### Defined in -[prompt.ts:14](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L14) +[prompt.ts:15](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L15) ## Accessors @@ -98,7 +99,7 @@ Prompt.description #### Defined in -[weaveObject.ts:76](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L76) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L100) ___ @@ -116,7 +117,7 @@ Prompt.name #### Defined in -[weaveObject.ts:72](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L72) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -136,7 +137,7 @@ Prompt.name #### Defined in -[prompt.ts:21](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/prompt.ts#L21) +[prompt.ts:22](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L22) ___ @@ -154,4 +155,25 @@ Prompt.saveAttrs #### Defined in -[weaveObject.ts:53](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L53) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L77) + +___ + +### get + +▸ **get**(`client`, `uri`): `Promise`\<[`StringPrompt`](./stringprompt)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `client` | [`WeaveClient`](./weaveclient) | +| `uri` | `string` | + +#### Returns + +`Promise`\<[`StringPrompt`](./stringprompt)\> + +#### Defined in + +[prompt.ts:26](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/prompt.ts#L26) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveclient.mdx b/weave/reference/typescript-sdk/classes/weaveclient.mdx index 811f8fda0f..659269e2e8 100644 --- a/weave/reference/typescript-sdk/classes/weaveclient.mdx +++ b/weave/reference/typescript-sdk/classes/weaveclient.mdx @@ -30,8 +30,10 @@ description: "TypeScript SDK reference" - [getCallStack](./weaveclient#getcallstack) - [getCalls](./weaveclient#getcalls) - [getCallsIterator](./weaveclient#getcallsiterator) +- [getCurrentAttributes](./weaveclient#getcurrentattributes) - [publish](./weaveclient#publish) - [pushNewCall](./weaveclient#pushnewcall) +- [runWithAttributes](./weaveclient#runwithattributes) - [runWithCallStack](./weaveclient#runwithcallstack) - [saveOp](./weaveclient#saveop) - [updateCall](./weaveclient#updatecall) @@ -58,7 +60,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveClient.ts:92](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L92) +[weaveClient.ts:93](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L93) ## Properties @@ -68,7 +70,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveClient.ts:95](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L95) +[weaveClient.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L96) ___ @@ -78,7 +80,7 @@ ___ #### Defined in -[weaveClient.ts:96](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L96) +[weaveClient.ts:97](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L97) ___ @@ -88,7 +90,7 @@ ___ #### Defined in -[weaveClient.ts:93](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L93) +[weaveClient.ts:94](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L94) ## Methods @@ -114,7 +116,7 @@ Used in imperative evaluation to attach scorer results to predict calls. #### Defined in -[weaveClient.ts:847](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L847) +[weaveClient.ts:865](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L865) ___ @@ -143,7 +145,7 @@ ___ #### Defined in -[weaveClient.ts:707](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L707) +[weaveClient.ts:720](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L720) ___ @@ -169,7 +171,7 @@ ___ #### Defined in -[weaveClient.ts:754](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L754) +[weaveClient.ts:772](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L772) ___ @@ -194,7 +196,7 @@ ___ #### Defined in -[weaveClient.ts:794](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L794) +[weaveClient.ts:812](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L812) ___ @@ -214,7 +216,7 @@ ___ #### Defined in -[weaveClient.ts:281](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L281) +[weaveClient.ts:282](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L282) ___ @@ -235,7 +237,7 @@ ___ #### Defined in -[weaveClient.ts:212](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L212) +[weaveClient.ts:213](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L213) ___ @@ -249,7 +251,7 @@ ___ #### Defined in -[weaveClient.ts:635](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L635) +[weaveClient.ts:636](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L636) ___ @@ -271,7 +273,7 @@ ___ #### Defined in -[weaveClient.ts:222](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L222) +[weaveClient.ts:223](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L223) ___ @@ -293,7 +295,21 @@ ___ #### Defined in -[weaveClient.ts:236](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L236) +[weaveClient.ts:237](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L237) + +___ + +### getCurrentAttributes + +▸ **getCurrentAttributes**(): `Record`\<`string`, `any`\> + +#### Returns + +`Record`\<`string`, `any`\> + +#### Defined in + +[weaveClient.ts:640](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L640) ___ @@ -314,7 +330,7 @@ ___ #### Defined in -[weaveClient.ts:200](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L200) +[weaveClient.ts:201](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L201) ___ @@ -334,7 +350,34 @@ ___ #### Defined in -[weaveClient.ts:639](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L639) +[weaveClient.ts:644](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L644) + +___ + +### runWithAttributes + +▸ **runWithAttributes**\<`T`\>(`attributes`, `fn`): `T` + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `attributes` | `Record`\<`string`, `any`\> | +| `fn` | () => `T` | + +#### Returns + +`T` + +#### Defined in + +[weaveClient.ts:652](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L652) ___ @@ -361,7 +404,7 @@ ___ #### Defined in -[weaveClient.ts:643](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L643) +[weaveClient.ts:648](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L648) ___ @@ -382,7 +425,7 @@ ___ #### Defined in -[weaveClient.ts:673](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L673) +[weaveClient.ts:686](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L686) ___ @@ -403,7 +446,7 @@ ___ #### Defined in -[weaveClient.ts:830](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L830) +[weaveClient.ts:848](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L848) ___ @@ -417,4 +460,4 @@ ___ #### Defined in -[weaveClient.ts:113](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveClient.ts#L113) \ No newline at end of file +[weaveClient.ts:114](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveClient.ts#L114) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/classes/weaveobject.mdx b/weave/reference/typescript-sdk/classes/weaveobject.mdx index 53015b3adc..26e1a1cf9d 100644 --- a/weave/reference/typescript-sdk/classes/weaveobject.mdx +++ b/weave/reference/typescript-sdk/classes/weaveobject.mdx @@ -52,7 +52,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:51](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L51) +[weaveObject.ts:75](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L75) ## Properties @@ -62,7 +62,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:49](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L49) +[weaveObject.ts:73](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L73) ## Accessors @@ -76,7 +76,7 @@ description: "TypeScript SDK reference" #### Defined in -[weaveObject.ts:76](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L76) +[weaveObject.ts:100](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L100) ___ @@ -90,7 +90,7 @@ ___ #### Defined in -[weaveObject.ts:72](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L72) +[weaveObject.ts:96](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L96) ## Methods @@ -104,4 +104,4 @@ ___ #### Defined in -[weaveObject.ts:53](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/weaveObject.ts#L53) \ No newline at end of file +[weaveObject.ts:77](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/weaveObject.ts#L77) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/functions/init.mdx b/weave/reference/typescript-sdk/functions/init.mdx index d4551d5ce6..e33fad6cec 100644 --- a/weave/reference/typescript-sdk/functions/init.mdx +++ b/weave/reference/typescript-sdk/functions/init.mdx @@ -14,7 +14,7 @@ Initialize the Weave client, which is required for weave tracing to work. | Name | Type | Description | | :------ | :------ | :------ | | `project` | `string` | The W&B project name (can be project or entity/project). If you don't specify a W&B team (e.g., 'team/project'), your default entity is used. To find or update your default entity, refer to User Settings at https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team | -| `settings?` | `Settings` | (Optional) Weave tracing settings | +| `settings?` | `SettingsInit` | (Optional) Weave tracing settings | #### Returns @@ -28,6 +28,6 @@ If the initialization fails #### Defined in -[clientApi.ts:83](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/clientApi.ts#L83) +[clientApi.ts:83](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L83) ___ diff --git a/weave/reference/typescript-sdk/functions/login.mdx b/weave/reference/typescript-sdk/functions/login.mdx index 850afc46ba..3a47225cc0 100644 --- a/weave/reference/typescript-sdk/functions/login.mdx +++ b/weave/reference/typescript-sdk/functions/login.mdx @@ -28,6 +28,6 @@ If the API key is not specified or if the connection to the weave trace server c #### Defined in -[clientApi.ts:23](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/clientApi.ts#L23) +[clientApi.ts:23](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L23) ___ diff --git a/weave/reference/typescript-sdk/functions/op.mdx b/weave/reference/typescript-sdk/functions/op.mdx index 366f40f01c..98753900a9 100644 --- a/weave/reference/typescript-sdk/functions/op.mdx +++ b/weave/reference/typescript-sdk/functions/op.mdx @@ -26,7 +26,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:369](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/op.ts#L369) +[op.ts:369](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/op.ts#L369) ▸ **op**\<`T`\>(`thisArg`, `fn`, `options?`): [`Op`](../type-aliases/op)\<`T`\> @@ -50,7 +50,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:374](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/op.ts#L374) +[op.ts:374](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/op.ts#L374) ▸ **op**(`target`, `propertyKey`, `descriptor`): `TypedPropertyDescriptor`\<`any`\> @@ -68,7 +68,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:380](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/op.ts#L380) +[op.ts:380](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/op.ts#L380) ▸ **op**\<`T`\>(`value`, `context`): [`Op`](../type-aliases/op)\<`T`\> @@ -91,7 +91,7 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:386](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/op.ts#L386) +[op.ts:386](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/op.ts#L386) ▸ **op**(`options`): `MethodDecorator` @@ -107,6 +107,6 @@ description: "TypeScript SDK reference" #### Defined in -[op.ts:391](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/op.ts#L391) +[op.ts:391](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/op.ts#L391) ___ diff --git a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx index 9fc49ddc98..fb278b2932 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentcallstackentry.mdx @@ -13,6 +13,6 @@ description: "TypeScript SDK reference" #### Defined in -[clientApi.ts:145](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/clientApi.ts#L145) +[clientApi.ts:147](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L147) ___ diff --git a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx index 406b7c6250..86a53ef7e6 100644 --- a/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx +++ b/weave/reference/typescript-sdk/functions/requirecurrentchildsummary.mdx @@ -13,6 +13,6 @@ description: "TypeScript SDK reference" #### Defined in -[clientApi.ts:157](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/clientApi.ts#L157) +[clientApi.ts:159](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L159) ___ diff --git a/weave/reference/typescript-sdk/functions/weaveaudio.mdx b/weave/reference/typescript-sdk/functions/weaveaudio.mdx index a877174ea4..334c4ab568 100644 --- a/weave/reference/typescript-sdk/functions/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/functions/weaveaudio.mdx @@ -28,6 +28,6 @@ const weaveAudio = weaveAudio({ data: audioBuffer }); #### Defined in -[media.ts:62](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L62) +[media.ts:62](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L62) ___ diff --git a/weave/reference/typescript-sdk/functions/weaveimage.mdx b/weave/reference/typescript-sdk/functions/weaveimage.mdx index 509ed16a31..3c896254dd 100644 --- a/weave/reference/typescript-sdk/functions/weaveimage.mdx +++ b/weave/reference/typescript-sdk/functions/weaveimage.mdx @@ -28,6 +28,6 @@ const weaveImage = weaveImage({ data: imageBuffer }); #### Defined in -[media.ts:28](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L28) +[media.ts:28](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L28) ___ diff --git a/weave/reference/typescript-sdk/functions/withattributes.mdx b/weave/reference/typescript-sdk/functions/withattributes.mdx new file mode 100644 index 0000000000..c08d440cc9 --- /dev/null +++ b/weave/reference/typescript-sdk/functions/withattributes.mdx @@ -0,0 +1,43 @@ +--- +title: "withAttributes" +description: "TypeScript SDK reference" +--- + +# withAttributes + +▸ **withAttributes**\<`T`\>(`attrs`, `fn`): `Promise`\<`T`\> \| `T` + +Attach attributes to the current execution context so that any calls created +inside `fn` automatically inherit them. Attributes are written to the call +record on the trace server and surface in the Weave UI/filtering, so they’re +ideal for tagging runs with request IDs, tenants, experiments, etc. + +Example: +```ts +await withAttributes({requestId: 'abc'}, async () => { + await myOp(); +}); +``` + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `attrs` | `Record`\<`string`, `any`\> | +| `fn` | () => `T` \| `Promise`\<`T`\> | + +#### Returns + +`Promise`\<`T`\> \| `T` + +#### Defined in + +[clientApi.ts:193](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L193) + +___ diff --git a/weave/reference/typescript-sdk/functions/wrapopenai.mdx b/weave/reference/typescript-sdk/functions/wrapopenai.mdx index f9dbca5a58..b20847c779 100644 --- a/weave/reference/typescript-sdk/functions/wrapopenai.mdx +++ b/weave/reference/typescript-sdk/functions/wrapopenai.mdx @@ -37,4 +37,4 @@ const result = await openai.chat.completions.create({ #### Defined in -[integrations/openai.ts:469](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/integrations/openai.ts#L469) \ No newline at end of file +[integrations/openai.ts:469](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/integrations/openai.ts#L469) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/callschema.mdx b/weave/reference/typescript-sdk/interfaces/callschema.mdx index 488d34ded0..79425bff77 100644 --- a/weave/reference/typescript-sdk/interfaces/callschema.mdx +++ b/weave/reference/typescript-sdk/interfaces/callschema.mdx @@ -40,7 +40,7 @@ Attributes #### Defined in -[generated/traceServerApi.ts:118](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L118) +[generated/traceServerApi.ts:118](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L118) ___ @@ -52,7 +52,7 @@ Deleted At #### Defined in -[generated/traceServerApi.ts:133](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L133) +[generated/traceServerApi.ts:133](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L133) ___ @@ -64,7 +64,7 @@ Display Name #### Defined in -[generated/traceServerApi.ts:107](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L107) +[generated/traceServerApi.ts:107](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L107) ___ @@ -76,7 +76,7 @@ Ended At #### Defined in -[generated/traceServerApi.ts:122](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L122) +[generated/traceServerApi.ts:122](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L122) ___ @@ -88,7 +88,7 @@ Exception #### Defined in -[generated/traceServerApi.ts:124](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L124) +[generated/traceServerApi.ts:124](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L124) ___ @@ -100,7 +100,7 @@ Id #### Defined in -[generated/traceServerApi.ts:101](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L101) +[generated/traceServerApi.ts:101](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L101) ___ @@ -112,7 +112,7 @@ Inputs #### Defined in -[generated/traceServerApi.ts:120](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L120) +[generated/traceServerApi.ts:120](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L120) ___ @@ -124,7 +124,7 @@ Op Name #### Defined in -[generated/traceServerApi.ts:105](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L105) +[generated/traceServerApi.ts:105](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L105) ___ @@ -136,7 +136,7 @@ Output #### Defined in -[generated/traceServerApi.ts:126](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L126) +[generated/traceServerApi.ts:126](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L126) ___ @@ -148,7 +148,7 @@ Parent Id #### Defined in -[generated/traceServerApi.ts:111](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L111) +[generated/traceServerApi.ts:111](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L111) ___ @@ -160,7 +160,7 @@ Project Id #### Defined in -[generated/traceServerApi.ts:103](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L103) +[generated/traceServerApi.ts:103](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L103) ___ @@ -176,7 +176,7 @@ date-time #### Defined in -[generated/traceServerApi.ts:116](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L116) +[generated/traceServerApi.ts:116](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L116) ___ @@ -186,7 +186,7 @@ ___ #### Defined in -[generated/traceServerApi.ts:127](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L127) +[generated/traceServerApi.ts:127](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L127) ___ @@ -198,7 +198,7 @@ Trace Id #### Defined in -[generated/traceServerApi.ts:109](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L109) +[generated/traceServerApi.ts:109](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L109) ___ @@ -210,7 +210,7 @@ Wb Run Id #### Defined in -[generated/traceServerApi.ts:131](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L131) +[generated/traceServerApi.ts:131](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L131) ___ @@ -222,4 +222,4 @@ Wb User Id #### Defined in -[generated/traceServerApi.ts:129](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L129) \ No newline at end of file +[generated/traceServerApi.ts:129](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L129) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx index 1c7397ff7a..a00264fcf4 100644 --- a/weave/reference/typescript-sdk/interfaces/callsfilter.mdx +++ b/weave/reference/typescript-sdk/interfaces/callsfilter.mdx @@ -33,7 +33,7 @@ Call Ids #### Defined in -[generated/traceServerApi.ts:196](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L196) +[generated/traceServerApi.ts:196](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L196) ___ @@ -45,7 +45,7 @@ Input Refs #### Defined in -[generated/traceServerApi.ts:188](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L188) +[generated/traceServerApi.ts:188](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L188) ___ @@ -57,7 +57,7 @@ Op Names #### Defined in -[generated/traceServerApi.ts:186](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L186) +[generated/traceServerApi.ts:186](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L186) ___ @@ -69,7 +69,7 @@ Output Refs #### Defined in -[generated/traceServerApi.ts:190](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L190) +[generated/traceServerApi.ts:190](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L190) ___ @@ -81,7 +81,7 @@ Parent Ids #### Defined in -[generated/traceServerApi.ts:192](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L192) +[generated/traceServerApi.ts:192](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L192) ___ @@ -93,7 +93,7 @@ Trace Ids #### Defined in -[generated/traceServerApi.ts:194](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L194) +[generated/traceServerApi.ts:194](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L194) ___ @@ -105,7 +105,7 @@ Trace Roots Only #### Defined in -[generated/traceServerApi.ts:198](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L198) +[generated/traceServerApi.ts:198](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L198) ___ @@ -117,7 +117,7 @@ Wb Run Ids #### Defined in -[generated/traceServerApi.ts:202](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L202) +[generated/traceServerApi.ts:202](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L202) ___ @@ -129,4 +129,4 @@ Wb User Ids #### Defined in -[generated/traceServerApi.ts:200](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/generated/traceServerApi.ts#L200) \ No newline at end of file +[generated/traceServerApi.ts:200](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/generated/traceServerApi.ts#L200) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx index d2d645eabf..06ef7a7802 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveaudio.mdx @@ -29,7 +29,7 @@ description: "TypeScript SDK reference" #### Defined in -[media.ts:48](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L48) +[media.ts:48](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L48) ___ @@ -43,7 +43,7 @@ WeaveAudioInput.audioType #### Defined in -[media.ts:44](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L44) +[media.ts:44](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L44) ___ @@ -57,4 +57,4 @@ WeaveAudioInput.data #### Defined in -[media.ts:43](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L43) \ No newline at end of file +[media.ts:43](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L43) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx index 3ec09da6bc..9ba005e18c 100644 --- a/weave/reference/typescript-sdk/interfaces/weaveimage.mdx +++ b/weave/reference/typescript-sdk/interfaces/weaveimage.mdx @@ -29,7 +29,7 @@ description: "TypeScript SDK reference" #### Defined in -[media.ts:14](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L14) +[media.ts:14](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L14) ___ @@ -43,7 +43,7 @@ WeaveImageInput.data #### Defined in -[media.ts:9](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L9) +[media.ts:9](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L9) ___ @@ -57,4 +57,4 @@ WeaveImageInput.imageType #### Defined in -[media.ts:10](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/media.ts#L10) \ No newline at end of file +[media.ts:10](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/media.ts#L10) \ No newline at end of file diff --git a/weave/reference/typescript-sdk/type-aliases/op.mdx b/weave/reference/typescript-sdk/type-aliases/op.mdx index 84c4ff6c80..7c5a79f1f2 100644 --- a/weave/reference/typescript-sdk/type-aliases/op.mdx +++ b/weave/reference/typescript-sdk/type-aliases/op.mdx @@ -15,6 +15,6 @@ description: "TypeScript SDK reference" #### Defined in -[opType.ts:7](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/opType.ts#L7) +[opType.ts:7](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/opType.ts#L7) ___ diff --git a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx index 6dccb7121d..42fdcc3e5e 100644 --- a/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx +++ b/weave/reference/typescript-sdk/type-aliases/opdecorator.mdx @@ -27,7 +27,7 @@ For legacy decorators: #### Defined in -[opType.ts:41](https://github.com/wandb/weave/blob/01ba25415eecdd98ace095491cc3bdfc7f4ba384/sdks/node/src/opType.ts#L41) +[opType.ts:41](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/opType.ts#L41) ## Functions @@ -38,3 +38,4 @@ For legacy decorators: +