├── .devcontainer
├── Dockerfile
└── devcontainer.json
├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE
│ └── bug.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── pre-commit.yml
│ └── publish-to-test-pypi.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── .ruff.toml
├── .stats.yml
├── Brewfile
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── api.md
├── bin
└── publish-pypi
├── docs
└── cli_reference.md
├── examples
├── .keep
├── mcp_agent.py
└── post_training
│ └── supervised_fine_tune_client.py
├── mypy.ini
├── noxfile.py
├── pyproject.toml
├── requirements-dev.lock
├── requirements.lock
├── requirements.txt
├── scripts
├── bootstrap
├── format
├── gen_cli_doc.py
├── lint
├── mock
├── test
└── utils
│ └── ruffen-docs.py
├── src
└── llama_stack_client
│ ├── __init__.py
│ ├── _base_client.py
│ ├── _client.py
│ ├── _compat.py
│ ├── _constants.py
│ ├── _exceptions.py
│ ├── _files.py
│ ├── _models.py
│ ├── _qs.py
│ ├── _resource.py
│ ├── _response.py
│ ├── _streaming.py
│ ├── _types.py
│ ├── _utils
│ ├── __init__.py
│ ├── _logs.py
│ ├── _proxy.py
│ ├── _reflection.py
│ ├── _resources_proxy.py
│ ├── _streams.py
│ ├── _sync.py
│ ├── _transform.py
│ ├── _typing.py
│ └── _utils.py
│ ├── _version.py
│ ├── _wrappers.py
│ ├── lib
│ ├── .keep
│ ├── __init__.py
│ ├── agents
│ │ ├── __init__.py
│ │ ├── agent.py
│ │ ├── client_tool.py
│ │ ├── event_logger.py
│ │ ├── react
│ │ │ ├── __init__.py
│ │ │ ├── agent.py
│ │ │ ├── prompts.py
│ │ │ └── tool_parser.py
│ │ └── tool_parser.py
│ ├── cli
│ │ ├── __init__.py
│ │ ├── common
│ │ │ ├── __init__.py
│ │ │ └── utils.py
│ │ ├── configure.py
│ │ ├── constants.py
│ │ ├── datasets
│ │ │ ├── __init__.py
│ │ │ ├── datasets.py
│ │ │ ├── list.py
│ │ │ ├── register.py
│ │ │ └── unregister.py
│ │ ├── eval
│ │ │ ├── __init__.py
│ │ │ ├── eval.py
│ │ │ ├── run_benchmark.py
│ │ │ ├── run_scoring.py
│ │ │ └── utils.py
│ │ ├── eval_tasks
│ │ │ ├── __init__.py
│ │ │ ├── eval_tasks.py
│ │ │ └── list.py
│ │ ├── inference
│ │ │ ├── __init__.py
│ │ │ └── inference.py
│ │ ├── inspect
│ │ │ ├── __init__.py
│ │ │ ├── inspect.py
│ │ │ └── version.py
│ │ ├── llama_stack_client.py
│ │ ├── models
│ │ │ ├── __init__.py
│ │ │ └── models.py
│ │ ├── post_training
│ │ │ ├── __init__.py
│ │ │ └── post_training.py
│ │ ├── providers
│ │ │ ├── __init__.py
│ │ │ ├── inspect.py
│ │ │ ├── list.py
│ │ │ └── providers.py
│ │ ├── scoring_functions
│ │ │ ├── __init__.py
│ │ │ ├── list.py
│ │ │ └── scoring_functions.py
│ │ ├── shields
│ │ │ ├── __init__.py
│ │ │ └── shields.py
│ │ ├── toolgroups
│ │ │ ├── __init__.py
│ │ │ └── toolgroups.py
│ │ └── vector_dbs
│ │ │ ├── __init__.py
│ │ │ └── vector_dbs.py
│ ├── inference
│ │ ├── __init__.py
│ │ ├── event_logger.py
│ │ └── utils.py
│ ├── inline
│ │ └── inline.py
│ ├── stream_printer.py
│ └── tools
│ │ └── mcp_oauth.py
│ ├── pagination.py
│ ├── py.typed
│ ├── resources
│ ├── __init__.py
│ ├── agents
│ │ ├── __init__.py
│ │ ├── agents.py
│ │ ├── session.py
│ │ ├── steps.py
│ │ └── turn.py
│ ├── benchmarks.py
│ ├── chat
│ │ ├── __init__.py
│ │ ├── chat.py
│ │ └── completions.py
│ ├── completions.py
│ ├── datasets.py
│ ├── eval
│ │ ├── __init__.py
│ │ ├── eval.py
│ │ └── jobs.py
│ ├── inference.py
│ ├── inspect.py
│ ├── models.py
│ ├── post_training
│ │ ├── __init__.py
│ │ ├── job.py
│ │ └── post_training.py
│ ├── providers.py
│ ├── responses.py
│ ├── routes.py
│ ├── safety.py
│ ├── scoring.py
│ ├── scoring_functions.py
│ ├── shields.py
│ ├── synthetic_data_generation.py
│ ├── telemetry.py
│ ├── tool_runtime
│ │ ├── __init__.py
│ │ ├── rag_tool.py
│ │ └── tool_runtime.py
│ ├── toolgroups.py
│ ├── tools.py
│ ├── vector_dbs.py
│ └── vector_io.py
│ └── types
│ ├── __init__.py
│ ├── agent_create_params.py
│ ├── agent_create_response.py
│ ├── agents
│ ├── __init__.py
│ ├── agent_turn_response_stream_chunk.py
│ ├── session.py
│ ├── session_create_params.py
│ ├── session_create_response.py
│ ├── session_retrieve_params.py
│ ├── step_retrieve_response.py
│ ├── turn.py
│ ├── turn_create_params.py
│ ├── turn_response_event.py
│ ├── turn_response_event_payload.py
│ └── turn_resume_params.py
│ ├── algorithm_config_param.py
│ ├── benchmark.py
│ ├── benchmark_config_param.py
│ ├── benchmark_list_response.py
│ ├── benchmark_register_params.py
│ ├── chat
│ ├── __init__.py
│ ├── completion_create_params.py
│ ├── completion_create_response.py
│ ├── completion_list_params.py
│ ├── completion_list_response.py
│ └── completion_retrieve_response.py
│ ├── chat_completion_chunk.py
│ ├── chat_completion_response_stream_chunk.py
│ ├── completion_create_params.py
│ ├── completion_create_response.py
│ ├── completion_response.py
│ ├── dataset_iterrows_params.py
│ ├── dataset_iterrows_response.py
│ ├── dataset_list_response.py
│ ├── dataset_register_params.py
│ ├── dataset_register_response.py
│ ├── dataset_retrieve_response.py
│ ├── embeddings_response.py
│ ├── eval
│ └── __init__.py
│ ├── eval_candidate_param.py
│ ├── eval_evaluate_rows_alpha_params.py
│ ├── eval_evaluate_rows_params.py
│ ├── eval_run_eval_alpha_params.py
│ ├── eval_run_eval_params.py
│ ├── evaluate_response.py
│ ├── event_param.py
│ ├── health_info.py
│ ├── inference_batch_chat_completion_params.py
│ ├── inference_batch_chat_completion_response.py
│ ├── inference_batch_completion_params.py
│ ├── inference_chat_completion_params.py
│ ├── inference_completion_params.py
│ ├── inference_embeddings_params.py
│ ├── inference_step.py
│ ├── job.py
│ ├── list_benchmarks_response.py
│ ├── list_datasets_response.py
│ ├── list_models_response.py
│ ├── list_post_training_jobs_response.py
│ ├── list_providers_response.py
│ ├── list_routes_response.py
│ ├── list_scoring_functions_response.py
│ ├── list_shields_response.py
│ ├── list_tool_groups_response.py
│ ├── list_tools_response.py
│ ├── list_vector_dbs_response.py
│ ├── memory_retrieval_step.py
│ ├── model.py
│ ├── model_list_response.py
│ ├── model_register_params.py
│ ├── post_training
│ ├── __init__.py
│ ├── job_artifacts_params.py
│ ├── job_artifacts_response.py
│ ├── job_cancel_params.py
│ ├── job_list_response.py
│ ├── job_status_params.py
│ └── job_status_response.py
│ ├── post_training_job.py
│ ├── post_training_preference_optimize_params.py
│ ├── post_training_supervised_fine_tune_params.py
│ ├── provider_info.py
│ ├── provider_list_response.py
│ ├── query_chunks_response.py
│ ├── query_condition_param.py
│ ├── query_spans_response.py
│ ├── response_create_params.py
│ ├── response_object.py
│ ├── response_object_stream.py
│ ├── route_info.py
│ ├── route_list_response.py
│ ├── run_shield_response.py
│ ├── safety_run_shield_params.py
│ ├── scoring_fn.py
│ ├── scoring_fn_params.py
│ ├── scoring_fn_params_param.py
│ ├── scoring_function_list_response.py
│ ├── scoring_function_register_params.py
│ ├── scoring_score_batch_params.py
│ ├── scoring_score_batch_response.py
│ ├── scoring_score_params.py
│ ├── scoring_score_response.py
│ ├── shared
│ ├── __init__.py
│ ├── agent_config.py
│ ├── batch_completion.py
│ ├── chat_completion_response.py
│ ├── completion_message.py
│ ├── content_delta.py
│ ├── document.py
│ ├── interleaved_content.py
│ ├── interleaved_content_item.py
│ ├── message.py
│ ├── param_type.py
│ ├── query_config.py
│ ├── query_generator_config.py
│ ├── query_result.py
│ ├── response_format.py
│ ├── return_type.py
│ ├── safety_violation.py
│ ├── sampling_params.py
│ ├── scoring_result.py
│ ├── system_message.py
│ ├── tool_call.py
│ ├── tool_call_or_string.py
│ ├── tool_param_definition.py
│ ├── tool_response_message.py
│ └── user_message.py
│ ├── shared_params
│ ├── __init__.py
│ ├── agent_config.py
│ ├── completion_message.py
│ ├── document.py
│ ├── interleaved_content.py
│ ├── interleaved_content_item.py
│ ├── message.py
│ ├── query_config.py
│ ├── query_generator_config.py
│ ├── response_format.py
│ ├── return_type.py
│ ├── sampling_params.py
│ ├── system_message.py
│ ├── tool_call.py
│ ├── tool_param_definition.py
│ ├── tool_response_message.py
│ └── user_message.py
│ ├── shield.py
│ ├── shield_call_step.py
│ ├── shield_list_response.py
│ ├── shield_register_params.py
│ ├── span_with_status.py
│ ├── synthetic_data_generation_generate_params.py
│ ├── synthetic_data_generation_response.py
│ ├── telemetry_get_span_response.py
│ ├── telemetry_get_span_tree_params.py
│ ├── telemetry_get_span_tree_response.py
│ ├── telemetry_log_event_params.py
│ ├── telemetry_query_spans_params.py
│ ├── telemetry_query_spans_response.py
│ ├── telemetry_query_traces_params.py
│ ├── telemetry_query_traces_response.py
│ ├── telemetry_save_spans_to_dataset_params.py
│ ├── token_log_probs.py
│ ├── tool.py
│ ├── tool_def.py
│ ├── tool_def_param.py
│ ├── tool_execution_step.py
│ ├── tool_group.py
│ ├── tool_invocation_result.py
│ ├── tool_list_params.py
│ ├── tool_list_response.py
│ ├── tool_response.py
│ ├── tool_response_param.py
│ ├── tool_runtime
│ ├── __init__.py
│ ├── rag_tool_insert_params.py
│ └── rag_tool_query_params.py
│ ├── tool_runtime_invoke_tool_params.py
│ ├── tool_runtime_list_tools_params.py
│ ├── tool_runtime_list_tools_response.py
│ ├── toolgroup_list_response.py
│ ├── toolgroup_register_params.py
│ ├── trace.py
│ ├── vector_db_list_response.py
│ ├── vector_db_register_params.py
│ ├── vector_db_register_response.py
│ ├── vector_db_retrieve_response.py
│ ├── vector_io_insert_params.py
│ ├── vector_io_query_params.py
│ └── version_info.py
├── tests
├── __init__.py
├── api_resources
│ ├── __init__.py
│ ├── agents
│ │ ├── __init__.py
│ │ ├── test_session.py
│ │ ├── test_steps.py
│ │ └── test_turn.py
│ ├── chat
│ │ ├── __init__.py
│ │ └── test_completions.py
│ ├── eval
│ │ ├── __init__.py
│ │ └── test_jobs.py
│ ├── post_training
│ │ ├── __init__.py
│ │ └── test_job.py
│ ├── test_agents.py
│ ├── test_benchmarks.py
│ ├── test_completions.py
│ ├── test_datasets.py
│ ├── test_eval.py
│ ├── test_inference.py
│ ├── test_inspect.py
│ ├── test_models.py
│ ├── test_post_training.py
│ ├── test_providers.py
│ ├── test_responses.py
│ ├── test_routes.py
│ ├── test_safety.py
│ ├── test_scoring.py
│ ├── test_scoring_functions.py
│ ├── test_shields.py
│ ├── test_synthetic_data_generation.py
│ ├── test_telemetry.py
│ ├── test_tool_runtime.py
│ ├── test_toolgroups.py
│ ├── test_tools.py
│ ├── test_vector_dbs.py
│ ├── test_vector_io.py
│ └── tool_runtime
│ │ ├── __init__.py
│ │ └── test_rag_tool.py
├── conftest.py
├── sample_file.txt
├── test_client.py
├── test_deepcopy.py
├── test_extract_files.py
├── test_files.py
├── test_models.py
├── test_qs.py
├── test_required_args.py
├── test_response.py
├── test_streaming.py
├── test_transform.py
├── test_utils
│ ├── test_proxy.py
│ └── test_typing.py
└── utils.py
└── uv.lock
/.devcontainer/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG VARIANT="3.9"
2 | FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
3 |
4 | USER vscode
5 |
6 | RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
7 | ENV PATH=/home/vscode/.rye/shims:$PATH
8 |
9 | RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc
10 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2 | // README at: https://github.com/devcontainers/templates/tree/main/src/debian
3 | {
4 | "name": "Debian",
5 | "build": {
6 | "dockerfile": "Dockerfile",
7 | "context": ".."
8 | },
9 |
10 | "postStartCommand": "rye sync --all-features",
11 |
12 | "customizations": {
13 | "vscode": {
14 | "extensions": [
15 | "ms-python.python"
16 | ],
17 | "settings": {
18 | "terminal.integrated.shell.linux": "/bin/bash",
19 | "python.pythonPath": ".venv/bin/python",
20 | "python.defaultInterpreterPath": ".venv/bin/python",
21 | "python.typeChecking": "basic",
22 | "terminal.integrated.env.linux": {
23 | "PATH": "/home/vscode/.rye/shims:${env:PATH}"
24 | }
25 | }
26 | }
27 | }
28 |
29 | // Features to add to the dev container. More info: https://containers.dev/features.
30 | // "features": {},
31 |
32 | // Use 'forwardPorts' to make a list of ports inside the container available locally.
33 | // "forwardPorts": [],
34 |
35 | // Configure tool-specific properties.
36 | // "customizations": {},
37 |
38 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
39 | // "remoteUser": "root"
40 | }
41 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Each line is a file pattern followed by one or more owners.
2 |
3 | # These owners will be the default owners for everything in
4 | # the repo. Unless a later match takes precedence,
5 | * @ashwinb @yanxi0830 @hardikjshah @dltn @raghotham @dineshyv @vladimirivic @ehhuang @SLR722
6 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # What does this PR do?
2 | [Provide a short summary of what this PR does and why. Link to relevant issues if applicable.]
3 |
4 | [//]: # (If resolving an issue, uncomment and update the line below)
5 | [//]: # (Closes #[issue-number])
6 |
7 | ## Test Plan
8 | [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*]
9 |
10 | [//]: # (## Documentation)
11 | [//]: # (- [ ] Added a Changelog entry if the change is significant)
12 |
--------------------------------------------------------------------------------
/.github/workflows/pre-commit.yml:
--------------------------------------------------------------------------------
1 | name: Pre-commit
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches: [main]
7 |
8 | jobs:
9 | pre-commit:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
15 |
16 | - name: Set up Python
17 | uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
18 | with:
19 | python-version: '3.11.10'
20 | cache: pip
21 | cache-dependency-path: |
22 | **/requirements*.txt
23 | .pre-commit-config.yaml
24 |
25 | - uses: pre-commit/action@v3.0.1
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .prism.log
2 | .vscode
3 | _dev
4 |
5 | __pycache__
6 | .mypy_cache
7 |
8 | dist
9 |
10 | .venv
11 | .idea
12 |
13 | .env
14 | .envrc
15 | codegen.log
16 | Brewfile.lock.json
17 | .DS_Store
18 |
--------------------------------------------------------------------------------
/.python-version:
--------------------------------------------------------------------------------
1 | 3.9.18
2 |
--------------------------------------------------------------------------------
/.ruff.toml:
--------------------------------------------------------------------------------
1 | # Suggested config from pytorch that we can adapt
2 | lint.select = ["B", "C", "E" , "F" , "N", "W", "B9"]
3 |
4 | line-length = 120
5 |
6 | # C408 ignored because we like the dict keyword argument syntax
7 | # E501 is not flexible enough, we're using B950 instead
8 | # N812 ignored because import torch.nn.functional as F is PyTorch convention
9 | # N817 ignored because importing using acronyms is convention (DistributedDataParallel as DDP)
10 | # E731 allow usage of assigning lambda expressions
11 | # E701 let black auto-format statements on one line
12 | # E704 let black auto-format statements on one line
13 | lint.ignore = [
14 | "E203", "E305", "E402", "E501", "E721", "E741", "F405", "F821", "F841",
15 | "C408", "E302", "W291", "E303", "N812", "N817", "E731", "E701",
16 | # These are the additional ones we started ignoring after moving to ruff. We should look into each one of them later.
17 | "C901", "C405", "C414", "N803", "N999", "C403", "C416", "B028", "C419", "C401", "B023",
18 | # shebang has extra meaning in fbcode lints, so I think it's not worth trying
19 | # to line this up with executable bit
20 | "EXE001",
21 | # random naming hints don't need
22 | "N802",
23 | # these ignores are from flake8-bugbear; please fix!
24 | "B007", "B008"
25 | ]
26 |
27 | exclude = [
28 | "./.git",
29 | "./docs/*",
30 | "./build",
31 | "./scripts",
32 | "./venv",
33 | "*.pyi",
34 | ".pre-commit-config.yaml",
35 | "*.md",
36 | ".flake8"
37 | ]
38 |
--------------------------------------------------------------------------------
/.stats.yml:
--------------------------------------------------------------------------------
1 | configured_endpoints: 51
2 | openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/meta%2Fllama-stack-d52e4c19360cc636336d6a60ba6af1db89736fc0a3025c2b1d11870a5f1a1e3d.yml
3 |
--------------------------------------------------------------------------------
/Brewfile:
--------------------------------------------------------------------------------
1 | brew "rye"
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Meta Platforms, Inc. and affiliates
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Reporting Security Issues
4 |
5 | This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
6 |
7 | To report a security issue, please contact the Stainless team at security@stainlessapi.com.
8 |
9 | ## Responsible Disclosure
10 |
11 | We appreciate the efforts of security researchers and individuals who help us maintain the security of
12 | SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
13 | disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
14 | before making any information public.
15 |
16 | ## Reporting Non-SDK Related Security Issues
17 |
18 | If you encounter security issues that are not directly related to SDKs but pertain to the services
19 | or products provided by Llama Stack Client please follow the respective company's security reporting guidelines.
20 |
21 | ### Llama Stack Client Terms and Policies
22 |
23 | Please contact dev-feedback@llama-stack-client.com for any questions or concerns regarding security of our services.
24 |
25 | ---
26 |
27 | Thank you for helping us keep the SDKs and systems they interact with secure.
28 |
--------------------------------------------------------------------------------
/bin/publish-pypi:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -eux
4 | mkdir -p dist
5 | rye build --clean
6 | # Patching importlib-metadata version until upstream library version is updated
7 | # https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8 | "$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
9 | rye publish --yes --token=$PYPI_TOKEN
10 |
--------------------------------------------------------------------------------
/examples/.keep:
--------------------------------------------------------------------------------
1 | File generated from our OpenAPI spec by Stainless.
2 |
3 | This directory can be used to store example files demonstrating usage of this SDK.
4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
5 |
--------------------------------------------------------------------------------
/mypy.ini:
--------------------------------------------------------------------------------
1 | [mypy]
2 | pretty = True
3 | show_error_codes = True
4 |
5 | # Exclude _files.py because mypy isn't smart enough to apply
6 | # the correct type narrowing and as this is an internal module
7 | # it's fine to just use Pyright.
8 | exclude = ^(src/llama_stack_client/_files\.py|_dev/.*\.py)$
9 |
10 | strict_equality = True
11 | implicit_reexport = True
12 | check_untyped_defs = True
13 | no_implicit_optional = True
14 |
15 | warn_return_any = True
16 | warn_unreachable = True
17 | warn_unused_configs = True
18 |
19 | # Turn these options off as it could cause conflicts
20 | # with the Pyright options.
21 | warn_unused_ignores = False
22 | warn_redundant_casts = False
23 |
24 | disallow_any_generics = True
25 | disallow_untyped_defs = True
26 | disallow_untyped_calls = True
27 | disallow_subclassing_any = True
28 | disallow_incomplete_defs = True
29 | disallow_untyped_decorators = True
30 | cache_fine_grained = True
31 |
32 | # By default, mypy reports an error if you assign a value to the result
33 | # of a function call that doesn't return anything. We do this in our test
34 | # cases:
35 | # ```
36 | # result = ...
37 | # assert result is None
38 | # ```
39 | # Changing this codegen to make mypy happy would increase complexity
40 | # and would not be worth it.
41 | disable_error_code = func-returns-value
42 |
43 | # https://github.com/python/mypy/issues/12162
44 | [mypy.overrides]
45 | module = "black.files.*"
46 | ignore_errors = true
47 | ignore_missing_imports = true
48 |
--------------------------------------------------------------------------------
/noxfile.py:
--------------------------------------------------------------------------------
1 | import nox
2 |
3 |
4 | @nox.session(reuse_venv=True, name="test-pydantic-v1")
5 | def test_pydantic_v1(session: nox.Session) -> None:
6 | session.install("-r", "requirements-dev.lock")
7 | session.install("pydantic<2")
8 |
9 | session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs)
10 |
--------------------------------------------------------------------------------
/requirements.lock:
--------------------------------------------------------------------------------
1 | # generated by rye
2 | # use `rye lock` or `rye sync` to update this lockfile
3 | #
4 | # last locked with the following flags:
5 | # pre: false
6 | # features: []
7 | # all-features: true
8 | # with-sources: false
9 | # generate-hashes: false
10 | # universal: false
11 |
12 | -e file:.
13 | annotated-types==0.6.0
14 | # via pydantic
15 | anyio==4.4.0
16 | # via httpx
17 | # via llama-stack-client
18 | certifi==2023.7.22
19 | # via httpcore
20 | # via httpx
21 | click==8.1.7
22 | # via llama-stack-client
23 | distro==1.8.0
24 | # via llama-stack-client
25 | exceptiongroup==1.1.3
26 | # via anyio
27 | h11==0.14.0
28 | # via httpcore
29 | httpcore==1.0.2
30 | # via httpx
31 | httpx==0.25.2
32 | # via llama-stack-client
33 | idna==3.4
34 | # via anyio
35 | # via httpx
36 | markdown-it-py==3.0.0
37 | # via rich
38 | mdurl==0.1.2
39 | # via markdown-it-py
40 | numpy==2.0.2
41 | # via pandas
42 | pandas==2.2.3
43 | # via llama-stack-client
44 | prompt-toolkit==3.0.48
45 | # via llama-stack-client
46 | pyaml==24.12.1
47 | # via llama-stack-client
48 | pydantic==2.7.1
49 | # via llama-stack-client
50 | pydantic-core==2.18.2
51 | # via pydantic
52 | pygments==2.18.0
53 | # via rich
54 | python-dateutil==2.9.0.post0
55 | # via pandas
56 | pytz==2024.2
57 | # via pandas
58 | pyyaml==6.0.2
59 | # via pyaml
60 | rich==13.9.4
61 | # via llama-stack-client
62 | six==1.17.0
63 | # via python-dateutil
64 | sniffio==1.3.0
65 | # via anyio
66 | # via httpx
67 | # via llama-stack-client
68 | termcolor==2.5.0
69 | # via llama-stack-client
70 | tqdm==4.67.1
71 | # via llama-stack-client
72 | typing-extensions==4.8.0
73 | # via anyio
74 | # via llama-stack-client
75 | # via pydantic
76 | # via pydantic-core
77 | # via rich
78 | tzdata==2024.2
79 | # via pandas
80 | wcwidth==0.2.13
81 | # via prompt-toolkit
82 |
--------------------------------------------------------------------------------
/scripts/bootstrap:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | cd "$(dirname "$0")/.."
6 |
7 | if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
8 | brew bundle check >/dev/null 2>&1 || {
9 | echo "==> Installing Homebrew dependencies…"
10 | brew bundle
11 | }
12 | fi
13 |
14 | echo "==> Installing Python dependencies…"
15 |
16 | # experimental uv support makes installations significantly faster
17 | rye config --set-bool behavior.use-uv=true
18 |
19 | rye sync --all-features
20 |
--------------------------------------------------------------------------------
/scripts/format:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | cd "$(dirname "$0")/.."
6 |
7 | echo "==> Running formatters"
8 | rye run format
9 |
--------------------------------------------------------------------------------
/scripts/lint:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # set -e
4 |
5 | # cd "$(dirname "$0")/.."
6 |
7 | # echo "==> Running lints"
8 | # rye run lint
9 |
10 | # echo "==> Making sure it imports"
11 | # rye run python -c 'import llama_stack_client'
12 |
--------------------------------------------------------------------------------
/scripts/mock:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | cd "$(dirname "$0")/.."
6 |
7 | if [[ -n "$1" && "$1" != '--'* ]]; then
8 | URL="$1"
9 | shift
10 | else
11 | URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
12 | fi
13 |
14 | # Check if the URL is empty
15 | if [ -z "$URL" ]; then
16 | echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
17 | exit 1
18 | fi
19 |
20 | echo "==> Starting mock server with URL ${URL}"
21 |
22 | # Run prism mock on the given spec
23 | if [ "$1" == "--daemon" ]; then
24 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
25 |
26 | # Wait for server to come online
27 | echo -n "Waiting for server"
28 | while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
29 | echo -n "."
30 | sleep 0.1
31 | done
32 |
33 | if grep -q "✖ fatal" ".prism.log"; then
34 | cat .prism.log
35 | exit 1
36 | fi
37 |
38 | echo
39 | else
40 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
41 | fi
42 |
--------------------------------------------------------------------------------
/scripts/test:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # set -e
4 |
5 | # cd "$(dirname "$0")/.."
6 |
7 | # RED='\033[0;31m'
8 | # GREEN='\033[0;32m'
9 | # YELLOW='\033[0;33m'
10 | # NC='\033[0m' # No Color
11 |
12 | # function prism_is_running() {
13 | # curl --silent "http://localhost:4010" >/dev/null 2>&1
14 | # }
15 |
16 | # kill_server_on_port() {
17 | # pids=$(lsof -t -i tcp:"$1" || echo "")
18 | # if [ "$pids" != "" ]; then
19 | # kill "$pids"
20 | # echo "Stopped $pids."
21 | # fi
22 | # }
23 |
24 | # function is_overriding_api_base_url() {
25 | # [ -n "$TEST_API_BASE_URL" ]
26 | # }
27 |
28 | # if ! is_overriding_api_base_url && ! prism_is_running ; then
29 | # # When we exit this script, make sure to kill the background mock server process
30 | # trap 'kill_server_on_port 4010' EXIT
31 |
32 | # # Start the dev server
33 | # ./scripts/mock --daemon
34 | # fi
35 |
36 | # if is_overriding_api_base_url ; then
37 | # echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
38 | # echo
39 | # elif ! prism_is_running ; then
40 | # echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
41 | # echo -e "running against your OpenAPI spec."
42 | # echo
43 | # echo -e "To run the server, pass in the path or url of your OpenAPI"
44 | # echo -e "spec to the prism command:"
45 | # echo
46 | # echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
47 | # echo
48 |
49 | # exit 1
50 | # else
51 | # echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
52 | # echo
53 | # fi
54 |
55 | # echo "==> Running tests"
56 | # rye run pytest "$@"
57 |
58 | # echo "==> Running Pydantic v1 tests"
59 | # rye run nox -s test-pydantic-v1 -- "$@"
60 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_constants.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | import httpx
4 |
5 | RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
6 | OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
7 |
8 | # default timeout is 1 minute
9 | DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0)
10 | DEFAULT_MAX_RETRIES = 2
11 | DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
12 |
13 | INITIAL_RETRY_DELAY = 0.5
14 | MAX_RETRY_DELAY = 8.0
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_resource.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | import time
6 | from typing import TYPE_CHECKING
7 |
8 | import anyio
9 |
10 | if TYPE_CHECKING:
11 | from ._client import LlamaStackClient, AsyncLlamaStackClient
12 |
13 |
14 | class SyncAPIResource:
15 | _client: LlamaStackClient
16 |
17 | def __init__(self, client: LlamaStackClient) -> None:
18 | self._client = client
19 | self._get = client.get
20 | self._post = client.post
21 | self._patch = client.patch
22 | self._put = client.put
23 | self._delete = client.delete
24 | self._get_api_list = client.get_api_list
25 |
26 | def _sleep(self, seconds: float) -> None:
27 | time.sleep(seconds)
28 |
29 |
30 | class AsyncAPIResource:
31 | _client: AsyncLlamaStackClient
32 |
33 | def __init__(self, client: AsyncLlamaStackClient) -> None:
34 | self._client = client
35 | self._get = client.get
36 | self._post = client.post
37 | self._patch = client.patch
38 | self._put = client.put
39 | self._delete = client.delete
40 | self._get_api_list = client.get_api_list
41 |
42 | async def _sleep(self, seconds: float) -> None:
43 | await anyio.sleep(seconds)
44 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_utils/_logs.py:
--------------------------------------------------------------------------------
1 | import os
2 | import logging
3 | from rich.logging import RichHandler
4 |
5 | logger: logging.Logger = logging.getLogger("llama_stack_client")
6 | httpx_logger: logging.Logger = logging.getLogger("httpx")
7 |
8 |
9 | def _basic_config() -> None:
10 | # e.g. [2023-10-05 14:12:26 - llama_stack_client._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
11 | logging.basicConfig(
12 | format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s",
13 | datefmt="%Y-%m-%d %H:%M:%S",
14 | handlers=[RichHandler(rich_tracebacks=True)],
15 | )
16 |
17 |
18 | def setup_logging() -> None:
19 | env = os.environ.get("LLAMA_STACK_LOG")
20 | if env == "debug":
21 | _basic_config()
22 | logger.setLevel(logging.DEBUG)
23 | httpx_logger.setLevel(logging.DEBUG)
24 | elif env == "info":
25 | _basic_config()
26 | logger.setLevel(logging.INFO)
27 | httpx_logger.setLevel(logging.INFO)
28 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_utils/_proxy.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | from abc import ABC, abstractmethod
4 | from typing import Generic, TypeVar, Iterable, cast
5 | from typing_extensions import override
6 |
7 | T = TypeVar("T")
8 |
9 |
10 | class LazyProxy(Generic[T], ABC):
11 | """Implements data methods to pretend that an instance is another instance.
12 |
13 | This includes forwarding attribute access and other methods.
14 | """
15 |
16 | # Note: we have to special case proxies that themselves return proxies
17 | # to support using a proxy as a catch-all for any random access, e.g. `proxy.foo.bar.baz`
18 |
19 | def __getattr__(self, attr: str) -> object:
20 | proxied = self.__get_proxied__()
21 | if isinstance(proxied, LazyProxy):
22 | return proxied # pyright: ignore
23 | return getattr(proxied, attr)
24 |
25 | @override
26 | def __repr__(self) -> str:
27 | proxied = self.__get_proxied__()
28 | if isinstance(proxied, LazyProxy):
29 | return proxied.__class__.__name__
30 | return repr(self.__get_proxied__())
31 |
32 | @override
33 | def __str__(self) -> str:
34 | proxied = self.__get_proxied__()
35 | if isinstance(proxied, LazyProxy):
36 | return proxied.__class__.__name__
37 | return str(proxied)
38 |
39 | @override
40 | def __dir__(self) -> Iterable[str]:
41 | proxied = self.__get_proxied__()
42 | if isinstance(proxied, LazyProxy):
43 | return []
44 | return proxied.__dir__()
45 |
46 | @property # type: ignore
47 | @override
48 | def __class__(self) -> type: # pyright: ignore
49 | try:
50 | proxied = self.__get_proxied__()
51 | except Exception:
52 | return type(self)
53 | if issubclass(type(proxied), LazyProxy):
54 | return type(proxied)
55 | return proxied.__class__
56 |
57 | def __get_proxied__(self) -> T:
58 | return self.__load__()
59 |
60 | def __as_proxied__(self) -> T:
61 | """Helper method that returns the current proxy, typed as the loaded object"""
62 | return cast(T, self)
63 |
64 | @abstractmethod
65 | def __load__(self) -> T: ...
66 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_utils/_reflection.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import inspect
4 | from typing import Any, Callable
5 |
6 |
7 | def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool:
8 | """Returns whether or not the given function has a specific parameter"""
9 | sig = inspect.signature(func)
10 | return arg_name in sig.parameters
11 |
12 |
13 | def assert_signatures_in_sync(
14 | source_func: Callable[..., Any],
15 | check_func: Callable[..., Any],
16 | *,
17 | exclude_params: set[str] = set(),
18 | ) -> None:
19 | """Ensure that the signature of the second function matches the first."""
20 |
21 | check_sig = inspect.signature(check_func)
22 | source_sig = inspect.signature(source_func)
23 |
24 | errors: list[str] = []
25 |
26 | for name, source_param in source_sig.parameters.items():
27 | if name in exclude_params:
28 | continue
29 |
30 | custom_param = check_sig.parameters.get(name)
31 | if not custom_param:
32 | errors.append(f"the `{name}` param is missing")
33 | continue
34 |
35 | if custom_param.annotation != source_param.annotation:
36 | errors.append(
37 | f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}"
38 | )
39 | continue
40 |
41 | if errors:
42 | raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors))
43 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_utils/_resources_proxy.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | from typing import Any
4 | from typing_extensions import override
5 |
6 | from ._proxy import LazyProxy
7 |
8 |
9 | class ResourcesProxy(LazyProxy[Any]):
10 | """A proxy for the `llama_stack_client.resources` module.
11 |
12 | This is used so that we can lazily import `llama_stack_client.resources` only when
13 | needed *and* so that users can just import `llama_stack_client` and reference `llama_stack_client.resources`
14 | """
15 |
16 | @override
17 | def __load__(self) -> Any:
18 | import importlib
19 |
20 | mod = importlib.import_module("llama_stack_client.resources")
21 | return mod
22 |
23 |
24 | resources = ResourcesProxy().__as_proxied__()
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_utils/_streams.py:
--------------------------------------------------------------------------------
1 | from typing import Any
2 | from typing_extensions import Iterator, AsyncIterator
3 |
4 |
5 | def consume_sync_iterator(iterator: Iterator[Any]) -> None:
6 | for _ in iterator:
7 | ...
8 |
9 |
10 | async def consume_async_iterator(iterator: AsyncIterator[Any]) -> None:
11 | async for _ in iterator:
12 | ...
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_version.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | __title__ = "llama_stack_client"
4 | __version__ = "0.2.10"
5 |
--------------------------------------------------------------------------------
/src/llama_stack_client/_wrappers.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Generic, TypeVar
4 |
5 | from ._models import GenericModel
6 |
7 | __all__ = ["DataWrapper"]
8 |
9 | _T = TypeVar("_T")
10 |
11 |
12 | class DataWrapper(GenericModel, Generic[_T]):
13 | data: _T
14 |
15 | @staticmethod
16 | def _unwrapper(obj: "DataWrapper[_T]") -> _T:
17 | return obj.data
18 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/.keep:
--------------------------------------------------------------------------------
1 | File generated from our OpenAPI spec by Stainless.
2 |
3 | This directory can be used to store custom files to expand the SDK.
4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
5 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .tools.mcp_oauth import get_oauth_token_for_mcp_server
8 |
9 | __all__ = ["get_oauth_token_for_mcp_server"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/agents/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/agents/react/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/agents/react/tool_parser.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import json
8 | import uuid
9 | from typing import List, Optional, Union
10 |
11 | from llama_stack_client.types.shared.completion_message import CompletionMessage
12 | from llama_stack_client.types.shared.tool_call import ToolCall
13 |
14 | from pydantic import BaseModel, ValidationError
15 |
16 | from ..tool_parser import ToolParser
17 |
18 |
19 | class Param(BaseModel):
20 | name: str
21 | value: Union[str, int, float, bool]
22 |
23 |
24 | class Action(BaseModel):
25 | tool_name: str
26 | tool_params: List[Param]
27 |
28 |
29 | class ReActOutput(BaseModel):
30 | thought: str
31 | action: Optional[Action]
32 | answer: Optional[str]
33 |
34 |
35 | class ReActToolParser(ToolParser):
36 | def get_tool_calls(self, output_message: CompletionMessage) -> List[ToolCall]:
37 | tool_calls = []
38 | response_text = str(output_message.content)
39 | try:
40 | react_output = ReActOutput.model_validate_json(response_text)
41 | except ValidationError as e:
42 | print(f"Error parsing action: {e}")
43 | return tool_calls
44 |
45 | if react_output.answer:
46 | return tool_calls
47 |
48 | if react_output.action:
49 | tool_name = react_output.action.tool_name
50 | tool_params = react_output.action.tool_params
51 | params = {param.name: param.value for param in tool_params}
52 | if tool_name and tool_params:
53 | call_id = str(uuid.uuid4())
54 | tool_calls = [
55 | ToolCall(
56 | call_id=call_id,
57 | tool_name=tool_name,
58 | arguments=params,
59 | arguments_json=json.dumps(params),
60 | )
61 | ]
62 |
63 | return tool_calls
64 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/agents/tool_parser.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from abc import abstractmethod
8 | from typing import List
9 |
10 | from llama_stack_client.types.agents.turn import CompletionMessage
11 | from llama_stack_client.types.shared.tool_call import ToolCall
12 |
13 |
14 | class ToolParser:
15 | """
16 | Abstract base class for parsing agent responses into tool calls. Implement this class to customize how
17 | agent outputs are processed and transformed into executable tool calls.
18 |
19 | To use this class:
20 | 1. Create a subclass of ToolParser
21 | 2. Implement the `get_tool_calls` method
22 | 3. Pass your parser instance to the Agent's constructor
23 |
24 | Example:
25 | class MyCustomParser(ToolParser):
26 | def get_tool_calls(self, output_message: CompletionMessage) -> List[ToolCall]:
27 | # Add your custom parsing logic here
28 | return extracted_tool_calls
29 |
30 | Methods:
31 | get_tool_calls(output_message: CompletionMessage) -> List[ToolCall]:
32 | Abstract method that must be implemented by subclasses to process
33 | the agent's response and extract tool calls.
34 |
35 | Args:
36 | output_message (CompletionMessage): The response message from agent turn
37 |
38 | Returns:
39 | Optional[List[ToolCall]]: A list of parsed tool calls, or None if no tools should be called
40 | """
41 |
42 | @abstractmethod
43 | def get_tool_calls(self, output_message: CompletionMessage) -> List[ToolCall]:
44 | raise NotImplementedError
45 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | # Ignore tqdm experimental warning
8 | import warnings
9 |
10 | from tqdm import TqdmExperimentalWarning
11 |
12 | warnings.filterwarnings("ignore", category=TqdmExperimentalWarning)
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/common/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/common/utils.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 | from functools import wraps
7 |
8 | from rich.console import Console
9 | from rich.panel import Panel
10 | from rich.table import Table
11 |
12 |
13 | def create_bar_chart(data, labels, title=""):
14 | """Create a bar chart using Rich Table."""
15 |
16 | console = Console()
17 | table = Table(title=title)
18 | table.add_column("Score")
19 | table.add_column("Count")
20 |
21 | max_value = max(data)
22 | total_count = sum(data)
23 |
24 | # Define a list of colors to cycle through
25 | colors = ["green", "blue", "red", "yellow", "magenta", "cyan"]
26 |
27 | for i, (label, value) in enumerate(zip(labels, data)):
28 | bar_length = int((value / max_value) * 20) # Adjust bar length as needed
29 | bar = "█" * bar_length + " " * (20 - bar_length)
30 | color = colors[i % len(colors)]
31 | table.add_row(label, f"[{color}]{bar}[/] {value}/{total_count}")
32 |
33 | console.print(table)
34 |
35 |
36 | def handle_client_errors(operation_name):
37 | def decorator(func):
38 | @wraps(func)
39 | def wrapper(*args, **kwargs):
40 | try:
41 | return func(*args, **kwargs)
42 | except Exception as e:
43 | console = Console()
44 | console.print(
45 | Panel.fit(
46 | f"[bold red]Failed to {operation_name}[/bold red]\n\n"
47 | f"[yellow]Error Type:[/yellow] {e.__class__.__name__}\n"
48 | f"[yellow]Details:[/yellow] {str(e)}"
49 | )
50 | )
51 |
52 | return wrapper
53 |
54 | return decorator
55 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/constants.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import os
8 | from pathlib import Path
9 |
10 | LLAMA_STACK_CLIENT_CONFIG_DIR = Path(os.path.expanduser("~/.llama/client"))
11 |
12 |
13 | def get_config_file_path():
14 | return LLAMA_STACK_CLIENT_CONFIG_DIR / "config.yaml"
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/datasets/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .datasets import datasets
8 |
9 | __all__ = ["datasets"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/datasets/datasets.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 | import click
7 |
8 | from .list import list_datasets
9 | from .register import register
10 | from .unregister import unregister
11 |
12 |
13 | @click.group()
14 | @click.help_option("-h", "--help")
15 | def datasets():
16 | """Manage datasets."""
17 |
18 |
19 | # Register subcommands
20 | datasets.add_command(list_datasets)
21 | datasets.add_command(register)
22 | datasets.add_command(unregister)
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/datasets/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import click
8 | from rich.console import Console
9 | from rich.table import Table
10 |
11 | from ..common.utils import handle_client_errors
12 |
13 |
14 | @click.command("list")
15 | @click.help_option("-h", "--help")
16 | @click.pass_context
17 | @handle_client_errors("list datasets")
18 | def list_datasets(ctx):
19 | """Show available datasets on distribution endpoint"""
20 | client = ctx.obj["client"]
21 | console = Console()
22 | headers = ["identifier", "provider_id", "metadata", "type", "purpose"]
23 |
24 | datasets_list_response = client.datasets.list()
25 | if datasets_list_response:
26 | table = Table()
27 | for header in headers:
28 | table.add_column(header)
29 |
30 | for item in datasets_list_response:
31 | table.add_row(*[str(getattr(item, header)) for header in headers])
32 | console.print(table)
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/datasets/unregister.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 | import click
7 |
8 | from ..common.utils import handle_client_errors
9 |
10 |
11 | @click.command("unregister")
12 | @click.help_option("-h", "--help")
13 | @click.argument("dataset-id", required=True)
14 | @click.pass_context
15 | @handle_client_errors("unregister dataset")
16 | def unregister(ctx, dataset_id: str):
17 | """Remove a dataset"""
18 | client = ctx.obj["client"]
19 | client.datasets.unregister(dataset_id=dataset_id)
20 | click.echo(f"Dataset '{dataset_id}' unregistered successfully")
21 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/eval/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .eval import eval
8 |
9 | __all__ = ["eval"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/eval/eval.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 |
8 | import click
9 |
10 | from .run_benchmark import run_benchmark
11 | from .run_scoring import run_scoring
12 |
13 |
14 | @click.group()
15 | @click.help_option("-h", "--help")
16 | def eval():
17 | """Run evaluation tasks."""
18 |
19 |
20 | # Register subcommands
21 | eval.add_command(run_benchmark)
22 | eval.add_command(run_scoring)
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/eval_tasks/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .eval_tasks import eval_tasks
8 |
9 | __all__ = ["eval_tasks"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/eval_tasks/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import click
8 | from rich.console import Console
9 | from rich.table import Table
10 |
11 | from ..common.utils import handle_client_errors
12 |
13 |
14 | @click.command("list")
15 | @click.help_option("-h", "--help")
16 | @click.pass_context
17 | @handle_client_errors("list eval tasks")
18 | def list_eval_tasks(ctx):
19 | """Show available eval tasks on distribution endpoint"""
20 |
21 | client = ctx.obj["client"]
22 | console = Console()
23 | headers = []
24 | eval_tasks_list_response = client.eval_tasks.list()
25 | if eval_tasks_list_response and len(eval_tasks_list_response) > 0:
26 | headers = sorted(eval_tasks_list_response[0].__dict__.keys())
27 |
28 | if eval_tasks_list_response:
29 | table = Table()
30 | for header in headers:
31 | table.add_column(header)
32 |
33 | for item in eval_tasks_list_response:
34 | table.add_row(*[str(getattr(item, header)) for header in headers])
35 | console.print(table)
36 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/inference/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .inference import inference
8 |
9 | __all__ = ["inference"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/inspect/__init__.py:
--------------------------------------------------------------------------------
1 | from .inspect import inspect
2 |
3 | __all__ = ["inspect"]
4 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/inspect/inspect.py:
--------------------------------------------------------------------------------
1 | import click
2 |
3 | from .version import inspect_version
4 |
5 |
6 | @click.group()
7 | @click.help_option("-h", "--help")
8 | def inspect():
9 | """Inspect server configuration."""
10 |
11 |
12 | # Register subcommands
13 | inspect.add_command(inspect_version)
14 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/inspect/version.py:
--------------------------------------------------------------------------------
1 | import click
2 | from rich.console import Console
3 |
4 | from ..common.utils import handle_client_errors
5 |
6 |
7 | @click.command("version")
8 | @click.help_option("-h", "--help")
9 | @click.pass_context
10 | @handle_client_errors("inspect version")
11 | def inspect_version(ctx):
12 | """Show available providers on distribution endpoint"""
13 | client = ctx.obj["client"]
14 | console = Console()
15 | version_response = client.inspect.version()
16 | console.print(version_response)
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/models/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .models import models
8 |
9 | __all__ = ["models"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/post_training/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .post_training import post_training
8 |
9 | __all__ = ["post_training"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/providers/__init__.py:
--------------------------------------------------------------------------------
1 | from .providers import providers
2 |
3 | __all__ = ["providers"]
4 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/providers/inspect.py:
--------------------------------------------------------------------------------
1 | import click
2 | import yaml
3 | from rich.console import Console
4 |
5 | from ..common.utils import handle_client_errors
6 |
7 |
8 | @click.command(name="inspect")
9 | @click.argument("provider_id")
10 | @click.pass_context
11 | @handle_client_errors("inspect providers")
12 | def inspect_provider(ctx, provider_id):
13 | """Show available providers on distribution endpoint"""
14 | client = ctx.obj["client"]
15 | console = Console()
16 |
17 | providers_response = client.providers.retrieve(provider_id=provider_id)
18 |
19 | if not providers_response:
20 | click.secho("Provider not found", fg="red")
21 | raise click.exceptions.Exit(1)
22 |
23 | console.print(f"provider_id={providers_response.provider_id}")
24 | console.print(f"provider_type={providers_response.provider_type}")
25 | console.print("config:")
26 | for line in yaml.dump(providers_response.config, indent=2).split("\n"):
27 | console.print(line)
28 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/providers/list.py:
--------------------------------------------------------------------------------
1 | import click
2 | from rich.console import Console
3 | from rich.table import Table
4 |
5 | from ..common.utils import handle_client_errors
6 |
7 |
8 | @click.command("list")
9 | @click.help_option("-h", "--help")
10 | @click.pass_context
11 | @handle_client_errors("list providers")
12 | def list_providers(ctx):
13 | """Show available providers on distribution endpoint"""
14 | client = ctx.obj["client"]
15 | console = Console()
16 | headers = ["API", "Provider ID", "Provider Type"]
17 |
18 | providers_response = client.providers.list()
19 | table = Table()
20 | for header in headers:
21 | table.add_column(header)
22 |
23 | for response in providers_response:
24 | table.add_row(response.api, response.provider_id, response.provider_type)
25 |
26 | console.print(table)
27 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/providers/providers.py:
--------------------------------------------------------------------------------
1 | import click
2 |
3 | from .list import list_providers
4 | from .inspect import inspect_provider
5 |
6 |
7 | @click.group()
8 | @click.help_option("-h", "--help")
9 | def providers():
10 | """Manage API providers."""
11 |
12 |
13 | # Register subcommands
14 | providers.add_command(list_providers)
15 | providers.add_command(inspect_provider)
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/scoring_functions/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .scoring_functions import scoring_functions
8 |
9 | __all__ = ["scoring_functions"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/scoring_functions/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import click
8 | from rich.console import Console
9 | from rich.table import Table
10 |
11 | from ..common.utils import handle_client_errors
12 |
13 |
14 | @click.command("list")
15 | @click.help_option("-h", "--help")
16 | @click.pass_context
17 | @handle_client_errors("list scoring functions")
18 | def list_scoring_functions(ctx):
19 | """Show available scoring functions on distribution endpoint"""
20 |
21 | client = ctx.obj["client"]
22 | console = Console()
23 | headers = [
24 | "identifier",
25 | "provider_id",
26 | "description",
27 | "type",
28 | ]
29 |
30 | scoring_functions_list_response = client.scoring_functions.list()
31 | if scoring_functions_list_response:
32 | table = Table()
33 | for header in headers:
34 | table.add_column(header)
35 |
36 | for item in scoring_functions_list_response:
37 | table.add_row(*[str(getattr(item, header)) for header in headers])
38 | console.print(table)
39 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/shields/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .shields import shields
8 |
9 | __all__ = ["shields"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/toolgroups/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .toolgroups import toolgroups
8 |
9 | __all__ = ["toolgroups"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/cli/vector_dbs/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | from .vector_dbs import vector_dbs
8 |
9 | __all__ = ["vector_dbs"]
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/inference/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/inference/event_logger.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 | from termcolor import cprint
7 |
8 |
9 | class InferenceStreamPrintableEvent:
10 | def __init__(
11 | self,
12 | content: str = "",
13 | end: str = "\n",
14 | color="white",
15 | ):
16 | self.content = content
17 | self.color = color
18 | self.end = "\n" if end is None else end
19 |
20 | def print(self, flush=True):
21 | cprint(f"{self.content}", color=self.color, end=self.end, flush=flush)
22 |
23 |
24 | class InferenceStreamLogEventPrinter:
25 | def __init__(self):
26 | self.is_thinking = False
27 |
28 | def yield_printable_events(self, chunk):
29 | event = chunk.event
30 | if event.event_type == "start":
31 | yield InferenceStreamPrintableEvent("Assistant> ", color="cyan", end="")
32 | elif event.event_type == "progress":
33 | if event.delta.type == "reasoning":
34 | if not self.is_thinking:
35 | yield InferenceStreamPrintableEvent(" ", color="magenta", end="")
36 | self.is_thinking = True
37 | yield InferenceStreamPrintableEvent(event.delta.reasoning, color="magenta", end="")
38 | else:
39 | if self.is_thinking:
40 | yield InferenceStreamPrintableEvent("", color="magenta", end="")
41 | self.is_thinking = False
42 | yield InferenceStreamPrintableEvent(event.delta.text, color="yellow", end="")
43 | elif event.event_type == "complete":
44 | yield InferenceStreamPrintableEvent("")
45 |
46 |
47 | class EventLogger:
48 | def log(self, event_generator):
49 | printer = InferenceStreamLogEventPrinter()
50 | for chunk in event_generator:
51 | yield from printer.yield_printable_events(chunk)
52 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/inference/utils.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Meta Platforms, Inc. and affiliates.
2 | # All rights reserved.
3 | #
4 | # This source code is licensed under the terms described in the LICENSE file in
5 | # the root directory of this source tree.
6 |
7 | import pathlib
8 | import base64
9 |
10 |
11 | class MessageAttachment:
12 | # https://developer.mozilla.org/en-US/docs/Glossary/Base64
13 | @classmethod
14 | def base64(cls, file_path: str) -> str:
15 | path = pathlib.Path(file_path)
16 | return base64.b64encode(path.read_bytes()).decode("utf-8")
17 |
18 | # https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data
19 | @classmethod
20 | def data_url(cls, media_type: str, file_path: str) -> str:
21 | return f"data:{media_type};base64,{cls.base64(file_path)}"
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/inline/inline.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meta-llama/llama-stack-client-python/05e41a6eb12053b850a3abc56bb35e3121042be2/src/llama_stack_client/lib/inline/inline.py
--------------------------------------------------------------------------------
/src/llama_stack_client/lib/stream_printer.py:
--------------------------------------------------------------------------------
1 | from .agents.event_logger import TurnStreamEventPrinter
2 | from .inference.event_logger import InferenceStreamLogEventPrinter
3 |
4 |
5 | class EventStreamPrinter:
6 | @classmethod
7 | def gen(cls, event_generator):
8 | inference_printer = None
9 | turn_printer = None
10 | for chunk in event_generator:
11 | if not hasattr(chunk, "event"):
12 | raise ValueError(f"Unexpected chunk without event: {chunk}")
13 |
14 | event = chunk.event
15 | if hasattr(event, "event_type"):
16 | if not inference_printer:
17 | inference_printer = InferenceStreamLogEventPrinter()
18 | yield from inference_printer.yield_printable_events(chunk)
19 | elif hasattr(event, "payload") and hasattr(event.payload, "event_type"):
20 | if not turn_printer:
21 | turn_printer = TurnStreamEventPrinter()
22 | yield from turn_printer.yield_printable_events(chunk)
23 | else:
24 | raise ValueError(f"Unsupported event: {event}")
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/pagination.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Generic, TypeVar, Optional
4 | from typing_extensions import override
5 |
6 | from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
7 |
8 | __all__ = ["SyncDatasetsIterrows", "AsyncDatasetsIterrows"]
9 |
10 | _T = TypeVar("_T")
11 |
12 |
13 | class SyncDatasetsIterrows(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
14 | data: List[_T]
15 | next_index: Optional[int] = None
16 |
17 | @override
18 | def _get_page_items(self) -> List[_T]:
19 | data = self.data
20 | if not data:
21 | return []
22 | return data
23 |
24 | @override
25 | def next_page_info(self) -> Optional[PageInfo]:
26 | next_index = self.next_index
27 | if not next_index:
28 | return None
29 |
30 | return PageInfo(params={"start_index": next_index})
31 |
32 |
33 | class AsyncDatasetsIterrows(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
34 | data: List[_T]
35 | next_index: Optional[int] = None
36 |
37 | @override
38 | def _get_page_items(self) -> List[_T]:
39 | data = self.data
40 | if not data:
41 | return []
42 | return data
43 |
44 | @override
45 | def next_page_info(self) -> Optional[PageInfo]:
46 | next_index = self.next_index
47 | if not next_index:
48 | return None
49 |
50 | return PageInfo(params={"start_index": next_index})
51 |
--------------------------------------------------------------------------------
/src/llama_stack_client/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meta-llama/llama-stack-client-python/05e41a6eb12053b850a3abc56bb35e3121042be2/src/llama_stack_client/py.typed
--------------------------------------------------------------------------------
/src/llama_stack_client/resources/agents/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .turn import (
4 | TurnResource,
5 | AsyncTurnResource,
6 | TurnResourceWithRawResponse,
7 | AsyncTurnResourceWithRawResponse,
8 | TurnResourceWithStreamingResponse,
9 | AsyncTurnResourceWithStreamingResponse,
10 | )
11 | from .steps import (
12 | StepsResource,
13 | AsyncStepsResource,
14 | StepsResourceWithRawResponse,
15 | AsyncStepsResourceWithRawResponse,
16 | StepsResourceWithStreamingResponse,
17 | AsyncStepsResourceWithStreamingResponse,
18 | )
19 | from .agents import (
20 | AgentsResource,
21 | AsyncAgentsResource,
22 | AgentsResourceWithRawResponse,
23 | AsyncAgentsResourceWithRawResponse,
24 | AgentsResourceWithStreamingResponse,
25 | AsyncAgentsResourceWithStreamingResponse,
26 | )
27 | from .session import (
28 | SessionResource,
29 | AsyncSessionResource,
30 | SessionResourceWithRawResponse,
31 | AsyncSessionResourceWithRawResponse,
32 | SessionResourceWithStreamingResponse,
33 | AsyncSessionResourceWithStreamingResponse,
34 | )
35 |
36 | __all__ = [
37 | "SessionResource",
38 | "AsyncSessionResource",
39 | "SessionResourceWithRawResponse",
40 | "AsyncSessionResourceWithRawResponse",
41 | "SessionResourceWithStreamingResponse",
42 | "AsyncSessionResourceWithStreamingResponse",
43 | "StepsResource",
44 | "AsyncStepsResource",
45 | "StepsResourceWithRawResponse",
46 | "AsyncStepsResourceWithRawResponse",
47 | "StepsResourceWithStreamingResponse",
48 | "AsyncStepsResourceWithStreamingResponse",
49 | "TurnResource",
50 | "AsyncTurnResource",
51 | "TurnResourceWithRawResponse",
52 | "AsyncTurnResourceWithRawResponse",
53 | "TurnResourceWithStreamingResponse",
54 | "AsyncTurnResourceWithStreamingResponse",
55 | "AgentsResource",
56 | "AsyncAgentsResource",
57 | "AgentsResourceWithRawResponse",
58 | "AsyncAgentsResourceWithRawResponse",
59 | "AgentsResourceWithStreamingResponse",
60 | "AsyncAgentsResourceWithStreamingResponse",
61 | ]
62 |
--------------------------------------------------------------------------------
/src/llama_stack_client/resources/chat/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .chat import (
4 | ChatResource,
5 | AsyncChatResource,
6 | ChatResourceWithRawResponse,
7 | AsyncChatResourceWithRawResponse,
8 | ChatResourceWithStreamingResponse,
9 | AsyncChatResourceWithStreamingResponse,
10 | )
11 | from .completions import (
12 | CompletionsResource,
13 | AsyncCompletionsResource,
14 | CompletionsResourceWithRawResponse,
15 | AsyncCompletionsResourceWithRawResponse,
16 | CompletionsResourceWithStreamingResponse,
17 | AsyncCompletionsResourceWithStreamingResponse,
18 | )
19 |
20 | __all__ = [
21 | "CompletionsResource",
22 | "AsyncCompletionsResource",
23 | "CompletionsResourceWithRawResponse",
24 | "AsyncCompletionsResourceWithRawResponse",
25 | "CompletionsResourceWithStreamingResponse",
26 | "AsyncCompletionsResourceWithStreamingResponse",
27 | "ChatResource",
28 | "AsyncChatResource",
29 | "ChatResourceWithRawResponse",
30 | "AsyncChatResourceWithRawResponse",
31 | "ChatResourceWithStreamingResponse",
32 | "AsyncChatResourceWithStreamingResponse",
33 | ]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/resources/eval/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .eval import (
4 | EvalResource,
5 | AsyncEvalResource,
6 | EvalResourceWithRawResponse,
7 | AsyncEvalResourceWithRawResponse,
8 | EvalResourceWithStreamingResponse,
9 | AsyncEvalResourceWithStreamingResponse,
10 | )
11 | from .jobs import (
12 | JobsResource,
13 | AsyncJobsResource,
14 | JobsResourceWithRawResponse,
15 | AsyncJobsResourceWithRawResponse,
16 | JobsResourceWithStreamingResponse,
17 | AsyncJobsResourceWithStreamingResponse,
18 | )
19 |
20 | __all__ = [
21 | "JobsResource",
22 | "AsyncJobsResource",
23 | "JobsResourceWithRawResponse",
24 | "AsyncJobsResourceWithRawResponse",
25 | "JobsResourceWithStreamingResponse",
26 | "AsyncJobsResourceWithStreamingResponse",
27 | "EvalResource",
28 | "AsyncEvalResource",
29 | "EvalResourceWithRawResponse",
30 | "AsyncEvalResourceWithRawResponse",
31 | "EvalResourceWithStreamingResponse",
32 | "AsyncEvalResourceWithStreamingResponse",
33 | ]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/resources/post_training/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .job import (
4 | JobResource,
5 | AsyncJobResource,
6 | JobResourceWithRawResponse,
7 | AsyncJobResourceWithRawResponse,
8 | JobResourceWithStreamingResponse,
9 | AsyncJobResourceWithStreamingResponse,
10 | )
11 | from .post_training import (
12 | PostTrainingResource,
13 | AsyncPostTrainingResource,
14 | PostTrainingResourceWithRawResponse,
15 | AsyncPostTrainingResourceWithRawResponse,
16 | PostTrainingResourceWithStreamingResponse,
17 | AsyncPostTrainingResourceWithStreamingResponse,
18 | )
19 |
20 | __all__ = [
21 | "JobResource",
22 | "AsyncJobResource",
23 | "JobResourceWithRawResponse",
24 | "AsyncJobResourceWithRawResponse",
25 | "JobResourceWithStreamingResponse",
26 | "AsyncJobResourceWithStreamingResponse",
27 | "PostTrainingResource",
28 | "AsyncPostTrainingResource",
29 | "PostTrainingResourceWithRawResponse",
30 | "AsyncPostTrainingResourceWithRawResponse",
31 | "PostTrainingResourceWithStreamingResponse",
32 | "AsyncPostTrainingResourceWithStreamingResponse",
33 | ]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/resources/tool_runtime/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .rag_tool import (
4 | RagToolResource,
5 | AsyncRagToolResource,
6 | RagToolResourceWithRawResponse,
7 | AsyncRagToolResourceWithRawResponse,
8 | RagToolResourceWithStreamingResponse,
9 | AsyncRagToolResourceWithStreamingResponse,
10 | )
11 | from .tool_runtime import (
12 | ToolRuntimeResource,
13 | AsyncToolRuntimeResource,
14 | ToolRuntimeResourceWithRawResponse,
15 | AsyncToolRuntimeResourceWithRawResponse,
16 | ToolRuntimeResourceWithStreamingResponse,
17 | AsyncToolRuntimeResourceWithStreamingResponse,
18 | )
19 |
20 | __all__ = [
21 | "RagToolResource",
22 | "AsyncRagToolResource",
23 | "RagToolResourceWithRawResponse",
24 | "AsyncRagToolResourceWithRawResponse",
25 | "RagToolResourceWithStreamingResponse",
26 | "AsyncRagToolResourceWithStreamingResponse",
27 | "ToolRuntimeResource",
28 | "AsyncToolRuntimeResource",
29 | "ToolRuntimeResourceWithRawResponse",
30 | "AsyncToolRuntimeResourceWithRawResponse",
31 | "ToolRuntimeResourceWithStreamingResponse",
32 | "AsyncToolRuntimeResourceWithStreamingResponse",
33 | ]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agent_create_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .shared_params.agent_config import AgentConfig
8 |
9 | __all__ = ["AgentCreateParams"]
10 |
11 |
12 | class AgentCreateParams(TypedDict, total=False):
13 | agent_config: Required[AgentConfig]
14 | """The configuration for the agent."""
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agent_create_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 |
5 | __all__ = ["AgentCreateResponse"]
6 |
7 |
8 | class AgentCreateResponse(BaseModel):
9 | agent_id: str
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from .turn import Turn as Turn
6 | from .session import Session as Session
7 | from .turn_create_params import TurnCreateParams as TurnCreateParams
8 | from .turn_resume_params import TurnResumeParams as TurnResumeParams
9 | from .turn_response_event import TurnResponseEvent as TurnResponseEvent
10 | from .session_create_params import SessionCreateParams as SessionCreateParams
11 | from .step_retrieve_response import StepRetrieveResponse as StepRetrieveResponse
12 | from .session_create_response import SessionCreateResponse as SessionCreateResponse
13 | from .session_retrieve_params import SessionRetrieveParams as SessionRetrieveParams
14 | from .turn_response_event_payload import TurnResponseEventPayload as TurnResponseEventPayload
15 | from .agent_turn_response_stream_chunk import AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/agent_turn_response_stream_chunk.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from ..._models import BaseModel
4 | from .turn_response_event import TurnResponseEvent
5 |
6 | __all__ = ["AgentTurnResponseStreamChunk"]
7 |
8 |
9 | class AgentTurnResponseStreamChunk(BaseModel):
10 | event: TurnResponseEvent
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/session.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from datetime import datetime
5 |
6 | from .turn import Turn
7 | from ..._models import BaseModel
8 |
9 | __all__ = ["Session"]
10 |
11 |
12 | class Session(BaseModel):
13 | session_id: str
14 |
15 | session_name: str
16 |
17 | started_at: datetime
18 |
19 | turns: List[Turn]
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/session_create_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["SessionCreateParams"]
8 |
9 |
10 | class SessionCreateParams(TypedDict, total=False):
11 | session_name: Required[str]
12 | """The name of the session to create."""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/session_create_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from ..._models import BaseModel
4 |
5 | __all__ = ["SessionCreateResponse"]
6 |
7 |
8 | class SessionCreateResponse(BaseModel):
9 | session_id: str
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/session_retrieve_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["SessionRetrieveParams"]
9 |
10 |
11 | class SessionRetrieveParams(TypedDict, total=False):
12 | agent_id: Required[str]
13 |
14 | turn_ids: List[str]
15 | """(Optional) List of turn IDs to filter the session by."""
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/step_retrieve_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 | from ..inference_step import InferenceStep
9 | from ..shield_call_step import ShieldCallStep
10 | from ..tool_execution_step import ToolExecutionStep
11 | from ..memory_retrieval_step import MemoryRetrievalStep
12 |
13 | __all__ = ["StepRetrieveResponse", "Step"]
14 |
15 | Step: TypeAlias = Annotated[
16 | Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep],
17 | PropertyInfo(discriminator="step_type"),
18 | ]
19 |
20 |
21 | class StepRetrieveResponse(BaseModel):
22 | step: Step
23 | """An inference step in an agent turn."""
24 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/turn_response_event.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from ..._models import BaseModel
4 | from .turn_response_event_payload import TurnResponseEventPayload
5 |
6 | __all__ = ["TurnResponseEvent"]
7 |
8 |
9 | class TurnResponseEvent(BaseModel):
10 | payload: TurnResponseEventPayload
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/agents/turn_resume_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union, Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from ..tool_response_param import ToolResponseParam
9 |
10 | __all__ = ["TurnResumeParamsBase", "TurnResumeParamsNonStreaming", "TurnResumeParamsStreaming"]
11 |
12 |
13 | class TurnResumeParamsBase(TypedDict, total=False):
14 | agent_id: Required[str]
15 |
16 | session_id: Required[str]
17 |
18 | tool_responses: Required[Iterable[ToolResponseParam]]
19 | """The tool call responses to resume the turn with."""
20 |
21 |
22 | class TurnResumeParamsNonStreaming(TurnResumeParamsBase, total=False):
23 | stream: Literal[False]
24 | """Whether to stream the response."""
25 |
26 |
27 | class TurnResumeParamsStreaming(TurnResumeParamsBase):
28 | stream: Required[Literal[True]]
29 | """Whether to stream the response."""
30 |
31 |
32 | TurnResumeParams = Union[TurnResumeParamsNonStreaming, TurnResumeParamsStreaming]
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/algorithm_config_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = ["AlgorithmConfigParam", "LoraFinetuningConfig", "QatFinetuningConfig"]
9 |
10 |
11 | class LoraFinetuningConfig(TypedDict, total=False):
12 | alpha: Required[int]
13 |
14 | apply_lora_to_mlp: Required[bool]
15 |
16 | apply_lora_to_output: Required[bool]
17 |
18 | lora_attn_modules: Required[List[str]]
19 |
20 | rank: Required[int]
21 |
22 | type: Required[Literal["LoRA"]]
23 |
24 | quantize_base: bool
25 |
26 | use_dora: bool
27 |
28 |
29 | class QatFinetuningConfig(TypedDict, total=False):
30 | group_size: Required[int]
31 |
32 | quantizer_name: Required[str]
33 |
34 | type: Required[Literal["QAT"]]
35 |
36 |
37 | AlgorithmConfigParam: TypeAlias = Union[LoraFinetuningConfig, QatFinetuningConfig]
38 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/benchmark.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["Benchmark"]
9 |
10 |
11 | class Benchmark(BaseModel):
12 | dataset_id: str
13 |
14 | identifier: str
15 |
16 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
17 |
18 | provider_id: str
19 |
20 | scoring_functions: List[str]
21 |
22 | type: Literal["benchmark"]
23 |
24 | provider_resource_id: Optional[str] = None
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/benchmark_config_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .eval_candidate_param import EvalCandidateParam
9 | from .scoring_fn_params_param import ScoringFnParamsParam
10 |
11 | __all__ = ["BenchmarkConfigParam"]
12 |
13 |
14 | class BenchmarkConfigParam(TypedDict, total=False):
15 | eval_candidate: Required[EvalCandidateParam]
16 | """The candidate to evaluate."""
17 |
18 | scoring_params: Required[Dict[str, ScoringFnParamsParam]]
19 | """
20 | Map between scoring function id and parameters for each scoring function you
21 | want to run
22 | """
23 |
24 | num_examples: int
25 | """(Optional) The number of examples to evaluate.
26 |
27 | If not provided, all examples in the dataset will be evaluated
28 | """
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/benchmark_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .benchmark import Benchmark
7 |
8 | __all__ = ["BenchmarkListResponse"]
9 |
10 | BenchmarkListResponse: TypeAlias = List[Benchmark]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/benchmark_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, List, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["BenchmarkRegisterParams"]
9 |
10 |
11 | class BenchmarkRegisterParams(TypedDict, total=False):
12 | benchmark_id: Required[str]
13 | """The ID of the benchmark to register."""
14 |
15 | dataset_id: Required[str]
16 | """The ID of the dataset to use for the benchmark."""
17 |
18 | scoring_functions: Required[List[str]]
19 | """The scoring functions to use for the benchmark."""
20 |
21 | metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
22 | """The metadata to use for the benchmark."""
23 |
24 | provider_benchmark_id: str
25 | """The ID of the provider benchmark to use for the benchmark."""
26 |
27 | provider_id: str
28 | """The ID of the provider to use for the benchmark."""
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/chat/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from .completion_list_params import CompletionListParams as CompletionListParams
6 | from .completion_create_params import CompletionCreateParams as CompletionCreateParams
7 | from .completion_list_response import CompletionListResponse as CompletionListResponse
8 | from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
9 | from .completion_retrieve_response import CompletionRetrieveResponse as CompletionRetrieveResponse
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/chat/completion_list_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Literal, TypedDict
6 |
7 | __all__ = ["CompletionListParams"]
8 |
9 |
10 | class CompletionListParams(TypedDict, total=False):
11 | after: str
12 | """The ID of the last chat completion to return."""
13 |
14 | limit: int
15 | """The maximum number of chat completions to return."""
16 |
17 | model: str
18 | """The model to filter by."""
19 |
20 | order: Literal["asc", "desc"]
21 | """The order to sort the chat completions by: "asc" or "desc". Defaults to "desc"."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/chat_completion_response_stream_chunk.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 | from .token_log_probs import TokenLogProbs
8 | from .shared.content_delta import ContentDelta
9 |
10 | __all__ = ["ChatCompletionResponseStreamChunk", "Event", "Metric"]
11 |
12 |
13 | class Event(BaseModel):
14 | delta: ContentDelta
15 | """Content generated since last event.
16 |
17 | This can be one or more tokens, or a tool call.
18 | """
19 |
20 | event_type: Literal["start", "complete", "progress"]
21 | """Type of the event"""
22 |
23 | logprobs: Optional[List[TokenLogProbs]] = None
24 | """Optional log probabilities for generated tokens"""
25 |
26 | stop_reason: Optional[Literal["end_of_turn", "end_of_message", "out_of_tokens"]] = None
27 | """Optional reason why generation stopped, if complete"""
28 |
29 |
30 | class Metric(BaseModel):
31 | metric: str
32 |
33 | value: float
34 |
35 | unit: Optional[str] = None
36 |
37 |
38 | class ChatCompletionResponseStreamChunk(BaseModel):
39 | event: Event
40 | """The event containing the new content"""
41 |
42 | metrics: Optional[List[Metric]] = None
43 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/completion_create_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = [
9 | "CompletionCreateResponse",
10 | "Choice",
11 | "ChoiceLogprobs",
12 | "ChoiceLogprobsContent",
13 | "ChoiceLogprobsContentTopLogprob",
14 | "ChoiceLogprobsRefusal",
15 | "ChoiceLogprobsRefusalTopLogprob",
16 | ]
17 |
18 |
19 | class ChoiceLogprobsContentTopLogprob(BaseModel):
20 | token: str
21 |
22 | logprob: float
23 |
24 | bytes: Optional[List[int]] = None
25 |
26 |
27 | class ChoiceLogprobsContent(BaseModel):
28 | token: str
29 |
30 | logprob: float
31 |
32 | top_logprobs: List[ChoiceLogprobsContentTopLogprob]
33 |
34 | bytes: Optional[List[int]] = None
35 |
36 |
37 | class ChoiceLogprobsRefusalTopLogprob(BaseModel):
38 | token: str
39 |
40 | logprob: float
41 |
42 | bytes: Optional[List[int]] = None
43 |
44 |
45 | class ChoiceLogprobsRefusal(BaseModel):
46 | token: str
47 |
48 | logprob: float
49 |
50 | top_logprobs: List[ChoiceLogprobsRefusalTopLogprob]
51 |
52 | bytes: Optional[List[int]] = None
53 |
54 |
55 | class ChoiceLogprobs(BaseModel):
56 | content: Optional[List[ChoiceLogprobsContent]] = None
57 | """(Optional) The log probabilities for the tokens in the message"""
58 |
59 | refusal: Optional[List[ChoiceLogprobsRefusal]] = None
60 | """(Optional) The log probabilities for the tokens in the message"""
61 |
62 |
63 | class Choice(BaseModel):
64 | finish_reason: str
65 |
66 | index: int
67 |
68 | text: str
69 |
70 | logprobs: Optional[ChoiceLogprobs] = None
71 | """
72 | The log probabilities for the tokens in the message from an OpenAI-compatible
73 | chat completion response.
74 | """
75 |
76 |
77 | class CompletionCreateResponse(BaseModel):
78 | id: str
79 |
80 | choices: List[Choice]
81 |
82 | created: int
83 |
84 | model: str
85 |
86 | object: Literal["text_completion"]
87 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/completion_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 | from .token_log_probs import TokenLogProbs
8 |
9 | __all__ = ["CompletionResponse", "Metric"]
10 |
11 |
12 | class Metric(BaseModel):
13 | metric: str
14 |
15 | value: float
16 |
17 | unit: Optional[str] = None
18 |
19 |
20 | class CompletionResponse(BaseModel):
21 | content: str
22 | """The generated completion text"""
23 |
24 | stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"]
25 | """Reason why generation stopped"""
26 |
27 | logprobs: Optional[List[TokenLogProbs]] = None
28 | """Optional log probabilities for generated tokens"""
29 |
30 | metrics: Optional[List[Metric]] = None
31 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/dataset_iterrows_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import TypedDict
6 |
7 | __all__ = ["DatasetIterrowsParams"]
8 |
9 |
10 | class DatasetIterrowsParams(TypedDict, total=False):
11 | limit: int
12 | """The number of rows to get."""
13 |
14 | start_index: int
15 | """Index into dataset for the first row to get. Get all rows if None."""
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/dataset_iterrows_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["DatasetIterrowsResponse"]
8 |
9 |
10 | class DatasetIterrowsResponse(BaseModel):
11 | data: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
12 | """The list of items for the current page"""
13 |
14 | has_more: bool
15 | """Whether there are more items available after this set"""
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/dataset_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from .._utils import PropertyInfo
7 | from .._models import BaseModel
8 |
9 | __all__ = [
10 | "DatasetListResponse",
11 | "DatasetListResponseItem",
12 | "DatasetListResponseItemSource",
13 | "DatasetListResponseItemSourceUriDataSource",
14 | "DatasetListResponseItemSourceRowsDataSource",
15 | ]
16 |
17 |
18 | class DatasetListResponseItemSourceUriDataSource(BaseModel):
19 | type: Literal["uri"]
20 |
21 | uri: str
22 | """The dataset can be obtained from a URI.
23 |
24 | E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
25 | "data:csv;base64,{base64_content}"
26 | """
27 |
28 |
29 | class DatasetListResponseItemSourceRowsDataSource(BaseModel):
30 | rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
31 | """The dataset is stored in rows.
32 |
33 | E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role":
34 | "assistant", "content": "Hello, world!"}]} ]
35 | """
36 |
37 | type: Literal["rows"]
38 |
39 |
40 | DatasetListResponseItemSource: TypeAlias = Annotated[
41 | Union[DatasetListResponseItemSourceUriDataSource, DatasetListResponseItemSourceRowsDataSource],
42 | PropertyInfo(discriminator="type"),
43 | ]
44 |
45 |
46 | class DatasetListResponseItem(BaseModel):
47 | identifier: str
48 |
49 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
50 |
51 | provider_id: str
52 |
53 | purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"]
54 | """Purpose of the dataset. Each purpose has a required input data schema."""
55 |
56 | source: DatasetListResponseItemSource
57 | """A dataset that can be obtained from a URI."""
58 |
59 | type: Literal["dataset"]
60 |
61 | provider_resource_id: Optional[str] = None
62 |
63 |
64 | DatasetListResponse: TypeAlias = List[DatasetListResponseItem]
65 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/dataset_register_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from .._utils import PropertyInfo
7 | from .._models import BaseModel
8 |
9 | __all__ = ["DatasetRegisterResponse", "Source", "SourceUriDataSource", "SourceRowsDataSource"]
10 |
11 |
12 | class SourceUriDataSource(BaseModel):
13 | type: Literal["uri"]
14 |
15 | uri: str
16 | """The dataset can be obtained from a URI.
17 |
18 | E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
19 | "data:csv;base64,{base64_content}"
20 | """
21 |
22 |
23 | class SourceRowsDataSource(BaseModel):
24 | rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
25 | """The dataset is stored in rows.
26 |
27 | E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role":
28 | "assistant", "content": "Hello, world!"}]} ]
29 | """
30 |
31 | type: Literal["rows"]
32 |
33 |
34 | Source: TypeAlias = Annotated[Union[SourceUriDataSource, SourceRowsDataSource], PropertyInfo(discriminator="type")]
35 |
36 |
37 | class DatasetRegisterResponse(BaseModel):
38 | identifier: str
39 |
40 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
41 |
42 | provider_id: str
43 |
44 | purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"]
45 | """Purpose of the dataset. Each purpose has a required input data schema."""
46 |
47 | source: Source
48 | """A dataset that can be obtained from a URI."""
49 |
50 | type: Literal["dataset"]
51 |
52 | provider_resource_id: Optional[str] = None
53 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/dataset_retrieve_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from .._utils import PropertyInfo
7 | from .._models import BaseModel
8 |
9 | __all__ = ["DatasetRetrieveResponse", "Source", "SourceUriDataSource", "SourceRowsDataSource"]
10 |
11 |
12 | class SourceUriDataSource(BaseModel):
13 | type: Literal["uri"]
14 |
15 | uri: str
16 | """The dataset can be obtained from a URI.
17 |
18 | E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
19 | "data:csv;base64,{base64_content}"
20 | """
21 |
22 |
23 | class SourceRowsDataSource(BaseModel):
24 | rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
25 | """The dataset is stored in rows.
26 |
27 | E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role":
28 | "assistant", "content": "Hello, world!"}]} ]
29 | """
30 |
31 | type: Literal["rows"]
32 |
33 |
34 | Source: TypeAlias = Annotated[Union[SourceUriDataSource, SourceRowsDataSource], PropertyInfo(discriminator="type")]
35 |
36 |
37 | class DatasetRetrieveResponse(BaseModel):
38 | identifier: str
39 |
40 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
41 |
42 | provider_id: str
43 |
44 | purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"]
45 | """Purpose of the dataset. Each purpose has a required input data schema."""
46 |
47 | source: Source
48 | """A dataset that can be obtained from a URI."""
49 |
50 | type: Literal["dataset"]
51 |
52 | provider_resource_id: Optional[str] = None
53 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/embeddings_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["EmbeddingsResponse"]
8 |
9 |
10 | class EmbeddingsResponse(BaseModel):
11 | embeddings: List[List[float]]
12 | """List of embedding vectors, one per input content.
13 |
14 | Each embedding is a list of floats. The dimensionality of the embedding is
15 | model-specific; you can check model metadata using /models/{model_id}
16 | """
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval_candidate_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | from .shared_params.agent_config import AgentConfig
9 | from .shared_params.system_message import SystemMessage
10 | from .shared_params.sampling_params import SamplingParams
11 |
12 | __all__ = ["EvalCandidateParam", "ModelCandidate", "AgentCandidate"]
13 |
14 |
15 | class ModelCandidate(TypedDict, total=False):
16 | model: Required[str]
17 | """The model ID to evaluate."""
18 |
19 | sampling_params: Required[SamplingParams]
20 | """The sampling parameters for the model."""
21 |
22 | type: Required[Literal["model"]]
23 |
24 | system_message: SystemMessage
25 | """(Optional) The system message providing instructions or context to the model."""
26 |
27 |
28 | class AgentCandidate(TypedDict, total=False):
29 | config: Required[AgentConfig]
30 | """The configuration for the agent candidate."""
31 |
32 | type: Required[Literal["agent"]]
33 |
34 |
35 | EvalCandidateParam: TypeAlias = Union[ModelCandidate, AgentCandidate]
36 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval_evaluate_rows_alpha_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, List, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .benchmark_config_param import BenchmarkConfigParam
9 |
10 | __all__ = ["EvalEvaluateRowsAlphaParams"]
11 |
12 |
13 | class EvalEvaluateRowsAlphaParams(TypedDict, total=False):
14 | benchmark_config: Required[BenchmarkConfigParam]
15 | """The configuration for the benchmark."""
16 |
17 | input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]]
18 | """The rows to evaluate."""
19 |
20 | scoring_functions: Required[List[str]]
21 | """The scoring functions to use for the evaluation."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval_evaluate_rows_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, List, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .benchmark_config_param import BenchmarkConfigParam
9 |
10 | __all__ = ["EvalEvaluateRowsParams"]
11 |
12 |
13 | class EvalEvaluateRowsParams(TypedDict, total=False):
14 | benchmark_config: Required[BenchmarkConfigParam]
15 | """The configuration for the benchmark."""
16 |
17 | input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]]
18 | """The rows to evaluate."""
19 |
20 | scoring_functions: Required[List[str]]
21 | """The scoring functions to use for the evaluation."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval_run_eval_alpha_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .benchmark_config_param import BenchmarkConfigParam
8 |
9 | __all__ = ["EvalRunEvalAlphaParams"]
10 |
11 |
12 | class EvalRunEvalAlphaParams(TypedDict, total=False):
13 | benchmark_config: Required[BenchmarkConfigParam]
14 | """The configuration for the benchmark."""
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/eval_run_eval_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .benchmark_config_param import BenchmarkConfigParam
8 |
9 | __all__ = ["EvalRunEvalParams"]
10 |
11 |
12 | class EvalRunEvalParams(TypedDict, total=False):
13 | benchmark_config: Required[BenchmarkConfigParam]
14 | """The configuration for the benchmark."""
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/evaluate_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 |
5 | from .._models import BaseModel
6 | from .shared.scoring_result import ScoringResult
7 |
8 | __all__ = ["EvaluateResponse"]
9 |
10 |
11 | class EvaluateResponse(BaseModel):
12 | generations: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
13 | """The generations from the evaluation."""
14 |
15 | scores: Dict[str, ScoringResult]
16 | """The scores from the evaluation."""
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/health_info.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing_extensions import Literal
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["HealthInfo"]
8 |
9 |
10 | class HealthInfo(BaseModel):
11 | status: Literal["OK", "Error", "Not Implemented"]
12 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/inference_batch_chat_completion_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from .._models import BaseModel
6 | from .shared.chat_completion_response import ChatCompletionResponse
7 |
8 | __all__ = ["InferenceBatchChatCompletionResponse"]
9 |
10 |
11 | class InferenceBatchChatCompletionResponse(BaseModel):
12 | batch: List[ChatCompletionResponse]
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/inference_batch_completion_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .shared_params.response_format import ResponseFormat
9 | from .shared_params.sampling_params import SamplingParams
10 | from .shared_params.interleaved_content import InterleavedContent
11 |
12 | __all__ = ["InferenceBatchCompletionParams", "Logprobs"]
13 |
14 |
15 | class InferenceBatchCompletionParams(TypedDict, total=False):
16 | content_batch: Required[List[InterleavedContent]]
17 | """The content to generate completions for."""
18 |
19 | model_id: Required[str]
20 | """The identifier of the model to use.
21 |
22 | The model must be registered with Llama Stack and available via the /models
23 | endpoint.
24 | """
25 |
26 | logprobs: Logprobs
27 | """
28 | (Optional) If specified, log probabilities for each token position will be
29 | returned.
30 | """
31 |
32 | response_format: ResponseFormat
33 | """(Optional) Grammar specification for guided (structured) decoding."""
34 |
35 | sampling_params: SamplingParams
36 | """(Optional) Parameters to control the sampling strategy."""
37 |
38 |
39 | class Logprobs(TypedDict, total=False):
40 | top_k: int
41 | """How many tokens (for each position) to return log probabilities for."""
42 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/inference_completion_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from .shared_params.response_format import ResponseFormat
9 | from .shared_params.sampling_params import SamplingParams
10 | from .shared_params.interleaved_content import InterleavedContent
11 |
12 | __all__ = [
13 | "InferenceCompletionParamsBase",
14 | "Logprobs",
15 | "InferenceCompletionParamsNonStreaming",
16 | "InferenceCompletionParamsStreaming",
17 | ]
18 |
19 |
20 | class InferenceCompletionParamsBase(TypedDict, total=False):
21 | content: Required[InterleavedContent]
22 | """The content to generate a completion for."""
23 |
24 | model_id: Required[str]
25 | """The identifier of the model to use.
26 |
27 | The model must be registered with Llama Stack and available via the /models
28 | endpoint.
29 | """
30 |
31 | logprobs: Logprobs
32 | """
33 | (Optional) If specified, log probabilities for each token position will be
34 | returned.
35 | """
36 |
37 | response_format: ResponseFormat
38 | """(Optional) Grammar specification for guided (structured) decoding."""
39 |
40 | sampling_params: SamplingParams
41 | """(Optional) Parameters to control the sampling strategy."""
42 |
43 |
44 | class Logprobs(TypedDict, total=False):
45 | top_k: int
46 | """How many tokens (for each position) to return log probabilities for."""
47 |
48 |
49 | class InferenceCompletionParamsNonStreaming(InferenceCompletionParamsBase, total=False):
50 | stream: Literal[False]
51 | """(Optional) If True, generate an SSE event stream of the response.
52 |
53 | Defaults to False.
54 | """
55 |
56 |
57 | class InferenceCompletionParamsStreaming(InferenceCompletionParamsBase):
58 | stream: Required[Literal[True]]
59 | """(Optional) If True, generate an SSE event stream of the response.
60 |
61 | Defaults to False.
62 | """
63 |
64 |
65 | InferenceCompletionParams = Union[InferenceCompletionParamsNonStreaming, InferenceCompletionParamsStreaming]
66 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/inference_embeddings_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Union, Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from .shared_params.interleaved_content_item import InterleavedContentItem
9 |
10 | __all__ = ["InferenceEmbeddingsParams"]
11 |
12 |
13 | class InferenceEmbeddingsParams(TypedDict, total=False):
14 | contents: Required[Union[List[str], Iterable[InterleavedContentItem]]]
15 | """List of contents to generate embeddings for.
16 |
17 | Each content can be a string or an InterleavedContentItem (and hence can be
18 | multimodal). The behavior depends on the model and provider. Some models may
19 | only support text.
20 | """
21 |
22 | model_id: Required[str]
23 | """The identifier of the model to use.
24 |
25 | The model must be an embedding model registered with Llama Stack and available
26 | via the /models endpoint.
27 | """
28 |
29 | output_dimension: int
30 | """(Optional) Output dimensionality for the embeddings.
31 |
32 | Only supported by Matryoshka models.
33 | """
34 |
35 | task_type: Literal["query", "document"]
36 | """
37 | (Optional) How is the embedding being used? This is only supported by asymmetric
38 | embedding models.
39 | """
40 |
41 | text_truncation: Literal["none", "start", "end"]
42 | """
43 | (Optional) Config for how to truncate text for embedding when text is longer
44 | than the model's max sequence length.
45 | """
46 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/inference_step.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from pydantic import Field as FieldInfo
8 |
9 | from .._models import BaseModel
10 | from .shared.completion_message import CompletionMessage
11 |
12 | __all__ = ["InferenceStep"]
13 |
14 |
15 | class InferenceStep(BaseModel):
16 | api_model_response: CompletionMessage = FieldInfo(alias="model_response")
17 | """The response from the LLM."""
18 |
19 | step_id: str
20 | """The ID of the step."""
21 |
22 | step_type: Literal["inference"]
23 | """Type of the step in an agent turn."""
24 |
25 | turn_id: str
26 | """The ID of the turn."""
27 |
28 | completed_at: Optional[datetime] = None
29 | """The time the step completed."""
30 |
31 | started_at: Optional[datetime] = None
32 | """The time the step started."""
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/job.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing_extensions import Literal
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["Job"]
8 |
9 |
10 | class Job(BaseModel):
11 | job_id: str
12 |
13 | status: Literal["completed", "in_progress", "failed", "scheduled", "cancelled"]
14 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_benchmarks_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .benchmark_list_response import BenchmarkListResponse
5 |
6 | __all__ = ["ListBenchmarksResponse"]
7 |
8 |
9 | class ListBenchmarksResponse(BaseModel):
10 | data: BenchmarkListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_datasets_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .dataset_list_response import DatasetListResponse
5 |
6 | __all__ = ["ListDatasetsResponse"]
7 |
8 |
9 | class ListDatasetsResponse(BaseModel):
10 | data: DatasetListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_models_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .model_list_response import ModelListResponse
5 |
6 | __all__ = ["ListModelsResponse"]
7 |
8 |
9 | class ListModelsResponse(BaseModel):
10 | data: ModelListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_post_training_jobs_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["ListPostTrainingJobsResponse", "Data"]
8 |
9 |
10 | class Data(BaseModel):
11 | job_uuid: str
12 |
13 |
14 | class ListPostTrainingJobsResponse(BaseModel):
15 | data: List[Data]
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_providers_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .provider_list_response import ProviderListResponse
5 |
6 | __all__ = ["ListProvidersResponse"]
7 |
8 |
9 | class ListProvidersResponse(BaseModel):
10 | data: ProviderListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_routes_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .route_list_response import RouteListResponse
5 |
6 | __all__ = ["ListRoutesResponse"]
7 |
8 |
9 | class ListRoutesResponse(BaseModel):
10 | data: RouteListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_scoring_functions_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .scoring_function_list_response import ScoringFunctionListResponse
5 |
6 | __all__ = ["ListScoringFunctionsResponse"]
7 |
8 |
9 | class ListScoringFunctionsResponse(BaseModel):
10 | data: ScoringFunctionListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_shields_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .shield_list_response import ShieldListResponse
5 |
6 | __all__ = ["ListShieldsResponse"]
7 |
8 |
9 | class ListShieldsResponse(BaseModel):
10 | data: ShieldListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_tool_groups_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .toolgroup_list_response import ToolgroupListResponse
5 |
6 | __all__ = ["ListToolGroupsResponse"]
7 |
8 |
9 | class ListToolGroupsResponse(BaseModel):
10 | data: ToolgroupListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_tools_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .tool_list_response import ToolListResponse
5 |
6 | __all__ = ["ListToolsResponse"]
7 |
8 |
9 | class ListToolsResponse(BaseModel):
10 | data: ToolListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/list_vector_dbs_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .vector_db_list_response import VectorDBListResponse
5 |
6 | __all__ = ["ListVectorDBsResponse"]
7 |
8 |
9 | class ListVectorDBsResponse(BaseModel):
10 | data: VectorDBListResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/memory_retrieval_step.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from .._models import BaseModel
8 | from .shared.interleaved_content import InterleavedContent
9 |
10 | __all__ = ["MemoryRetrievalStep"]
11 |
12 |
13 | class MemoryRetrievalStep(BaseModel):
14 | inserted_context: InterleavedContent
15 | """The context retrieved from the vector databases."""
16 |
17 | step_id: str
18 | """The ID of the step."""
19 |
20 | step_type: Literal["memory_retrieval"]
21 | """Type of the step in an agent turn."""
22 |
23 | turn_id: str
24 | """The ID of the turn."""
25 |
26 | vector_db_ids: str
27 | """The IDs of the vector databases to retrieve context from."""
28 |
29 | completed_at: Optional[datetime] = None
30 | """The time the step completed."""
31 |
32 | started_at: Optional[datetime] = None
33 | """The time the step started."""
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/model.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from pydantic import Field as FieldInfo
7 |
8 | from .._models import BaseModel
9 |
10 | __all__ = ["Model"]
11 |
12 |
13 | class Model(BaseModel):
14 | identifier: str
15 |
16 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
17 |
18 | api_model_type: Literal["llm", "embedding"] = FieldInfo(alias="model_type")
19 |
20 | provider_id: str
21 |
22 | type: Literal["model"]
23 |
24 | provider_resource_id: Optional[str] = None
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/model_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .model import Model
7 |
8 | __all__ = ["ModelListResponse"]
9 |
10 | ModelListResponse: TypeAlias = List[Model]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/model_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | __all__ = ["ModelRegisterParams"]
9 |
10 |
11 | class ModelRegisterParams(TypedDict, total=False):
12 | model_id: Required[str]
13 | """The identifier of the model to register."""
14 |
15 | metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
16 | """Any additional metadata for this model."""
17 |
18 | model_type: Literal["llm", "embedding"]
19 | """The type of model to register."""
20 |
21 | provider_id: str
22 | """The identifier of the provider."""
23 |
24 | provider_model_id: str
25 | """The identifier of the model in the provider."""
26 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from .job_cancel_params import JobCancelParams as JobCancelParams
6 | from .job_list_response import JobListResponse as JobListResponse
7 | from .job_status_params import JobStatusParams as JobStatusParams
8 | from .job_status_response import JobStatusResponse as JobStatusResponse
9 | from .job_artifacts_params import JobArtifactsParams as JobArtifactsParams
10 | from .job_artifacts_response import JobArtifactsResponse as JobArtifactsResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_artifacts_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["JobArtifactsParams"]
8 |
9 |
10 | class JobArtifactsParams(TypedDict, total=False):
11 | job_uuid: Required[str]
12 | """The UUID of the job to get the artifacts of."""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_artifacts_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from ..._models import BaseModel
6 |
7 | __all__ = ["JobArtifactsResponse"]
8 |
9 |
10 | class JobArtifactsResponse(BaseModel):
11 | checkpoints: List[object]
12 |
13 | job_uuid: str
14 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_cancel_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["JobCancelParams"]
8 |
9 |
10 | class JobCancelParams(TypedDict, total=False):
11 | job_uuid: Required[str]
12 | """The UUID of the job to cancel."""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from ..._models import BaseModel
7 |
8 | __all__ = ["JobListResponse", "JobListResponseItem"]
9 |
10 |
11 | class JobListResponseItem(BaseModel):
12 | job_uuid: str
13 |
14 |
15 | JobListResponse: TypeAlias = List[JobListResponseItem]
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_status_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["JobStatusParams"]
8 |
9 |
10 | class JobStatusParams(TypedDict, total=False):
11 | job_uuid: Required[str]
12 | """The UUID of the job to get the status of."""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training/job_status_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from ..._models import BaseModel
8 |
9 | __all__ = ["JobStatusResponse"]
10 |
11 |
12 | class JobStatusResponse(BaseModel):
13 | checkpoints: List[object]
14 |
15 | job_uuid: str
16 |
17 | status: Literal["completed", "in_progress", "failed", "scheduled", "cancelled"]
18 |
19 | completed_at: Optional[datetime] = None
20 |
21 | resources_allocated: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
22 |
23 | scheduled_at: Optional[datetime] = None
24 |
25 | started_at: Optional[datetime] = None
26 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/post_training_job.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 |
5 | __all__ = ["PostTrainingJob"]
6 |
7 |
8 | class PostTrainingJob(BaseModel):
9 | job_uuid: str
10 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/provider_info.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["ProviderInfo"]
8 |
9 |
10 | class ProviderInfo(BaseModel):
11 | api: str
12 |
13 | config: Dict[str, Union[bool, float, str, List[object], object, None]]
14 |
15 | health: Dict[str, Union[bool, float, str, List[object], object, None]]
16 |
17 | provider_id: str
18 |
19 | provider_type: str
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/provider_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .provider_info import ProviderInfo
7 |
8 | __all__ = ["ProviderListResponse"]
9 |
10 | ProviderListResponse: TypeAlias = List[ProviderInfo]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/query_chunks_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 |
5 | from .._models import BaseModel
6 | from .shared.interleaved_content import InterleavedContent
7 |
8 | __all__ = ["QueryChunksResponse", "Chunk"]
9 |
10 |
11 | class Chunk(BaseModel):
12 | content: InterleavedContent
13 | """A image content item"""
14 |
15 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
16 |
17 |
18 | class QueryChunksResponse(BaseModel):
19 | chunks: List[Chunk]
20 |
21 | scores: List[float]
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/query_condition_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union, Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | __all__ = ["QueryConditionParam"]
9 |
10 |
11 | class QueryConditionParam(TypedDict, total=False):
12 | key: Required[str]
13 |
14 | op: Required[Literal["eq", "ne", "gt", "lt"]]
15 |
16 | value: Required[Union[bool, float, str, Iterable[object], object, None]]
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/query_spans_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 | from .telemetry_query_spans_response import TelemetryQuerySpansResponse
5 |
6 | __all__ = ["QuerySpansResponse"]
7 |
8 |
9 | class QuerySpansResponse(BaseModel):
10 | data: TelemetryQuerySpansResponse
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/response_object_stream.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from .._utils import PropertyInfo
7 | from .._models import BaseModel
8 | from .response_object import ResponseObject
9 |
10 | __all__ = [
11 | "ResponseObjectStream",
12 | "OpenAIResponseObjectStreamResponseCreated",
13 | "OpenAIResponseObjectStreamResponseCompleted",
14 | ]
15 |
16 |
17 | class OpenAIResponseObjectStreamResponseCreated(BaseModel):
18 | response: ResponseObject
19 |
20 | type: Literal["response.created"]
21 |
22 |
23 | class OpenAIResponseObjectStreamResponseCompleted(BaseModel):
24 | response: ResponseObject
25 |
26 | type: Literal["response.completed"]
27 |
28 |
29 | ResponseObjectStream: TypeAlias = Annotated[
30 | Union[OpenAIResponseObjectStreamResponseCreated, OpenAIResponseObjectStreamResponseCompleted],
31 | PropertyInfo(discriminator="type"),
32 | ]
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/route_info.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["RouteInfo"]
8 |
9 |
10 | class RouteInfo(BaseModel):
11 | method: str
12 |
13 | provider_types: List[str]
14 |
15 | route: str
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/route_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .route_info import RouteInfo
7 |
8 | __all__ = ["RouteListResponse"]
9 |
10 | RouteListResponse: TypeAlias = List[RouteInfo]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/run_shield_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 |
5 | from .._models import BaseModel
6 | from .shared.safety_violation import SafetyViolation
7 |
8 | __all__ = ["RunShieldResponse"]
9 |
10 |
11 | class RunShieldResponse(BaseModel):
12 | violation: Optional[SafetyViolation] = None
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/safety_run_shield_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .shared_params.message import Message
9 |
10 | __all__ = ["SafetyRunShieldParams"]
11 |
12 |
13 | class SafetyRunShieldParams(TypedDict, total=False):
14 | messages: Required[Iterable[Message]]
15 | """The messages to run the shield on."""
16 |
17 | params: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]
18 | """The parameters of the shield."""
19 |
20 | shield_id: Required[str]
21 | """The identifier of the shield to run."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_fn.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 | from .scoring_fn_params import ScoringFnParams
8 | from .shared.return_type import ReturnType
9 |
10 | __all__ = ["ScoringFn"]
11 |
12 |
13 | class ScoringFn(BaseModel):
14 | identifier: str
15 |
16 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
17 |
18 | provider_id: str
19 |
20 | return_type: ReturnType
21 |
22 | type: Literal["scoring_function"]
23 |
24 | description: Optional[str] = None
25 |
26 | params: Optional[ScoringFnParams] = None
27 |
28 | provider_resource_id: Optional[str] = None
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_fn_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from .._utils import PropertyInfo
7 | from .._models import BaseModel
8 |
9 | __all__ = ["ScoringFnParams", "LlmAsJudgeScoringFnParams", "RegexParserScoringFnParams", "BasicScoringFnParams"]
10 |
11 |
12 | class LlmAsJudgeScoringFnParams(BaseModel):
13 | aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
14 |
15 | judge_model: str
16 |
17 | judge_score_regexes: List[str]
18 |
19 | type: Literal["llm_as_judge"]
20 |
21 | prompt_template: Optional[str] = None
22 |
23 |
24 | class RegexParserScoringFnParams(BaseModel):
25 | aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
26 |
27 | parsing_regexes: List[str]
28 |
29 | type: Literal["regex_parser"]
30 |
31 |
32 | class BasicScoringFnParams(BaseModel):
33 | aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
34 |
35 | type: Literal["basic"]
36 |
37 |
38 | ScoringFnParams: TypeAlias = Annotated[
39 | Union[LlmAsJudgeScoringFnParams, RegexParserScoringFnParams, BasicScoringFnParams],
40 | PropertyInfo(discriminator="type"),
41 | ]
42 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_fn_params_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = ["ScoringFnParamsParam", "LlmAsJudgeScoringFnParams", "RegexParserScoringFnParams", "BasicScoringFnParams"]
9 |
10 |
11 | class LlmAsJudgeScoringFnParams(TypedDict, total=False):
12 | aggregation_functions: Required[
13 | List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
14 | ]
15 |
16 | judge_model: Required[str]
17 |
18 | judge_score_regexes: Required[List[str]]
19 |
20 | type: Required[Literal["llm_as_judge"]]
21 |
22 | prompt_template: str
23 |
24 |
25 | class RegexParserScoringFnParams(TypedDict, total=False):
26 | aggregation_functions: Required[
27 | List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
28 | ]
29 |
30 | parsing_regexes: Required[List[str]]
31 |
32 | type: Required[Literal["regex_parser"]]
33 |
34 |
35 | class BasicScoringFnParams(TypedDict, total=False):
36 | aggregation_functions: Required[
37 | List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]]
38 | ]
39 |
40 | type: Required[Literal["basic"]]
41 |
42 |
43 | ScoringFnParamsParam: TypeAlias = Union[LlmAsJudgeScoringFnParams, RegexParserScoringFnParams, BasicScoringFnParams]
44 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_function_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .scoring_fn import ScoringFn
7 |
8 | __all__ = ["ScoringFunctionListResponse"]
9 |
10 | ScoringFunctionListResponse: TypeAlias = List[ScoringFn]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_function_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .scoring_fn_params_param import ScoringFnParamsParam
8 | from .shared_params.return_type import ReturnType
9 |
10 | __all__ = ["ScoringFunctionRegisterParams"]
11 |
12 |
13 | class ScoringFunctionRegisterParams(TypedDict, total=False):
14 | description: Required[str]
15 | """The description of the scoring function."""
16 |
17 | return_type: Required[ReturnType]
18 |
19 | scoring_fn_id: Required[str]
20 | """The ID of the scoring function to register."""
21 |
22 | params: ScoringFnParamsParam
23 | """
24 | The parameters for the scoring function for benchmark eval, these can be
25 | overridden for app eval.
26 | """
27 |
28 | provider_id: str
29 | """The ID of the provider to use for the scoring function."""
30 |
31 | provider_scoring_fn_id: str
32 | """The ID of the provider scoring function to use for the scoring function."""
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_score_batch_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Optional
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .scoring_fn_params_param import ScoringFnParamsParam
9 |
10 | __all__ = ["ScoringScoreBatchParams"]
11 |
12 |
13 | class ScoringScoreBatchParams(TypedDict, total=False):
14 | dataset_id: Required[str]
15 | """The ID of the dataset to score."""
16 |
17 | save_results_dataset: Required[bool]
18 | """Whether to save the results to a dataset."""
19 |
20 | scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]]
21 | """The scoring functions to use for the scoring."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_score_batch_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, Optional
4 |
5 | from .._models import BaseModel
6 | from .shared.scoring_result import ScoringResult
7 |
8 | __all__ = ["ScoringScoreBatchResponse"]
9 |
10 |
11 | class ScoringScoreBatchResponse(BaseModel):
12 | results: Dict[str, ScoringResult]
13 |
14 | dataset_id: Optional[str] = None
15 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_score_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable, Optional
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .scoring_fn_params_param import ScoringFnParamsParam
9 |
10 | __all__ = ["ScoringScoreParams"]
11 |
12 |
13 | class ScoringScoreParams(TypedDict, total=False):
14 | input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]]
15 | """The rows to score."""
16 |
17 | scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]]
18 | """The scoring functions to use for the scoring."""
19 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/scoring_score_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict
4 |
5 | from .._models import BaseModel
6 | from .shared.scoring_result import ScoringResult
7 |
8 | __all__ = ["ScoringScoreResponse"]
9 |
10 |
11 | class ScoringScoreResponse(BaseModel):
12 | results: Dict[str, ScoringResult]
13 | """A map of scoring function name to ScoringResult."""
14 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .message import Message as Message
4 | from .document import Document as Document
5 | from .tool_call import ToolCall as ToolCall
6 | from .param_type import ParamType as ParamType
7 | from .return_type import ReturnType as ReturnType
8 | from .agent_config import AgentConfig as AgentConfig
9 | from .query_config import QueryConfig as QueryConfig
10 | from .query_result import QueryResult as QueryResult
11 | from .user_message import UserMessage as UserMessage
12 | from .content_delta import ContentDelta as ContentDelta
13 | from .scoring_result import ScoringResult as ScoringResult
14 | from .system_message import SystemMessage as SystemMessage
15 | from .response_format import ResponseFormat as ResponseFormat
16 | from .sampling_params import SamplingParams as SamplingParams
17 | from .batch_completion import BatchCompletion as BatchCompletion
18 | from .safety_violation import SafetyViolation as SafetyViolation
19 | from .completion_message import CompletionMessage as CompletionMessage
20 | from .interleaved_content import InterleavedContent as InterleavedContent
21 | from .tool_call_or_string import ToolCallOrString as ToolCallOrString
22 | from .tool_param_definition import ToolParamDefinition as ToolParamDefinition
23 | from .tool_response_message import ToolResponseMessage as ToolResponseMessage
24 | from .query_generator_config import QueryGeneratorConfig as QueryGeneratorConfig
25 | from .chat_completion_response import ChatCompletionResponse as ChatCompletionResponse
26 | from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem
27 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/batch_completion.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 |
5 | from ..._models import BaseModel
6 | from ..completion_response import CompletionResponse
7 |
8 | __all__ = ["BatchCompletion"]
9 |
10 |
11 | class BatchCompletion(BaseModel):
12 | batch: List[CompletionResponse]
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/chat_completion_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 |
5 | from ..._models import BaseModel
6 | from ..token_log_probs import TokenLogProbs
7 | from .completion_message import CompletionMessage
8 |
9 | __all__ = ["ChatCompletionResponse", "Metric"]
10 |
11 |
12 | class Metric(BaseModel):
13 | metric: str
14 |
15 | value: float
16 |
17 | unit: Optional[str] = None
18 |
19 |
20 | class ChatCompletionResponse(BaseModel):
21 | completion_message: CompletionMessage
22 | """The complete response message"""
23 |
24 | logprobs: Optional[List[TokenLogProbs]] = None
25 | """Optional log probabilities for generated tokens"""
26 |
27 | metrics: Optional[List[Metric]] = None
28 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/completion_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from typing_extensions import Literal
5 |
6 | from ..._models import BaseModel
7 | from .tool_call import ToolCall
8 | from .interleaved_content import InterleavedContent
9 |
10 | __all__ = ["CompletionMessage"]
11 |
12 |
13 | class CompletionMessage(BaseModel):
14 | content: InterleavedContent
15 | """The content of the model's response"""
16 |
17 | role: Literal["assistant"]
18 | """Must be "assistant" to identify this as the model's response"""
19 |
20 | stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"]
21 | """Reason why the model stopped generating.
22 |
23 | Options are: - `StopReason.end_of_turn`: The model finished generating the
24 | entire response. - `StopReason.end_of_message`: The model finished generating
25 | but generated a partial response -- usually, a tool call. The user may call the
26 | tool and continue the conversation with the tool's response. -
27 | `StopReason.out_of_tokens`: The model ran out of token budget.
28 | """
29 |
30 | tool_calls: Optional[List[ToolCall]] = None
31 | """List of tool calls. Each tool call is a ToolCall object."""
32 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/content_delta.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 | from .tool_call_or_string import ToolCallOrString
9 |
10 | __all__ = ["ContentDelta", "TextDelta", "ImageDelta", "ToolCallDelta"]
11 |
12 |
13 | class TextDelta(BaseModel):
14 | text: str
15 |
16 | type: Literal["text"]
17 |
18 |
19 | class ImageDelta(BaseModel):
20 | image: str
21 |
22 | type: Literal["image"]
23 |
24 |
25 | class ToolCallDelta(BaseModel):
26 | parse_status: Literal["started", "in_progress", "failed", "succeeded"]
27 |
28 | tool_call: ToolCallOrString
29 |
30 | type: Literal["tool_call"]
31 |
32 |
33 | ContentDelta: TypeAlias = Annotated[Union[TextDelta, ImageDelta, ToolCallDelta], PropertyInfo(discriminator="type")]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/document.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal, TypeAlias
5 |
6 | from ..._models import BaseModel
7 | from .interleaved_content_item import InterleavedContentItem
8 |
9 | __all__ = [
10 | "Document",
11 | "Content",
12 | "ContentImageContentItem",
13 | "ContentImageContentItemImage",
14 | "ContentImageContentItemImageURL",
15 | "ContentTextContentItem",
16 | "ContentURL",
17 | ]
18 |
19 |
20 | class ContentImageContentItemImageURL(BaseModel):
21 | uri: str
22 |
23 |
24 | class ContentImageContentItemImage(BaseModel):
25 | data: Optional[str] = None
26 | """base64 encoded image data as string"""
27 |
28 | url: Optional[ContentImageContentItemImageURL] = None
29 | """A URL of the image or data URL in the format of data:image/{type};base64,{data}.
30 |
31 | Note that URL could have length limits.
32 | """
33 |
34 |
35 | class ContentImageContentItem(BaseModel):
36 | image: ContentImageContentItemImage
37 | """Image as a base64 encoded string or an URL"""
38 |
39 | type: Literal["image"]
40 | """Discriminator type of the content item. Always "image" """
41 |
42 |
43 | class ContentTextContentItem(BaseModel):
44 | text: str
45 | """Text content"""
46 |
47 | type: Literal["text"]
48 | """Discriminator type of the content item. Always "text" """
49 |
50 |
51 | class ContentURL(BaseModel):
52 | uri: str
53 |
54 |
55 | Content: TypeAlias = Union[
56 | str, ContentImageContentItem, ContentTextContentItem, List[InterleavedContentItem], ContentURL
57 | ]
58 |
59 |
60 | class Document(BaseModel):
61 | content: Content
62 | """The content of the document."""
63 |
64 | document_id: str
65 | """The unique identifier for the document."""
66 |
67 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
68 | """Additional metadata for the document."""
69 |
70 | mime_type: Optional[str] = None
71 | """The MIME type of the document."""
72 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/interleaved_content.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Union, Optional
4 | from typing_extensions import Literal, TypeAlias
5 |
6 | from ..._models import BaseModel
7 | from .interleaved_content_item import InterleavedContentItem
8 |
9 | __all__ = [
10 | "InterleavedContent",
11 | "ImageContentItem",
12 | "ImageContentItemImage",
13 | "ImageContentItemImageURL",
14 | "TextContentItem",
15 | ]
16 |
17 |
18 | class ImageContentItemImageURL(BaseModel):
19 | uri: str
20 |
21 |
22 | class ImageContentItemImage(BaseModel):
23 | data: Optional[str] = None
24 | """base64 encoded image data as string"""
25 |
26 | url: Optional[ImageContentItemImageURL] = None
27 | """A URL of the image or data URL in the format of data:image/{type};base64,{data}.
28 |
29 | Note that URL could have length limits.
30 | """
31 |
32 |
33 | class ImageContentItem(BaseModel):
34 | image: ImageContentItemImage
35 | """Image as a base64 encoded string or an URL"""
36 |
37 | type: Literal["image"]
38 | """Discriminator type of the content item. Always "image" """
39 |
40 |
41 | class TextContentItem(BaseModel):
42 | text: str
43 | """Text content"""
44 |
45 | type: Literal["text"]
46 | """Discriminator type of the content item. Always "text" """
47 |
48 |
49 | InterleavedContent: TypeAlias = Union[str, ImageContentItem, TextContentItem, List[InterleavedContentItem]]
50 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/interleaved_content_item.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 |
9 | __all__ = [
10 | "InterleavedContentItem",
11 | "ImageContentItem",
12 | "ImageContentItemImage",
13 | "ImageContentItemImageURL",
14 | "TextContentItem",
15 | ]
16 |
17 |
18 | class ImageContentItemImageURL(BaseModel):
19 | uri: str
20 |
21 |
22 | class ImageContentItemImage(BaseModel):
23 | data: Optional[str] = None
24 | """base64 encoded image data as string"""
25 |
26 | url: Optional[ImageContentItemImageURL] = None
27 | """A URL of the image or data URL in the format of data:image/{type};base64,{data}.
28 |
29 | Note that URL could have length limits.
30 | """
31 |
32 |
33 | class ImageContentItem(BaseModel):
34 | image: ImageContentItemImage
35 | """Image as a base64 encoded string or an URL"""
36 |
37 | type: Literal["image"]
38 | """Discriminator type of the content item. Always "image" """
39 |
40 |
41 | class TextContentItem(BaseModel):
42 | text: str
43 | """Text content"""
44 |
45 | type: Literal["text"]
46 | """Discriminator type of the content item. Always "text" """
47 |
48 |
49 | InterleavedContentItem: TypeAlias = Annotated[
50 | Union[ImageContentItem, TextContentItem], PropertyInfo(discriminator="type")
51 | ]
52 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from .user_message import UserMessage
8 | from .system_message import SystemMessage
9 | from .completion_message import CompletionMessage
10 | from .tool_response_message import ToolResponseMessage
11 |
12 | __all__ = ["Message"]
13 |
14 | Message: TypeAlias = Annotated[
15 | Union[UserMessage, SystemMessage, ToolResponseMessage, CompletionMessage], PropertyInfo(discriminator="role")
16 | ]
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/param_type.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 |
9 | __all__ = [
10 | "ParamType",
11 | "StringType",
12 | "NumberType",
13 | "BooleanType",
14 | "ArrayType",
15 | "ObjectType",
16 | "JsonType",
17 | "UnionType",
18 | "ChatCompletionInputType",
19 | "CompletionInputType",
20 | "AgentTurnInputType",
21 | ]
22 |
23 |
24 | class StringType(BaseModel):
25 | type: Literal["string"]
26 |
27 |
28 | class NumberType(BaseModel):
29 | type: Literal["number"]
30 |
31 |
32 | class BooleanType(BaseModel):
33 | type: Literal["boolean"]
34 |
35 |
36 | class ArrayType(BaseModel):
37 | type: Literal["array"]
38 |
39 |
40 | class ObjectType(BaseModel):
41 | type: Literal["object"]
42 |
43 |
44 | class JsonType(BaseModel):
45 | type: Literal["json"]
46 |
47 |
48 | class UnionType(BaseModel):
49 | type: Literal["union"]
50 |
51 |
52 | class ChatCompletionInputType(BaseModel):
53 | type: Literal["chat_completion_input"]
54 |
55 |
56 | class CompletionInputType(BaseModel):
57 | type: Literal["completion_input"]
58 |
59 |
60 | class AgentTurnInputType(BaseModel):
61 | type: Literal["agent_turn_input"]
62 |
63 |
64 | ParamType: TypeAlias = Annotated[
65 | Union[
66 | StringType,
67 | NumberType,
68 | BooleanType,
69 | ArrayType,
70 | ObjectType,
71 | JsonType,
72 | UnionType,
73 | ChatCompletionInputType,
74 | CompletionInputType,
75 | AgentTurnInputType,
76 | ],
77 | PropertyInfo(discriminator="type"),
78 | ]
79 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/query_config.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 |
5 | from ..._models import BaseModel
6 | from .query_generator_config import QueryGeneratorConfig
7 |
8 | __all__ = ["QueryConfig"]
9 |
10 |
11 | class QueryConfig(BaseModel):
12 | chunk_template: str
13 | """Template for formatting each retrieved chunk in the context.
14 |
15 | Available placeholders: {index} (1-based chunk ordinal), {chunk.content} (chunk
16 | content string), {metadata} (chunk metadata dict). Default: "Result
17 | {index}\nContent: {chunk.content}\nMetadata: {metadata}\n"
18 | """
19 |
20 | max_chunks: int
21 | """Maximum number of chunks to retrieve."""
22 |
23 | max_tokens_in_context: int
24 | """Maximum number of tokens in the context."""
25 |
26 | query_generator_config: QueryGeneratorConfig
27 | """Configuration for the query generator."""
28 |
29 | mode: Optional[str] = None
30 | """Search mode for retrieval—either "vector" or "keyword". Default "vector"."""
31 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/query_generator_config.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 |
9 | __all__ = ["QueryGeneratorConfig", "DefaultRagQueryGeneratorConfig", "LlmragQueryGeneratorConfig"]
10 |
11 |
12 | class DefaultRagQueryGeneratorConfig(BaseModel):
13 | separator: str
14 |
15 | type: Literal["default"]
16 |
17 |
18 | class LlmragQueryGeneratorConfig(BaseModel):
19 | model: str
20 |
21 | template: str
22 |
23 | type: Literal["llm"]
24 |
25 |
26 | QueryGeneratorConfig: TypeAlias = Annotated[
27 | Union[DefaultRagQueryGeneratorConfig, LlmragQueryGeneratorConfig], PropertyInfo(discriminator="type")
28 | ]
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/query_result.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 |
5 | from ..._models import BaseModel
6 | from .interleaved_content import InterleavedContent
7 |
8 | __all__ = ["QueryResult"]
9 |
10 |
11 | class QueryResult(BaseModel):
12 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
13 |
14 | content: Optional[InterleavedContent] = None
15 | """A image content item"""
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/response_format.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 |
9 | __all__ = ["ResponseFormat", "JsonSchemaResponseFormat", "GrammarResponseFormat"]
10 |
11 |
12 | class JsonSchemaResponseFormat(BaseModel):
13 | json_schema: Dict[str, Union[bool, float, str, List[object], object, None]]
14 | """The JSON schema the response should conform to.
15 |
16 | In a Python SDK, this is often a `pydantic` model.
17 | """
18 |
19 | type: Literal["json_schema"]
20 | """Must be "json_schema" to identify this format type"""
21 |
22 |
23 | class GrammarResponseFormat(BaseModel):
24 | bnf: Dict[str, Union[bool, float, str, List[object], object, None]]
25 | """The BNF grammar specification the response should conform to"""
26 |
27 | type: Literal["grammar"]
28 | """Must be "grammar" to identify this format type"""
29 |
30 |
31 | ResponseFormat: TypeAlias = Annotated[
32 | Union[JsonSchemaResponseFormat, GrammarResponseFormat], PropertyInfo(discriminator="type")
33 | ]
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/return_type.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing_extensions import Literal
4 |
5 | from ..._models import BaseModel
6 |
7 | __all__ = ["ReturnType"]
8 |
9 |
10 | class ReturnType(BaseModel):
11 | type: Literal[
12 | "string",
13 | "number",
14 | "boolean",
15 | "array",
16 | "object",
17 | "json",
18 | "union",
19 | "chat_completion_input",
20 | "completion_input",
21 | "agent_turn_input",
22 | ]
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/safety_violation.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from ..._models import BaseModel
7 |
8 | __all__ = ["SafetyViolation"]
9 |
10 |
11 | class SafetyViolation(BaseModel):
12 | metadata: Dict[str, Union[bool, float, str, List[object], object, None]]
13 |
14 | violation_level: Literal["info", "warn", "error"]
15 |
16 | user_message: Optional[str] = None
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/sampling_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Union, Optional
4 | from typing_extensions import Literal, Annotated, TypeAlias
5 |
6 | from ..._utils import PropertyInfo
7 | from ..._models import BaseModel
8 |
9 | __all__ = [
10 | "SamplingParams",
11 | "Strategy",
12 | "StrategyGreedySamplingStrategy",
13 | "StrategyTopPSamplingStrategy",
14 | "StrategyTopKSamplingStrategy",
15 | ]
16 |
17 |
18 | class StrategyGreedySamplingStrategy(BaseModel):
19 | type: Literal["greedy"]
20 |
21 |
22 | class StrategyTopPSamplingStrategy(BaseModel):
23 | type: Literal["top_p"]
24 |
25 | temperature: Optional[float] = None
26 |
27 | top_p: Optional[float] = None
28 |
29 |
30 | class StrategyTopKSamplingStrategy(BaseModel):
31 | top_k: int
32 |
33 | type: Literal["top_k"]
34 |
35 |
36 | Strategy: TypeAlias = Annotated[
37 | Union[StrategyGreedySamplingStrategy, StrategyTopPSamplingStrategy, StrategyTopKSamplingStrategy],
38 | PropertyInfo(discriminator="type"),
39 | ]
40 |
41 |
42 | class SamplingParams(BaseModel):
43 | strategy: Strategy
44 | """The sampling strategy."""
45 |
46 | max_tokens: Optional[int] = None
47 | """The maximum number of tokens that can be generated in the completion.
48 |
49 | The token count of your prompt plus max_tokens cannot exceed the model's context
50 | length.
51 | """
52 |
53 | repetition_penalty: Optional[float] = None
54 | """Number between -2.0 and 2.0.
55 |
56 | Positive values penalize new tokens based on whether they appear in the text so
57 | far, increasing the model's likelihood to talk about new topics.
58 | """
59 |
60 | stop: Optional[List[str]] = None
61 | """Up to 4 sequences where the API will stop generating further tokens.
62 |
63 | The returned text will not contain the stop sequence.
64 | """
65 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/scoring_result.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union
4 |
5 | from ..._models import BaseModel
6 |
7 | __all__ = ["ScoringResult"]
8 |
9 |
10 | class ScoringResult(BaseModel):
11 | aggregated_results: Dict[str, Union[bool, float, str, List[object], object, None]]
12 | """Map of metric name to aggregated value"""
13 |
14 | score_rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
15 | """The scoring result for each row. Each row is a map of column name to value."""
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/system_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing_extensions import Literal
4 |
5 | from ..._models import BaseModel
6 | from .interleaved_content import InterleavedContent
7 |
8 | __all__ = ["SystemMessage"]
9 |
10 |
11 | class SystemMessage(BaseModel):
12 | content: InterleavedContent
13 | """The content of the "system prompt".
14 |
15 | If multiple system messages are provided, they are concatenated. The underlying
16 | Llama Stack code may also add other system messages (for example, for formatting
17 | tool definitions).
18 | """
19 |
20 | role: Literal["system"]
21 | """Must be "system" to identify this as a system message"""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/tool_call.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from ..._models import BaseModel
7 |
8 | __all__ = ["ToolCall"]
9 |
10 |
11 | class ToolCall(BaseModel):
12 | arguments: Union[
13 | str,
14 | Dict[
15 | str,
16 | Union[
17 | str, float, bool, List[Union[str, float, bool, None]], Dict[str, Union[str, float, bool, None]], None
18 | ],
19 | ],
20 | ]
21 |
22 | call_id: str
23 |
24 | tool_name: Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]
25 |
26 | arguments_json: Optional[str] = None
27 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/tool_call_or_string.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Union
4 | from typing_extensions import TypeAlias
5 |
6 | from .tool_call import ToolCall
7 |
8 | __all__ = ["ToolCallOrString"]
9 |
10 | ToolCallOrString: TypeAlias = Union[str, ToolCall]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/tool_param_definition.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Union, Optional
4 |
5 | from ..._models import BaseModel
6 |
7 | __all__ = ["ToolParamDefinition"]
8 |
9 |
10 | class ToolParamDefinition(BaseModel):
11 | param_type: str
12 |
13 | default: Union[bool, float, str, List[object], object, None] = None
14 |
15 | description: Optional[str] = None
16 |
17 | required: Optional[bool] = None
18 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/tool_response_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing_extensions import Literal
4 |
5 | from ..._models import BaseModel
6 | from .interleaved_content import InterleavedContent
7 |
8 | __all__ = ["ToolResponseMessage"]
9 |
10 |
11 | class ToolResponseMessage(BaseModel):
12 | call_id: str
13 | """Unique identifier for the tool call this response is for"""
14 |
15 | content: InterleavedContent
16 | """The response content from the tool"""
17 |
18 | role: Literal["tool"]
19 | """Must be "tool" to identify this as a tool response"""
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared/user_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from typing_extensions import Literal
5 |
6 | from ..._models import BaseModel
7 | from .interleaved_content import InterleavedContent
8 |
9 | __all__ = ["UserMessage"]
10 |
11 |
12 | class UserMessage(BaseModel):
13 | content: InterleavedContent
14 | """The content of the message, which can include text and other media"""
15 |
16 | role: Literal["user"]
17 | """Must be "user" to identify this as a user message"""
18 |
19 | context: Optional[InterleavedContent] = None
20 | """(Optional) This field is used internally by Llama Stack to pass RAG context.
21 |
22 | This field may be removed in the API in the future.
23 | """
24 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .message import Message as Message
4 | from .document import Document as Document
5 | from .tool_call import ToolCall as ToolCall
6 | from .return_type import ReturnType as ReturnType
7 | from .agent_config import AgentConfig as AgentConfig
8 | from .query_config import QueryConfig as QueryConfig
9 | from .user_message import UserMessage as UserMessage
10 | from .system_message import SystemMessage as SystemMessage
11 | from .response_format import ResponseFormat as ResponseFormat
12 | from .sampling_params import SamplingParams as SamplingParams
13 | from .completion_message import CompletionMessage as CompletionMessage
14 | from .interleaved_content import InterleavedContent as InterleavedContent
15 | from .tool_param_definition import ToolParamDefinition as ToolParamDefinition
16 | from .tool_response_message import ToolResponseMessage as ToolResponseMessage
17 | from .query_generator_config import QueryGeneratorConfig as QueryGeneratorConfig
18 | from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem
19 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/completion_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from .tool_call import ToolCall
9 | from .interleaved_content import InterleavedContent
10 |
11 | __all__ = ["CompletionMessage"]
12 |
13 |
14 | class CompletionMessage(TypedDict, total=False):
15 | content: Required[InterleavedContent]
16 | """The content of the model's response"""
17 |
18 | role: Required[Literal["assistant"]]
19 | """Must be "assistant" to identify this as the model's response"""
20 |
21 | stop_reason: Required[Literal["end_of_turn", "end_of_message", "out_of_tokens"]]
22 | """Reason why the model stopped generating.
23 |
24 | Options are: - `StopReason.end_of_turn`: The model finished generating the
25 | entire response. - `StopReason.end_of_message`: The model finished generating
26 | but generated a partial response -- usually, a tool call. The user may call the
27 | tool and continue the conversation with the tool's response. -
28 | `StopReason.out_of_tokens`: The model ran out of token budget.
29 | """
30 |
31 | tool_calls: Iterable[ToolCall]
32 | """List of tool calls. Each tool call is a ToolCall object."""
33 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/interleaved_content.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union, Iterable
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | from .interleaved_content_item import InterleavedContentItem
9 |
10 | __all__ = [
11 | "InterleavedContent",
12 | "ImageContentItem",
13 | "ImageContentItemImage",
14 | "ImageContentItemImageURL",
15 | "TextContentItem",
16 | ]
17 |
18 |
19 | class ImageContentItemImageURL(TypedDict, total=False):
20 | uri: Required[str]
21 |
22 |
23 | class ImageContentItemImage(TypedDict, total=False):
24 | data: str
25 | """base64 encoded image data as string"""
26 |
27 | url: ImageContentItemImageURL
28 | """A URL of the image or data URL in the format of data:image/{type};base64,{data}.
29 |
30 | Note that URL could have length limits.
31 | """
32 |
33 |
34 | class ImageContentItem(TypedDict, total=False):
35 | image: Required[ImageContentItemImage]
36 | """Image as a base64 encoded string or an URL"""
37 |
38 | type: Required[Literal["image"]]
39 | """Discriminator type of the content item. Always "image" """
40 |
41 |
42 | class TextContentItem(TypedDict, total=False):
43 | text: Required[str]
44 | """Text content"""
45 |
46 | type: Required[Literal["text"]]
47 | """Discriminator type of the content item. Always "text" """
48 |
49 |
50 | InterleavedContent: TypeAlias = Union[str, ImageContentItem, TextContentItem, Iterable[InterleavedContentItem]]
51 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/interleaved_content_item.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = [
9 | "InterleavedContentItem",
10 | "ImageContentItem",
11 | "ImageContentItemImage",
12 | "ImageContentItemImageURL",
13 | "TextContentItem",
14 | ]
15 |
16 |
17 | class ImageContentItemImageURL(TypedDict, total=False):
18 | uri: Required[str]
19 |
20 |
21 | class ImageContentItemImage(TypedDict, total=False):
22 | data: str
23 | """base64 encoded image data as string"""
24 |
25 | url: ImageContentItemImageURL
26 | """A URL of the image or data URL in the format of data:image/{type};base64,{data}.
27 |
28 | Note that URL could have length limits.
29 | """
30 |
31 |
32 | class ImageContentItem(TypedDict, total=False):
33 | image: Required[ImageContentItemImage]
34 | """Image as a base64 encoded string or an URL"""
35 |
36 | type: Required[Literal["image"]]
37 | """Discriminator type of the content item. Always "image" """
38 |
39 |
40 | class TextContentItem(TypedDict, total=False):
41 | text: Required[str]
42 | """Text content"""
43 |
44 | type: Required[Literal["text"]]
45 | """Discriminator type of the content item. Always "text" """
46 |
47 |
48 | InterleavedContentItem: TypeAlias = Union[ImageContentItem, TextContentItem]
49 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union
6 | from typing_extensions import TypeAlias
7 |
8 | from .user_message import UserMessage
9 | from .system_message import SystemMessage
10 | from .completion_message import CompletionMessage
11 | from .tool_response_message import ToolResponseMessage
12 |
13 | __all__ = ["Message"]
14 |
15 | Message: TypeAlias = Union[UserMessage, SystemMessage, ToolResponseMessage, CompletionMessage]
16 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/query_config.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .query_generator_config import QueryGeneratorConfig
8 |
9 | __all__ = ["QueryConfig"]
10 |
11 |
12 | class QueryConfig(TypedDict, total=False):
13 | chunk_template: Required[str]
14 | """Template for formatting each retrieved chunk in the context.
15 |
16 | Available placeholders: {index} (1-based chunk ordinal), {chunk.content} (chunk
17 | content string), {metadata} (chunk metadata dict). Default: "Result
18 | {index}\nContent: {chunk.content}\nMetadata: {metadata}\n"
19 | """
20 |
21 | max_chunks: Required[int]
22 | """Maximum number of chunks to retrieve."""
23 |
24 | max_tokens_in_context: Required[int]
25 | """Maximum number of tokens in the context."""
26 |
27 | query_generator_config: Required[QueryGeneratorConfig]
28 | """Configuration for the query generator."""
29 |
30 | mode: str
31 | """Search mode for retrieval—either "vector" or "keyword". Default "vector"."""
32 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/query_generator_config.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = ["QueryGeneratorConfig", "DefaultRagQueryGeneratorConfig", "LlmragQueryGeneratorConfig"]
9 |
10 |
11 | class DefaultRagQueryGeneratorConfig(TypedDict, total=False):
12 | separator: Required[str]
13 |
14 | type: Required[Literal["default"]]
15 |
16 |
17 | class LlmragQueryGeneratorConfig(TypedDict, total=False):
18 | model: Required[str]
19 |
20 | template: Required[str]
21 |
22 | type: Required[Literal["llm"]]
23 |
24 |
25 | QueryGeneratorConfig: TypeAlias = Union[DefaultRagQueryGeneratorConfig, LlmragQueryGeneratorConfig]
26 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/response_format.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = ["ResponseFormat", "JsonSchemaResponseFormat", "GrammarResponseFormat"]
9 |
10 |
11 | class JsonSchemaResponseFormat(TypedDict, total=False):
12 | json_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]
13 | """The JSON schema the response should conform to.
14 |
15 | In a Python SDK, this is often a `pydantic` model.
16 | """
17 |
18 | type: Required[Literal["json_schema"]]
19 | """Must be "json_schema" to identify this format type"""
20 |
21 |
22 | class GrammarResponseFormat(TypedDict, total=False):
23 | bnf: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]
24 | """The BNF grammar specification the response should conform to"""
25 |
26 | type: Required[Literal["grammar"]]
27 | """Must be "grammar" to identify this format type"""
28 |
29 |
30 | ResponseFormat: TypeAlias = Union[JsonSchemaResponseFormat, GrammarResponseFormat]
31 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/return_type.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Literal, Required, TypedDict
6 |
7 | __all__ = ["ReturnType"]
8 |
9 |
10 | class ReturnType(TypedDict, total=False):
11 | type: Required[
12 | Literal[
13 | "string",
14 | "number",
15 | "boolean",
16 | "array",
17 | "object",
18 | "json",
19 | "union",
20 | "chat_completion_input",
21 | "completion_input",
22 | "agent_turn_input",
23 | ]
24 | ]
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/sampling_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Union
6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict
7 |
8 | __all__ = [
9 | "SamplingParams",
10 | "Strategy",
11 | "StrategyGreedySamplingStrategy",
12 | "StrategyTopPSamplingStrategy",
13 | "StrategyTopKSamplingStrategy",
14 | ]
15 |
16 |
17 | class StrategyGreedySamplingStrategy(TypedDict, total=False):
18 | type: Required[Literal["greedy"]]
19 |
20 |
21 | class StrategyTopPSamplingStrategy(TypedDict, total=False):
22 | type: Required[Literal["top_p"]]
23 |
24 | temperature: float
25 |
26 | top_p: float
27 |
28 |
29 | class StrategyTopKSamplingStrategy(TypedDict, total=False):
30 | top_k: Required[int]
31 |
32 | type: Required[Literal["top_k"]]
33 |
34 |
35 | Strategy: TypeAlias = Union[StrategyGreedySamplingStrategy, StrategyTopPSamplingStrategy, StrategyTopKSamplingStrategy]
36 |
37 |
38 | class SamplingParams(TypedDict, total=False):
39 | strategy: Required[Strategy]
40 | """The sampling strategy."""
41 |
42 | max_tokens: int
43 | """The maximum number of tokens that can be generated in the completion.
44 |
45 | The token count of your prompt plus max_tokens cannot exceed the model's context
46 | length.
47 | """
48 |
49 | repetition_penalty: float
50 | """Number between -2.0 and 2.0.
51 |
52 | Positive values penalize new tokens based on whether they appear in the text so
53 | far, increasing the model's likelihood to talk about new topics.
54 | """
55 |
56 | stop: List[str]
57 | """Up to 4 sequences where the API will stop generating further tokens.
58 |
59 | The returned text will not contain the stop sequence.
60 | """
61 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/system_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Literal, Required, TypedDict
6 |
7 | from .interleaved_content import InterleavedContent
8 |
9 | __all__ = ["SystemMessage"]
10 |
11 |
12 | class SystemMessage(TypedDict, total=False):
13 | content: Required[InterleavedContent]
14 | """The content of the "system prompt".
15 |
16 | If multiple system messages are provided, they are concatenated. The underlying
17 | Llama Stack code may also add other system messages (for example, for formatting
18 | tool definitions).
19 | """
20 |
21 | role: Required[Literal["system"]]
22 | """Must be "system" to identify this as a system message"""
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/tool_call.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, List, Union
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | __all__ = ["ToolCall"]
9 |
10 |
11 | class ToolCall(TypedDict, total=False):
12 | arguments: Required[
13 | Union[
14 | str,
15 | Dict[
16 | str,
17 | Union[
18 | str,
19 | float,
20 | bool,
21 | List[Union[str, float, bool, None]],
22 | Dict[str, Union[str, float, bool, None]],
23 | None,
24 | ],
25 | ],
26 | ]
27 | ]
28 |
29 | call_id: Required[str]
30 |
31 | tool_name: Required[Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]]
32 |
33 | arguments_json: str
34 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/tool_param_definition.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["ToolParamDefinition"]
9 |
10 |
11 | class ToolParamDefinition(TypedDict, total=False):
12 | param_type: Required[str]
13 |
14 | default: Union[bool, float, str, Iterable[object], object, None]
15 |
16 | description: str
17 |
18 | required: bool
19 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/tool_response_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Literal, Required, TypedDict
6 |
7 | from .interleaved_content import InterleavedContent
8 |
9 | __all__ = ["ToolResponseMessage"]
10 |
11 |
12 | class ToolResponseMessage(TypedDict, total=False):
13 | call_id: Required[str]
14 | """Unique identifier for the tool call this response is for"""
15 |
16 | content: Required[InterleavedContent]
17 | """The response content from the tool"""
18 |
19 | role: Required[Literal["tool"]]
20 | """Must be "tool" to identify this as a tool response"""
21 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shared_params/user_message.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Literal, Required, TypedDict
6 |
7 | from .interleaved_content import InterleavedContent
8 |
9 | __all__ = ["UserMessage"]
10 |
11 |
12 | class UserMessage(TypedDict, total=False):
13 | content: Required[InterleavedContent]
14 | """The content of the message, which can include text and other media"""
15 |
16 | role: Required[Literal["user"]]
17 | """Must be "user" to identify this as a user message"""
18 |
19 | context: InterleavedContent
20 | """(Optional) This field is used internally by Llama Stack to pass RAG context.
21 |
22 | This field may be removed in the API in the future.
23 | """
24 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shield.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["Shield"]
9 |
10 |
11 | class Shield(BaseModel):
12 | identifier: str
13 |
14 | provider_id: str
15 |
16 | type: Literal["shield"]
17 |
18 | params: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
19 |
20 | provider_resource_id: Optional[str] = None
21 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shield_call_step.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from .._models import BaseModel
8 | from .shared.safety_violation import SafetyViolation
9 |
10 | __all__ = ["ShieldCallStep"]
11 |
12 |
13 | class ShieldCallStep(BaseModel):
14 | step_id: str
15 | """The ID of the step."""
16 |
17 | step_type: Literal["shield_call"]
18 | """Type of the step in an agent turn."""
19 |
20 | turn_id: str
21 | """The ID of the turn."""
22 |
23 | completed_at: Optional[datetime] = None
24 | """The time the step completed."""
25 |
26 | started_at: Optional[datetime] = None
27 | """The time the step started."""
28 |
29 | violation: Optional[SafetyViolation] = None
30 | """The violation from the shield call."""
31 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shield_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .shield import Shield
7 |
8 | __all__ = ["ShieldListResponse"]
9 |
10 | ShieldListResponse: TypeAlias = List[Shield]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/shield_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["ShieldRegisterParams"]
9 |
10 |
11 | class ShieldRegisterParams(TypedDict, total=False):
12 | shield_id: Required[str]
13 | """The identifier of the shield to register."""
14 |
15 | params: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
16 | """The parameters of the shield."""
17 |
18 | provider_id: str
19 | """The identifier of the provider."""
20 |
21 | provider_shield_id: str
22 | """The identifier of the shield in the provider."""
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/span_with_status.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from .._models import BaseModel
8 |
9 | __all__ = ["SpanWithStatus"]
10 |
11 |
12 | class SpanWithStatus(BaseModel):
13 | name: str
14 |
15 | span_id: str
16 |
17 | start_time: datetime
18 |
19 | trace_id: str
20 |
21 | attributes: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
22 |
23 | end_time: Optional[datetime] = None
24 |
25 | parent_span_id: Optional[str] = None
26 |
27 | status: Optional[Literal["ok", "error"]] = None
28 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/synthetic_data_generation_generate_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from .shared_params.message import Message
9 |
10 | __all__ = ["SyntheticDataGenerationGenerateParams"]
11 |
12 |
13 | class SyntheticDataGenerationGenerateParams(TypedDict, total=False):
14 | dialogs: Required[Iterable[Message]]
15 |
16 | filtering_function: Required[Literal["none", "random", "top_k", "top_p", "top_k_top_p", "sigmoid"]]
17 | """The type of filtering function."""
18 |
19 | model: str
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/synthetic_data_generation_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["SyntheticDataGenerationResponse"]
8 |
9 |
10 | class SyntheticDataGenerationResponse(BaseModel):
11 | synthetic_data: List[Dict[str, Union[bool, float, str, List[object], object, None]]]
12 |
13 | statistics: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
14 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_get_span_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from datetime import datetime
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["TelemetryGetSpanResponse"]
9 |
10 |
11 | class TelemetryGetSpanResponse(BaseModel):
12 | name: str
13 |
14 | span_id: str
15 |
16 | start_time: datetime
17 |
18 | trace_id: str
19 |
20 | attributes: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
21 |
22 | end_time: Optional[datetime] = None
23 |
24 | parent_span_id: Optional[str] = None
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_get_span_tree_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List
6 | from typing_extensions import TypedDict
7 |
8 | __all__ = ["TelemetryGetSpanTreeParams"]
9 |
10 |
11 | class TelemetryGetSpanTreeParams(TypedDict, total=False):
12 | attributes_to_return: List[str]
13 | """The attributes to return in the tree."""
14 |
15 | max_depth: int
16 | """The maximum depth of the tree."""
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_get_span_tree_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict
4 | from typing_extensions import TypeAlias
5 |
6 | from .span_with_status import SpanWithStatus
7 |
8 | __all__ = ["TelemetryGetSpanTreeResponse"]
9 |
10 | TelemetryGetSpanTreeResponse: TypeAlias = Dict[str, SpanWithStatus]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_log_event_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | from .event_param import EventParam
8 |
9 | __all__ = ["TelemetryLogEventParams"]
10 |
11 |
12 | class TelemetryLogEventParams(TypedDict, total=False):
13 | event: Required[EventParam]
14 | """The event to log."""
15 |
16 | ttl_seconds: Required[int]
17 | """The time to live of the event."""
18 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_query_spans_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .query_condition_param import QueryConditionParam
9 |
10 | __all__ = ["TelemetryQuerySpansParams"]
11 |
12 |
13 | class TelemetryQuerySpansParams(TypedDict, total=False):
14 | attribute_filters: Required[Iterable[QueryConditionParam]]
15 | """The attribute filters to apply to the spans."""
16 |
17 | attributes_to_return: Required[List[str]]
18 | """The attributes to return in the spans."""
19 |
20 | max_depth: int
21 | """The maximum depth of the tree."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_query_spans_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from datetime import datetime
5 | from typing_extensions import TypeAlias
6 |
7 | from .._models import BaseModel
8 |
9 | __all__ = ["TelemetryQuerySpansResponse", "TelemetryQuerySpansResponseItem"]
10 |
11 |
12 | class TelemetryQuerySpansResponseItem(BaseModel):
13 | name: str
14 |
15 | span_id: str
16 |
17 | start_time: datetime
18 |
19 | trace_id: str
20 |
21 | attributes: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
22 |
23 | end_time: Optional[datetime] = None
24 |
25 | parent_span_id: Optional[str] = None
26 |
27 |
28 | TelemetryQuerySpansResponse: TypeAlias = List[TelemetryQuerySpansResponseItem]
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_query_traces_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Iterable
6 | from typing_extensions import TypedDict
7 |
8 | from .query_condition_param import QueryConditionParam
9 |
10 | __all__ = ["TelemetryQueryTracesParams"]
11 |
12 |
13 | class TelemetryQueryTracesParams(TypedDict, total=False):
14 | attribute_filters: Iterable[QueryConditionParam]
15 | """The attribute filters to apply to the traces."""
16 |
17 | limit: int
18 | """The limit of traces to return."""
19 |
20 | offset: int
21 | """The offset of the traces to return."""
22 |
23 | order_by: List[str]
24 | """The order by of the traces to return."""
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_query_traces_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .trace import Trace
7 |
8 | __all__ = ["TelemetryQueryTracesResponse"]
9 |
10 | TelemetryQueryTracesResponse: TypeAlias = List[Trace]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/telemetry_save_spans_to_dataset_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .query_condition_param import QueryConditionParam
9 |
10 | __all__ = ["TelemetrySaveSpansToDatasetParams"]
11 |
12 |
13 | class TelemetrySaveSpansToDatasetParams(TypedDict, total=False):
14 | attribute_filters: Required[Iterable[QueryConditionParam]]
15 | """The attribute filters to apply to the spans."""
16 |
17 | attributes_to_save: Required[List[str]]
18 | """The attributes to save to the dataset."""
19 |
20 | dataset_id: Required[str]
21 | """The ID of the dataset to save the spans to."""
22 |
23 | max_depth: int
24 | """The maximum depth of the tree."""
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/token_log_probs.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["TokenLogProbs"]
8 |
9 |
10 | class TokenLogProbs(BaseModel):
11 | logprobs_by_token: Dict[str, float]
12 | """Dictionary mapping tokens to their log probabilities"""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["Tool", "Parameter"]
9 |
10 |
11 | class Parameter(BaseModel):
12 | description: str
13 |
14 | name: str
15 |
16 | parameter_type: str
17 |
18 | required: bool
19 |
20 | default: Union[bool, float, str, List[object], object, None] = None
21 |
22 |
23 | class Tool(BaseModel):
24 | description: str
25 |
26 | identifier: str
27 |
28 | parameters: List[Parameter]
29 |
30 | provider_id: str
31 |
32 | tool_host: Literal["distribution", "client", "model_context_protocol"]
33 |
34 | toolgroup_id: str
35 |
36 | type: Literal["tool"]
37 |
38 | metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
39 |
40 | provider_resource_id: Optional[str] = None
41 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_def.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 |
5 | from .._models import BaseModel
6 |
7 | __all__ = ["ToolDef", "Parameter"]
8 |
9 |
10 | class Parameter(BaseModel):
11 | description: str
12 |
13 | name: str
14 |
15 | parameter_type: str
16 |
17 | required: bool
18 |
19 | default: Union[bool, float, str, List[object], object, None] = None
20 |
21 |
22 | class ToolDef(BaseModel):
23 | name: str
24 |
25 | description: Optional[str] = None
26 |
27 | metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
28 |
29 | parameters: Optional[List[Parameter]] = None
30 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_def_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["ToolDefParam", "Parameter"]
9 |
10 |
11 | class Parameter(TypedDict, total=False):
12 | description: Required[str]
13 |
14 | name: Required[str]
15 |
16 | parameter_type: Required[str]
17 |
18 | required: Required[bool]
19 |
20 | default: Union[bool, float, str, Iterable[object], object, None]
21 |
22 |
23 | class ToolDefParam(TypedDict, total=False):
24 | name: Required[str]
25 |
26 | description: str
27 |
28 | metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
29 |
30 | parameters: Iterable[Parameter]
31 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_execution_step.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from datetime import datetime
5 | from typing_extensions import Literal
6 |
7 | from .._models import BaseModel
8 | from .tool_response import ToolResponse
9 | from .shared.tool_call import ToolCall
10 |
11 | __all__ = ["ToolExecutionStep"]
12 |
13 |
14 | class ToolExecutionStep(BaseModel):
15 | step_id: str
16 | """The ID of the step."""
17 |
18 | step_type: Literal["tool_execution"]
19 | """Type of the step in an agent turn."""
20 |
21 | tool_calls: List[ToolCall]
22 | """The tool calls to execute."""
23 |
24 | tool_responses: List[ToolResponse]
25 | """The tool responses from the tool calls."""
26 |
27 | turn_id: str
28 | """The ID of the turn."""
29 |
30 | completed_at: Optional[datetime] = None
31 | """The time the step completed."""
32 |
33 | started_at: Optional[datetime] = None
34 | """The time the step started."""
35 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_group.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["ToolGroup", "McpEndpoint"]
9 |
10 |
11 | class McpEndpoint(BaseModel):
12 | uri: str
13 |
14 |
15 | class ToolGroup(BaseModel):
16 | identifier: str
17 |
18 | provider_id: str
19 |
20 | type: Literal["tool_group"]
21 |
22 | args: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
23 |
24 | mcp_endpoint: Optional[McpEndpoint] = None
25 |
26 | provider_resource_id: Optional[str] = None
27 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_invocation_result.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 |
5 | from .._models import BaseModel
6 | from .shared.interleaved_content import InterleavedContent
7 |
8 | __all__ = ["ToolInvocationResult"]
9 |
10 |
11 | class ToolInvocationResult(BaseModel):
12 | content: Optional[InterleavedContent] = None
13 | """A image content item"""
14 |
15 | error_code: Optional[int] = None
16 |
17 | error_message: Optional[str] = None
18 |
19 | metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_list_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import TypedDict
6 |
7 | __all__ = ["ToolListParams"]
8 |
9 |
10 | class ToolListParams(TypedDict, total=False):
11 | toolgroup_id: str
12 | """The ID of the tool group to list tools for."""
13 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .tool import Tool
7 |
8 | __all__ = ["ToolListResponse"]
9 |
10 | ToolListResponse: TypeAlias = List[Tool]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Dict, List, Union, Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 | from .shared.interleaved_content import InterleavedContent
8 |
9 | __all__ = ["ToolResponse"]
10 |
11 |
12 | class ToolResponse(BaseModel):
13 | call_id: str
14 |
15 | content: InterleavedContent
16 | """A image content item"""
17 |
18 | tool_name: Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]
19 |
20 | metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
21 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_response_param.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Literal, Required, TypedDict
7 |
8 | from .shared_params.interleaved_content import InterleavedContent
9 |
10 | __all__ = ["ToolResponseParam"]
11 |
12 |
13 | class ToolResponseParam(TypedDict, total=False):
14 | call_id: Required[str]
15 |
16 | content: Required[InterleavedContent]
17 | """A image content item"""
18 |
19 | tool_name: Required[Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]]
20 |
21 | metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from .rag_tool_query_params import RagToolQueryParams as RagToolQueryParams
6 | from .rag_tool_insert_params import RagToolInsertParams as RagToolInsertParams
7 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime/rag_tool_insert_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from ..shared_params.document import Document
9 |
10 | __all__ = ["RagToolInsertParams"]
11 |
12 |
13 | class RagToolInsertParams(TypedDict, total=False):
14 | chunk_size_in_tokens: Required[int]
15 |
16 | documents: Required[Iterable[Document]]
17 |
18 | vector_db_id: Required[str]
19 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime/rag_tool_query_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import List
6 | from typing_extensions import Required, TypedDict
7 |
8 | from ..shared_params.query_config import QueryConfig
9 | from ..shared_params.interleaved_content import InterleavedContent
10 |
11 | __all__ = ["RagToolQueryParams"]
12 |
13 |
14 | class RagToolQueryParams(TypedDict, total=False):
15 | content: Required[InterleavedContent]
16 | """A image content item"""
17 |
18 | vector_db_ids: Required[List[str]]
19 |
20 | query_config: QueryConfig
21 | """Configuration for the RAG query generation."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime_invoke_tool_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["ToolRuntimeInvokeToolParams"]
9 |
10 |
11 | class ToolRuntimeInvokeToolParams(TypedDict, total=False):
12 | kwargs: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]
13 | """A dictionary of arguments to pass to the tool."""
14 |
15 | tool_name: Required[str]
16 | """The name of the tool to invoke."""
17 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime_list_tools_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["ToolRuntimeListToolsParams", "McpEndpoint"]
8 |
9 |
10 | class ToolRuntimeListToolsParams(TypedDict, total=False):
11 | mcp_endpoint: McpEndpoint
12 | """The MCP endpoint to use for the tool group."""
13 |
14 | tool_group_id: str
15 | """The ID of the tool group to list tools for."""
16 |
17 |
18 | class McpEndpoint(TypedDict, total=False):
19 | uri: Required[str]
20 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/tool_runtime_list_tools_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .tool_def import ToolDef
7 |
8 | __all__ = ["ToolRuntimeListToolsResponse"]
9 |
10 | ToolRuntimeListToolsResponse: TypeAlias = List[ToolDef]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/toolgroup_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List
4 | from typing_extensions import TypeAlias
5 |
6 | from .tool_group import ToolGroup
7 |
8 | __all__ = ["ToolgroupListResponse"]
9 |
10 | ToolgroupListResponse: TypeAlias = List[ToolGroup]
11 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/toolgroup_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | __all__ = ["ToolgroupRegisterParams", "McpEndpoint"]
9 |
10 |
11 | class ToolgroupRegisterParams(TypedDict, total=False):
12 | provider_id: Required[str]
13 | """The ID of the provider to use for the tool group."""
14 |
15 | toolgroup_id: Required[str]
16 | """The ID of the tool group to register."""
17 |
18 | args: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
19 | """A dictionary of arguments to pass to the tool group."""
20 |
21 | mcp_endpoint: McpEndpoint
22 | """The MCP endpoint to use for the tool group."""
23 |
24 |
25 | class McpEndpoint(TypedDict, total=False):
26 | uri: Required[str]
27 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/trace.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from datetime import datetime
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["Trace"]
9 |
10 |
11 | class Trace(BaseModel):
12 | root_span_id: str
13 |
14 | start_time: datetime
15 |
16 | trace_id: str
17 |
18 | end_time: Optional[datetime] = None
19 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_db_list_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import List, Optional
4 | from typing_extensions import Literal, TypeAlias
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["VectorDBListResponse", "VectorDBListResponseItem"]
9 |
10 |
11 | class VectorDBListResponseItem(BaseModel):
12 | embedding_dimension: int
13 |
14 | embedding_model: str
15 |
16 | identifier: str
17 |
18 | provider_id: str
19 |
20 | type: Literal["vector_db"]
21 |
22 | provider_resource_id: Optional[str] = None
23 |
24 |
25 | VectorDBListResponse: TypeAlias = List[VectorDBListResponseItem]
26 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_db_register_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing_extensions import Required, TypedDict
6 |
7 | __all__ = ["VectorDBRegisterParams"]
8 |
9 |
10 | class VectorDBRegisterParams(TypedDict, total=False):
11 | embedding_model: Required[str]
12 | """The embedding model to use."""
13 |
14 | vector_db_id: Required[str]
15 | """The identifier of the vector database to register."""
16 |
17 | embedding_dimension: int
18 | """The dimension of the embedding model."""
19 |
20 | provider_id: str
21 | """The identifier of the provider."""
22 |
23 | provider_vector_db_id: str
24 | """The identifier of the vector database in the provider."""
25 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_db_register_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["VectorDBRegisterResponse"]
9 |
10 |
11 | class VectorDBRegisterResponse(BaseModel):
12 | embedding_dimension: int
13 |
14 | embedding_model: str
15 |
16 | identifier: str
17 |
18 | provider_id: str
19 |
20 | type: Literal["vector_db"]
21 |
22 | provider_resource_id: Optional[str] = None
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_db_retrieve_response.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from typing import Optional
4 | from typing_extensions import Literal
5 |
6 | from .._models import BaseModel
7 |
8 | __all__ = ["VectorDBRetrieveResponse"]
9 |
10 |
11 | class VectorDBRetrieveResponse(BaseModel):
12 | embedding_dimension: int
13 |
14 | embedding_model: str
15 |
16 | identifier: str
17 |
18 | provider_id: str
19 |
20 | type: Literal["vector_db"]
21 |
22 | provider_resource_id: Optional[str] = None
23 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_io_insert_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .shared_params.interleaved_content import InterleavedContent
9 |
10 | __all__ = ["VectorIoInsertParams", "Chunk"]
11 |
12 |
13 | class VectorIoInsertParams(TypedDict, total=False):
14 | chunks: Required[Iterable[Chunk]]
15 | """The chunks to insert."""
16 |
17 | vector_db_id: Required[str]
18 | """The identifier of the vector database to insert the chunks into."""
19 |
20 | ttl_seconds: int
21 | """The time to live of the chunks."""
22 |
23 |
24 | class Chunk(TypedDict, total=False):
25 | content: Required[InterleavedContent]
26 | """A image content item"""
27 |
28 | metadata: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]
29 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/vector_io_query_params.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from __future__ import annotations
4 |
5 | from typing import Dict, Union, Iterable
6 | from typing_extensions import Required, TypedDict
7 |
8 | from .shared_params.interleaved_content import InterleavedContent
9 |
10 | __all__ = ["VectorIoQueryParams"]
11 |
12 |
13 | class VectorIoQueryParams(TypedDict, total=False):
14 | query: Required[InterleavedContent]
15 | """The query to search for."""
16 |
17 | vector_db_id: Required[str]
18 | """The identifier of the vector database to query."""
19 |
20 | params: Dict[str, Union[bool, float, str, Iterable[object], object, None]]
21 | """The parameters of the query."""
22 |
--------------------------------------------------------------------------------
/src/llama_stack_client/types/version_info.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
3 | from .._models import BaseModel
4 |
5 | __all__ = ["VersionInfo"]
6 |
7 |
8 | class VersionInfo(BaseModel):
9 | version: str
10 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/agents/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/chat/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/eval/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/post_training/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/api_resources/tool_runtime/__init__.py:
--------------------------------------------------------------------------------
1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2 |
--------------------------------------------------------------------------------
/tests/conftest.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import os
4 | import logging
5 | from typing import TYPE_CHECKING, Iterator, AsyncIterator
6 |
7 | import pytest
8 | from pytest_asyncio import is_async_test
9 |
10 | from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient
11 |
12 | if TYPE_CHECKING:
13 | from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage]
14 |
15 | pytest.register_assert_rewrite("tests.utils")
16 |
17 | logging.getLogger("llama_stack_client").setLevel(logging.DEBUG)
18 |
19 |
20 | # automatically add `pytest.mark.asyncio()` to all of our async tests
21 | # so we don't have to add that boilerplate everywhere
22 | def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
23 | pytest_asyncio_tests = (item for item in items if is_async_test(item))
24 | session_scope_marker = pytest.mark.asyncio(loop_scope="session")
25 | for async_test in pytest_asyncio_tests:
26 | async_test.add_marker(session_scope_marker, append=False)
27 |
28 |
29 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
30 |
31 |
32 | @pytest.fixture(scope="session")
33 | def client(request: FixtureRequest) -> Iterator[LlamaStackClient]:
34 | strict = getattr(request, "param", True)
35 | if not isinstance(strict, bool):
36 | raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
37 |
38 | with LlamaStackClient(base_url=base_url, _strict_response_validation=strict) as client:
39 | yield client
40 |
41 |
42 | @pytest.fixture(scope="session")
43 | async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncLlamaStackClient]:
44 | strict = getattr(request, "param", True)
45 | if not isinstance(strict, bool):
46 | raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
47 |
48 | async with AsyncLlamaStackClient(base_url=base_url, _strict_response_validation=strict) as client:
49 | yield client
50 |
--------------------------------------------------------------------------------
/tests/sample_file.txt:
--------------------------------------------------------------------------------
1 | Hello, world!
2 |
--------------------------------------------------------------------------------
/tests/test_deepcopy.py:
--------------------------------------------------------------------------------
1 | from llama_stack_client._utils import deepcopy_minimal
2 |
3 |
4 | def assert_different_identities(obj1: object, obj2: object) -> None:
5 | assert obj1 == obj2
6 | assert id(obj1) != id(obj2)
7 |
8 |
9 | def test_simple_dict() -> None:
10 | obj1 = {"foo": "bar"}
11 | obj2 = deepcopy_minimal(obj1)
12 | assert_different_identities(obj1, obj2)
13 |
14 |
15 | def test_nested_dict() -> None:
16 | obj1 = {"foo": {"bar": True}}
17 | obj2 = deepcopy_minimal(obj1)
18 | assert_different_identities(obj1, obj2)
19 | assert_different_identities(obj1["foo"], obj2["foo"])
20 |
21 |
22 | def test_complex_nested_dict() -> None:
23 | obj1 = {"foo": {"bar": [{"hello": "world"}]}}
24 | obj2 = deepcopy_minimal(obj1)
25 | assert_different_identities(obj1, obj2)
26 | assert_different_identities(obj1["foo"], obj2["foo"])
27 | assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"])
28 | assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0])
29 |
30 |
31 | def test_simple_list() -> None:
32 | obj1 = ["a", "b", "c"]
33 | obj2 = deepcopy_minimal(obj1)
34 | assert_different_identities(obj1, obj2)
35 |
36 |
37 | def test_nested_list() -> None:
38 | obj1 = ["a", [1, 2, 3]]
39 | obj2 = deepcopy_minimal(obj1)
40 | assert_different_identities(obj1, obj2)
41 | assert_different_identities(obj1[1], obj2[1])
42 |
43 |
44 | class MyObject: ...
45 |
46 |
47 | def test_ignores_other_types() -> None:
48 | # custom classes
49 | my_obj = MyObject()
50 | obj1 = {"foo": my_obj}
51 | obj2 = deepcopy_minimal(obj1)
52 | assert_different_identities(obj1, obj2)
53 | assert obj1["foo"] is my_obj
54 |
55 | # tuples
56 | obj3 = ("a", "b")
57 | obj4 = deepcopy_minimal(obj3)
58 | assert obj3 is obj4
59 |
--------------------------------------------------------------------------------
/tests/test_extract_files.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | from typing import Sequence
4 |
5 | import pytest
6 |
7 | from llama_stack_client._types import FileTypes
8 | from llama_stack_client._utils import extract_files
9 |
10 |
11 | def test_removes_files_from_input() -> None:
12 | query = {"foo": "bar"}
13 | assert extract_files(query, paths=[]) == []
14 | assert query == {"foo": "bar"}
15 |
16 | query2 = {"foo": b"Bar", "hello": "world"}
17 | assert extract_files(query2, paths=[["foo"]]) == [("foo", b"Bar")]
18 | assert query2 == {"hello": "world"}
19 |
20 | query3 = {"foo": {"foo": {"bar": b"Bar"}}, "hello": "world"}
21 | assert extract_files(query3, paths=[["foo", "foo", "bar"]]) == [("foo[foo][bar]", b"Bar")]
22 | assert query3 == {"foo": {"foo": {}}, "hello": "world"}
23 |
24 | query4 = {"foo": {"bar": b"Bar", "baz": "foo"}, "hello": "world"}
25 | assert extract_files(query4, paths=[["foo", "bar"]]) == [("foo[bar]", b"Bar")]
26 | assert query4 == {"hello": "world", "foo": {"baz": "foo"}}
27 |
28 |
29 | def test_multiple_files() -> None:
30 | query = {"documents": [{"file": b"My first file"}, {"file": b"My second file"}]}
31 | assert extract_files(query, paths=[["documents", "", "file"]]) == [
32 | ("documents[][file]", b"My first file"),
33 | ("documents[][file]", b"My second file"),
34 | ]
35 | assert query == {"documents": [{}, {}]}
36 |
37 |
38 | @pytest.mark.parametrize(
39 | "query,paths,expected",
40 | [
41 | [
42 | {"foo": {"bar": "baz"}},
43 | [["foo", "", "bar"]],
44 | [],
45 | ],
46 | [
47 | {"foo": ["bar", "baz"]},
48 | [["foo", "bar"]],
49 | [],
50 | ],
51 | [
52 | {"foo": {"bar": "baz"}},
53 | [["foo", "foo"]],
54 | [],
55 | ],
56 | ],
57 | ids=["dict expecting array", "array expecting dict", "unknown keys"],
58 | )
59 | def test_ignores_incorrect_paths(
60 | query: dict[str, object],
61 | paths: Sequence[Sequence[str]],
62 | expected: list[tuple[str, FileTypes]],
63 | ) -> None:
64 | assert extract_files(query, paths=paths) == expected
65 |
--------------------------------------------------------------------------------
/tests/test_files.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | import anyio
4 | import pytest
5 | from dirty_equals import IsDict, IsList, IsBytes, IsTuple
6 |
7 | from llama_stack_client._files import to_httpx_files, async_to_httpx_files
8 |
9 | readme_path = Path(__file__).parent.parent.joinpath("README.md")
10 |
11 |
12 | def test_pathlib_includes_file_name() -> None:
13 | result = to_httpx_files({"file": readme_path})
14 | print(result)
15 | assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
16 |
17 |
18 | def test_tuple_input() -> None:
19 | result = to_httpx_files([("file", readme_path)])
20 | print(result)
21 | assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
22 |
23 |
24 | @pytest.mark.asyncio
25 | async def test_async_pathlib_includes_file_name() -> None:
26 | result = await async_to_httpx_files({"file": readme_path})
27 | print(result)
28 | assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
29 |
30 |
31 | @pytest.mark.asyncio
32 | async def test_async_supports_anyio_path() -> None:
33 | result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
34 | print(result)
35 | assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
36 |
37 |
38 | @pytest.mark.asyncio
39 | async def test_async_tuple_input() -> None:
40 | result = await async_to_httpx_files([("file", readme_path)])
41 | print(result)
42 | assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
43 |
44 |
45 | def test_string_not_allowed() -> None:
46 | with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
47 | to_httpx_files(
48 | {
49 | "file": "foo", # type: ignore
50 | }
51 | )
52 |
--------------------------------------------------------------------------------
/tests/test_utils/test_proxy.py:
--------------------------------------------------------------------------------
1 | import operator
2 | from typing import Any
3 | from typing_extensions import override
4 |
5 | from llama_stack_client._utils import LazyProxy
6 |
7 |
8 | class RecursiveLazyProxy(LazyProxy[Any]):
9 | @override
10 | def __load__(self) -> Any:
11 | return self
12 |
13 | def __call__(self, *_args: Any, **_kwds: Any) -> Any:
14 | raise RuntimeError("This should never be called!")
15 |
16 |
17 | def test_recursive_proxy() -> None:
18 | proxy = RecursiveLazyProxy()
19 | assert repr(proxy) == "RecursiveLazyProxy"
20 | assert str(proxy) == "RecursiveLazyProxy"
21 | assert dir(proxy) == []
22 | assert type(proxy).__name__ == "RecursiveLazyProxy"
23 | assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy"
24 |
25 |
26 | def test_isinstance_does_not_error() -> None:
27 | class AlwaysErrorProxy(LazyProxy[Any]):
28 | @override
29 | def __load__(self) -> Any:
30 | raise RuntimeError("Mocking missing dependency")
31 |
32 | proxy = AlwaysErrorProxy()
33 | assert not isinstance(proxy, dict)
34 | assert isinstance(proxy, LazyProxy)
35 |
--------------------------------------------------------------------------------