timbal 2.8.0__tar.gz → 2.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {timbal-2.8.0 → timbal-2.8.2}/PKG-INFO +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/_version.py +2 -2
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/router.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/memory_compaction.py +79 -17
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/runnable.py +7 -6
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/test_model.py +63 -2
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/llm_base.py +2 -2
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/rubric.py +2 -2
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/injection.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/judge.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/topic.py +2 -2
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/rubric.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/trace.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/exporters/otel.py +1 -1
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/base.py +13 -6
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/jsonl.py +3 -3
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/sqlite.py +3 -3
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/file.py +6 -1
- {timbal-2.8.0 → timbal-2.8.2}/.gitignore +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/LICENSE +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/README.md +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/chat-completions.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/create-from-workforce.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/jobs/cancel.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/jobs/create.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/jobs/get.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/jobs/list.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/jobs/retry.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/link.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/list-context-vars.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/list-policies.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/docs/api-reference/ace/unlink.mdx +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/pyproject.toml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/pyrightconfig.json +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/_openai_audio.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/_slots.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/__main__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/cli_utils.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/cst_utils.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/flow.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/format.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/guardrail_specs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/library.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/model_discovery.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/test.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/tool_discovery.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/add_edge.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/add_guardrail.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/add_mcp.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/add_step.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/add_tool.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/remove_edge.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/remove_guardrail.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/remove_step.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/remove_tool.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/set_config.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/set_param.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/codegen/transformers/set_position.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/harmony_leak.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/anthropic.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/default.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/message.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/openai.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/string.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/impl/timbal.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/collectors/registry.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/agent.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/attachment_limit.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/continuation.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/fallback_model.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/auto.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/chat_completions.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/clients.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/messages.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/registry.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/responses.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/llm/retry.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/mcp.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/models.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/provider_errors.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/session_scheduler.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/skill.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/tool.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/tool_result_offload.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/tool_set.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/core/workflow.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/errors.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/cli.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/display.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/agent.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_examples.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_flow_validators.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_negations.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_parallel.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_subagent.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/eval_transforms.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/fixtures/test_invalid_validator.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/models.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/reporters.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/runner.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/utils.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/_spans.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/comparison_base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/contains.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/contains_all.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/contains_any.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/context.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/email.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/ends_with.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/eq.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/gt.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/gte.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/json.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/language.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/length.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/lt.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/lte.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/max_length.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/min_length.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/not_null.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/parallel.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/pattern.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/prompt.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/semantic.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/seq.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/starts_with.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/evals/validators/type.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/apply.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/keywords.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/length.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/moderate.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/pii.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/builtins/secrets.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/judge_llm.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/presets.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/runner.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/testing.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/guardrails/types.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/logs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/models.yaml +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/_http_session.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/integrations.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/knowledge_bases/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/knowledge_bases/query.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/tool_proxy.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/types.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/platform/utils.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/__main__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/capacity.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/http.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/jobs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/livekit_call_control.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/livekit_session.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/livekit_sip.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/playground.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/recording_upload.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/rtc.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/single_session.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/telephony.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/voice.html +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/server/voice.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/background.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/config.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/config_loader.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/context.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/dependency_analyzer.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/exporters/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/in_memory.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/providers/platform.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/span.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/trace.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/state/tracing/uploads.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/_creds.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/aircall.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/asana.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/bash.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/cala.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/cloudflare.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/connectif.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/covermanager.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/deepgram.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/dynamics_business_central.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/dynamics_sales.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/edit.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/elasticsearch.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/elevenlabs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/excel.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/fal.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/fathom.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/firecrawl.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/freematica.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/freematica_contracts.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/freematica_people.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/freematica_purchasing.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/freematica_sales.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/gemini_images.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/gmail.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_analytics.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_business.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_calendar.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_docs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_drive.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_maps.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_merchant_center.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_search_console.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/google_sheets.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/happy_scribe.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/higgsfield.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/hubspot.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/interaction.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/jira.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/klaviyo.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/knowledge_base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/krea.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/lancedb.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/linkedin.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/mongodb.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/netsuite.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/onedrive.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/openai_audio.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/outlook.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/parallel.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/pinecone.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/powerbi.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/quiver_ai.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/read.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/replicate.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/resend.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/salesforce.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/scraperapi.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/sharepoint.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/shopify.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/slack.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/stripe.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/tavily.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/web_search.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/write.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/xai.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/zendesk.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/tools/zoho_crm.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/approval.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/custom.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/file.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/text.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/thinking.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/tool_result.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/content/tool_use.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/approval.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/base.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/delta.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/guardrail.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/interaction.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/output.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/events/start.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/message.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/types/run_status.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/import_spec.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/model.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/net.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/schema.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/utils/serialization.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/__init__.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/_whisper_features.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/ambience.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/config.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/deepgram.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/deepgram_tts.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/elevenlabs.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/endpointing.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/eou.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/events.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/fish_audio.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/livekit.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/metrics.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/munsit.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/namo.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/openai.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/playback.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/providers.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/realtime.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/recording.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/session.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/smart_turn.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/telephony.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/turn_detection.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/vad.py +0 -0
- {timbal-2.8.0 → timbal-2.8.2}/python/timbal/voice/webrtc.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.8.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 8,
|
|
21
|
+
__version__ = version = '2.8.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 8, 2)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -79,7 +79,7 @@ async def _llm_router(
|
|
|
79
79
|
# TestModel short-circuit — delegates to model.stream() with no network call.
|
|
80
80
|
if hasattr(model, "stream"):
|
|
81
81
|
_set_model_metadata(getattr(model, "provider", "test"), getattr(model, "model_name", "model"))
|
|
82
|
-
async for chunk in model.stream(messages=messages):
|
|
82
|
+
async for chunk in model.stream(messages=messages, output_model=output_model):
|
|
83
83
|
yield chunk # type: ignore[return-type]
|
|
84
84
|
return
|
|
85
85
|
|
|
@@ -14,7 +14,7 @@ import structlog
|
|
|
14
14
|
from uuid_extensions import uuid7
|
|
15
15
|
|
|
16
16
|
from ..types.content import CustomContent, TextContent, ToolResultContent, ToolUseContent
|
|
17
|
-
from ..types.message import Message
|
|
17
|
+
from ..types.message import RUNTIME_SOURCE, Message
|
|
18
18
|
from .tool_result_offload import read_offloaded_call
|
|
19
19
|
|
|
20
20
|
logger = structlog.get_logger("timbal.core.memory_compaction")
|
|
@@ -36,6 +36,11 @@ _VERBATIM_MARKER = "[Verbatim User Messages]"
|
|
|
36
36
|
_TRANSCRIPT_MARKER = "[Compacted Transcripts]"
|
|
37
37
|
_NOTE_MARKER = "[Note]"
|
|
38
38
|
_REHYDRATED_MARKER = "[Rehydrated Context]"
|
|
39
|
+
# Opening note for a windowed transcript that would otherwise start on assistant/tool.
|
|
40
|
+
# ``summarize`` gets the same guarantee by injecting its summary as a user message.
|
|
41
|
+
# Tagged runtime so it is not a turn boundary and not "the user's own words".
|
|
42
|
+
_EARLIER_CONVERSATION_NOTE = "(earlier conversation)"
|
|
43
|
+
_COMPACTION_NOTE_KIND = "compaction_note"
|
|
39
44
|
_SECTION_MARKERS = (_SUMMARY_MARKER, _VERBATIM_MARKER, _TRANSCRIPT_MARKER, _NOTE_MARKER, _REHYDRATED_MARKER)
|
|
40
45
|
_VERBATIM_SEPARATOR = "\n----8<----\n"
|
|
41
46
|
_VERBATIM_HEADER = "The user's own messages from the compacted region, verbatim, oldest first:"
|
|
@@ -97,6 +102,41 @@ def _pinned_protected_indices(memory: list[Message]) -> set[int]:
|
|
|
97
102
|
return keep
|
|
98
103
|
|
|
99
104
|
|
|
105
|
+
def _ensure_opens_with_user(memory: list[Message]) -> list[Message]:
|
|
106
|
+
"""Return ``memory`` with a leading user message when the conversation does not open on one.
|
|
107
|
+
|
|
108
|
+
``summarize`` always opens the non-system region with a user message (the summary).
|
|
109
|
+
Positional compactors can drop that opening user turn and still retain pinned tool
|
|
110
|
+
pairs from before it, so the transcript starts on an assistant ``tool_use``. Providers
|
|
111
|
+
that expect a leading user turn then treat the request differently (one production
|
|
112
|
+
path dropped ``cache_control`` and billed the prefix uncached). Insert a short user
|
|
113
|
+
note ahead of those pairs. Do not move them to after the first kept user message:
|
|
114
|
+
that would change their order relative to the question.
|
|
115
|
+
|
|
116
|
+
Leading system messages stay in front, matching ``summarize``. A transcript that
|
|
117
|
+
already opens on a user message (including after that system prefix) is unchanged.
|
|
118
|
+
|
|
119
|
+
The note is role ``user`` — that is what providers see — and ``source="runtime"``
|
|
120
|
+
so turn windows, verbatim user sections, and transcripts do not treat it as a
|
|
121
|
+
human utterance. Metadata is not sent on the wire.
|
|
122
|
+
"""
|
|
123
|
+
if not memory or memory[0].role == "user":
|
|
124
|
+
return memory
|
|
125
|
+
insert_at = 0
|
|
126
|
+
while insert_at < len(memory) and memory[insert_at].role == "system":
|
|
127
|
+
insert_at += 1
|
|
128
|
+
if insert_at == len(memory) or memory[insert_at].role == "user":
|
|
129
|
+
return memory
|
|
130
|
+
note = Message.validate(
|
|
131
|
+
{
|
|
132
|
+
"role": "user",
|
|
133
|
+
"content": _EARLIER_CONVERSATION_NOTE,
|
|
134
|
+
"metadata": {"source": RUNTIME_SOURCE, "kind": _COMPACTION_NOTE_KIND},
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
return [*memory[:insert_at], note, *memory[insert_at:]]
|
|
138
|
+
|
|
139
|
+
|
|
100
140
|
def _remove_orphaned_tool_parts(memory: list[Message]) -> list[Message]:
|
|
101
141
|
"""Remove tool_use without tool_result, and tool_result without tool_use."""
|
|
102
142
|
tool_use_ids = _collect_ids(memory, "assistant", ToolUseContent)
|
|
@@ -557,6 +597,15 @@ def keep_last_n_messages(n: int) -> Callable[[list[Message]], list[Message]]:
|
|
|
557
597
|
would cut a tool call sequence, removes the orphaned part (tool_result without
|
|
558
598
|
tool_use, or tool_use without tool_result).
|
|
559
599
|
|
|
600
|
+
Pinned tool results (and their paired tool_use) outside the window are kept in
|
|
601
|
+
original order. If the conversation would then open on a non-user message, a
|
|
602
|
+
short user note ``"(earlier conversation)"`` is inserted there — the same opening
|
|
603
|
+
guarantee ``summarize`` gets from its user-role summary. The note is a runtime
|
|
604
|
+
message, so it is not counted as a turn and is not treated as the user's words.
|
|
605
|
+
Leading system messages stay in front of the note. The pinned pairs are not moved
|
|
606
|
+
to after the first kept user message. Messages that already fit in ``n`` are not
|
|
607
|
+
dropped; only a missing user opening is repaired.
|
|
608
|
+
|
|
560
609
|
Args:
|
|
561
610
|
n: Maximum number of messages to retain.
|
|
562
611
|
|
|
@@ -566,11 +615,13 @@ def keep_last_n_messages(n: int) -> Callable[[list[Message]], list[Message]]:
|
|
|
566
615
|
|
|
567
616
|
def _compact(memory: list[Message]) -> list[Message]:
|
|
568
617
|
if len(memory) <= n:
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
618
|
+
compacted = _remove_orphaned_tool_parts(memory)
|
|
619
|
+
else:
|
|
620
|
+
# Keep the last n messages, plus any pinned messages (and their paired tool_use) that
|
|
621
|
+
# fell outside the window — "last n PLUS pinned". Order is preserved.
|
|
622
|
+
keep = set(range(len(memory) - n, len(memory))) | _pinned_protected_indices(memory)
|
|
623
|
+
compacted = _remove_orphaned_tool_parts([memory[i] for i in sorted(keep)])
|
|
624
|
+
return _ensure_opens_with_user(compacted)
|
|
574
625
|
|
|
575
626
|
return _compact
|
|
576
627
|
|
|
@@ -581,6 +632,15 @@ def keep_last_n_turns(n: int) -> Callable[[list[Message]], list[Message]]:
|
|
|
581
632
|
A turn starts with a user message and includes all messages until the next
|
|
582
633
|
user message (assistant, tool calls, etc.). Structure-aware.
|
|
583
634
|
|
|
635
|
+
Pinned tool results (and their paired tool_use) from earlier turns are kept in
|
|
636
|
+
original order. If the conversation would then open on a non-user message, a
|
|
637
|
+
short user note ``"(earlier conversation)"`` is inserted there — the same opening
|
|
638
|
+
guarantee ``summarize`` gets from its user-role summary. The note is a runtime
|
|
639
|
+
message, so it is not counted as a turn and is not treated as the user's words.
|
|
640
|
+
Leading system messages stay in front of the note. The pinned pairs are not moved
|
|
641
|
+
to after the first kept user message. Turns that already fit in ``n`` are not
|
|
642
|
+
dropped; only a missing user opening is repaired.
|
|
643
|
+
|
|
584
644
|
Args:
|
|
585
645
|
n: Maximum number of turns to retain.
|
|
586
646
|
|
|
@@ -595,16 +655,18 @@ def keep_last_n_turns(n: int) -> Callable[[list[Message]], list[Message]]:
|
|
|
595
655
|
# for the LLM wire but must not count as turn boundaries.
|
|
596
656
|
user_indices = [i for i, m in enumerate(memory) if m.role == "user" and not m.is_runtime()]
|
|
597
657
|
if len(user_indices) <= n:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
start
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
658
|
+
compacted = _remove_orphaned_tool_parts(memory)
|
|
659
|
+
else:
|
|
660
|
+
start = user_indices[-n]
|
|
661
|
+
# Pull contiguous runtime notices that sit immediately before the first kept
|
|
662
|
+
# human user message so [...notice, user...] stays intact.
|
|
663
|
+
while start > 0 and memory[start - 1].is_runtime():
|
|
664
|
+
start -= 1
|
|
665
|
+
# Keep the last n turns, plus any pinned messages (and their paired tool_use) from
|
|
666
|
+
# earlier turns. Order is preserved.
|
|
667
|
+
keep = set(range(start, len(memory))) | _pinned_protected_indices(memory)
|
|
668
|
+
compacted = _remove_orphaned_tool_parts([memory[i] for i in sorted(keep)])
|
|
669
|
+
return _ensure_opens_with_user(compacted)
|
|
608
670
|
|
|
609
671
|
return _compact
|
|
610
672
|
|
|
@@ -653,7 +715,7 @@ def summarize(
|
|
|
653
715
|
threshold: Trigger summarization when message count exceeds this.
|
|
654
716
|
model: Model for summarization. Defaults to None, which uses the
|
|
655
717
|
agent's own model. Override with a cheaper model like
|
|
656
|
-
'openai/gpt-5
|
|
718
|
+
'openai/gpt-5-mini' to reduce cost.
|
|
657
719
|
keep_last_n: Number of recent messages to keep unsummarized.
|
|
658
720
|
max_summary_tokens: Maximum tokens for the summary response.
|
|
659
721
|
preserve_user_messages: Carry the user's messages from the summarized region
|
|
@@ -360,12 +360,13 @@ class Runnable(ABC, BaseModel):
|
|
|
360
360
|
pre_hook: Callable[[], Any] | None = None
|
|
361
361
|
"""Pre-execution hook: parameterless callable; use get_run_context() for state.
|
|
362
362
|
|
|
363
|
-
Runs after input resolution
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
363
|
+
Runs after input resolution, Pydantic validation, and the approval gate,
|
|
364
|
+
and only when the handler is about to run. Tool and workflow handlers
|
|
365
|
+
receive the already-validated kwargs; mutating ``span.input`` updates the
|
|
366
|
+
span record and is visible to later readers (an agent's
|
|
367
|
+
``resolve_memory``, a system-prompt callable, a post-hook) but does not
|
|
368
|
+
change those kwargs. Defer expensive work until after approval by using
|
|
369
|
+
this hook, the handler, or a nested Runnable.
|
|
369
370
|
"""
|
|
370
371
|
post_hook: Callable[[], Any] | None = None
|
|
371
372
|
"""Post-execution hook for runtime processing. Must be a parameterless callable.
|
|
@@ -1,7 +1,66 @@
|
|
|
1
1
|
"""Drop-in model replacement for testing agents without hitting a real LLM API."""
|
|
2
2
|
|
|
3
|
+
import json
|
|
4
|
+
import types
|
|
3
5
|
from collections.abc import AsyncGenerator, Callable
|
|
4
|
-
from
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import Any, Literal, Union, get_args, get_origin
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _placeholder(annotation: Any, seen: set[type] | None = None) -> Any:
|
|
11
|
+
"""Smallest JSON-able value that satisfies a structured-output annotation."""
|
|
12
|
+
from pydantic import BaseModel
|
|
13
|
+
|
|
14
|
+
origin = get_origin(annotation)
|
|
15
|
+
args = get_args(annotation)
|
|
16
|
+
if origin is Literal and args:
|
|
17
|
+
return args[0]
|
|
18
|
+
if origin is Union or origin is types.UnionType:
|
|
19
|
+
non_none = [arg for arg in args if arg is not type(None)]
|
|
20
|
+
return _placeholder(non_none[0], seen) if non_none else None
|
|
21
|
+
if origin is list:
|
|
22
|
+
inner = args[0] if args else str
|
|
23
|
+
return [_placeholder(inner, seen)]
|
|
24
|
+
if origin is dict:
|
|
25
|
+
return {}
|
|
26
|
+
# Bare ``list`` / ``dict`` have no origin. ``"test"`` does not validate.
|
|
27
|
+
if annotation is list:
|
|
28
|
+
return ["test"]
|
|
29
|
+
if annotation is dict:
|
|
30
|
+
return {}
|
|
31
|
+
if annotation is str or annotation is Any or annotation is None:
|
|
32
|
+
return "test"
|
|
33
|
+
if annotation is int:
|
|
34
|
+
return 0
|
|
35
|
+
if annotation is float:
|
|
36
|
+
return 0.0
|
|
37
|
+
if annotation is bool:
|
|
38
|
+
return False
|
|
39
|
+
if isinstance(annotation, type) and issubclass(annotation, BaseModel):
|
|
40
|
+
# Track the path, not every model already emitted. A second field of the
|
|
41
|
+
# same nested type is a sibling, not a cycle.
|
|
42
|
+
path = set() if seen is None else set(seen)
|
|
43
|
+
if annotation in path:
|
|
44
|
+
return {}
|
|
45
|
+
path.add(annotation)
|
|
46
|
+
payload: dict[str, Any] = {}
|
|
47
|
+
for name, field in annotation.model_fields.items():
|
|
48
|
+
if field.is_required():
|
|
49
|
+
payload[name] = _placeholder(field.annotation, path)
|
|
50
|
+
return payload
|
|
51
|
+
if isinstance(annotation, type) and issubclass(annotation, Enum):
|
|
52
|
+
return next(iter(annotation)).value
|
|
53
|
+
return "test"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _json_for_output_model(raw: str, output_model: type) -> str:
|
|
57
|
+
try:
|
|
58
|
+
output_model.model_validate_json(raw)
|
|
59
|
+
except Exception:
|
|
60
|
+
payload = _placeholder(output_model)
|
|
61
|
+
output_model.model_validate(payload)
|
|
62
|
+
return json.dumps(payload)
|
|
63
|
+
return raw
|
|
5
64
|
|
|
6
65
|
|
|
7
66
|
class TestModel:
|
|
@@ -68,7 +127,7 @@ class TestModel:
|
|
|
68
127
|
self.handler = handler
|
|
69
128
|
self.call_count: int = 0
|
|
70
129
|
|
|
71
|
-
async def stream(self, messages: list, **_kwargs: Any) -> AsyncGenerator:
|
|
130
|
+
async def stream(self, messages: list, output_model: Any = None, **_kwargs: Any) -> AsyncGenerator:
|
|
72
131
|
"""Yield a single Message — no network call, no streaming.
|
|
73
132
|
|
|
74
133
|
Implements the same async-generator interface as ``_llm_router`` so
|
|
@@ -100,6 +159,8 @@ class TestModel:
|
|
|
100
159
|
raw = self.responses[idx]
|
|
101
160
|
|
|
102
161
|
if isinstance(raw, str):
|
|
162
|
+
if output_model is not None:
|
|
163
|
+
raw = _json_for_output_model(raw, output_model)
|
|
103
164
|
response = Message(
|
|
104
165
|
role="assistant",
|
|
105
166
|
content=[TextContent(text=raw)],
|
|
@@ -22,7 +22,7 @@ class LLMValidator(BaseValidator):
|
|
|
22
22
|
Attributes:
|
|
23
23
|
system_prompt: System prompt for the LLM. Can be customized in YAML.
|
|
24
24
|
Subclasses should provide a default value.
|
|
25
|
-
model: LLM model to use for validation. Defaults to "gpt-
|
|
25
|
+
model: LLM model to use for validation. Defaults to "openai/gpt-5-mini".
|
|
26
26
|
Can be customized in YAML.
|
|
27
27
|
|
|
28
28
|
Subclasses should implement:
|
|
@@ -31,7 +31,7 @@ class LLMValidator(BaseValidator):
|
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
system_prompt: str # Must be set in subclass or YAML
|
|
34
|
-
model: str = "openai/gpt-5
|
|
34
|
+
model: str = "openai/gpt-5-mini" # Can be overridden in YAML
|
|
35
35
|
|
|
36
36
|
@abstractmethod
|
|
37
37
|
def get_user_prompt(self, actual_value: Any) -> str:
|
|
@@ -33,7 +33,7 @@ class RubricValidator(BaseValidator):
|
|
|
33
33
|
name: recommendations
|
|
34
34
|
weight: 2
|
|
35
35
|
pass_threshold: 0.75
|
|
36
|
-
model: openai/gpt-5
|
|
36
|
+
model: openai/gpt-5-mini
|
|
37
37
|
context: "The agent produced a price-comparison report."
|
|
38
38
|
|
|
39
39
|
# Markdown rubric (bullet lines become criteria):
|
|
@@ -47,7 +47,7 @@ class RubricValidator(BaseValidator):
|
|
|
47
47
|
"""
|
|
48
48
|
|
|
49
49
|
name: Literal["rubric!"] = "rubric!" # type: ignore
|
|
50
|
-
model: SkipValidation[Any] = "openai/gpt-5
|
|
50
|
+
model: SkipValidation[Any] = "openai/gpt-5-mini"
|
|
51
51
|
"""Judge model. Use a small, cheap model."""
|
|
52
52
|
pass_threshold: float = 1.0
|
|
53
53
|
"""Weighted fraction of criteria that must pass (1.0 = all)."""
|
|
@@ -64,7 +64,7 @@ class PromptInjection(Guardrail):
|
|
|
64
64
|
stages: set[GuardrailStage] = Field(default_factory=lambda: {GuardrailStage.INPUT})
|
|
65
65
|
action: str = "block"
|
|
66
66
|
model: Any = None
|
|
67
|
-
"""Optional LLM classifier model — a model string (e.g. 'openai/gpt-5
|
|
67
|
+
"""Optional LLM classifier model — a model string (e.g. 'openai/gpt-5-mini'), or any
|
|
68
68
|
model instance the router accepts (FallbackModel, TestModel). None = patterns only."""
|
|
69
69
|
max_classifier_chars: int = 8_000
|
|
70
70
|
"""Input beyond this is truncated before classification (patterns still see all of it)."""
|
|
@@ -58,7 +58,7 @@ class LLMJudge(Guardrail):
|
|
|
58
58
|
"""Rubric mode: weighted fraction of criteria that must pass (1.0 = all)."""
|
|
59
59
|
rubric_context: str | None = None
|
|
60
60
|
"""Optional task description shown to every rubric judge."""
|
|
61
|
-
model: Any = "openai/gpt-5
|
|
61
|
+
model: Any = "openai/gpt-5-mini"
|
|
62
62
|
max_chars: int = 16_000
|
|
63
63
|
|
|
64
64
|
def __init__(self, criteria: str | None = None, **kwargs: Any) -> None:
|
|
@@ -21,7 +21,7 @@ class TopicGuard(Guardrail):
|
|
|
21
21
|
```python
|
|
22
22
|
TopicGuard(allow=["billing", "shipping"],
|
|
23
23
|
blocked_message="I can only help with billing and shipping.")
|
|
24
|
-
TopicGuard(deny=["medical advice", "legal advice"], model="openai/gpt-5
|
|
24
|
+
TopicGuard(deny=["medical advice", "legal advice"], model="openai/gpt-5-mini")
|
|
25
25
|
```
|
|
26
26
|
"""
|
|
27
27
|
|
|
@@ -32,7 +32,7 @@ class TopicGuard(Guardrail):
|
|
|
32
32
|
"""Topics the agent may discuss. Anything else is off-topic."""
|
|
33
33
|
deny: list[str] = Field(default_factory=list)
|
|
34
34
|
"""Topics that are always off-topic (checked in addition to allow)."""
|
|
35
|
-
model: Any = "openai/gpt-5
|
|
35
|
+
model: Any = "openai/gpt-5-mini"
|
|
36
36
|
"""Classifier model: a model string, or any model instance the router accepts."""
|
|
37
37
|
max_chars: int = 8_000
|
|
38
38
|
|
|
@@ -11,7 +11,7 @@ from timbal.guardrails import trace_redactor
|
|
|
11
11
|
from timbal.state.tracing.providers import JsonlTracingProvider
|
|
12
12
|
|
|
13
13
|
provider = JsonlTracingProvider.configured(
|
|
14
|
-
|
|
14
|
+
path=Path("traces.jsonl"),
|
|
15
15
|
_trace_redactor=trace_redactor(), # PII + secrets, deterministic
|
|
16
16
|
# _trace_redactor=trace_redactor("pii:redact", DetectPII(types=["ssn"])),
|
|
17
17
|
)
|
|
@@ -32,7 +32,7 @@ class OTelExporter(Exporter):
|
|
|
32
32
|
from timbal.state.tracing.providers import JsonlTracingProvider
|
|
33
33
|
|
|
34
34
|
provider = JsonlTracingProvider.configured(
|
|
35
|
-
|
|
35
|
+
path=Path("traces.jsonl"),
|
|
36
36
|
_exporters=[
|
|
37
37
|
OTelExporter(
|
|
38
38
|
endpoint="http://localhost:4318",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from collections.abc import Callable
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
from typing import TYPE_CHECKING, Any
|
|
4
5
|
|
|
5
6
|
from ..span import Span
|
|
@@ -71,7 +72,7 @@ class Exporter(ABC):
|
|
|
71
72
|
Exporters are attached via ``configured()``::
|
|
72
73
|
|
|
73
74
|
provider = JsonlTracingProvider.configured(
|
|
74
|
-
|
|
75
|
+
path=Path("traces.jsonl"),
|
|
75
76
|
_exporters=[OTelExporter(endpoint="http://...")],
|
|
76
77
|
)
|
|
77
78
|
|
|
@@ -132,8 +133,8 @@ class TracingProvider(ABC):
|
|
|
132
133
|
overridden — the original class is never mutated::
|
|
133
134
|
|
|
134
135
|
# Each call returns a new, independent subclass:
|
|
135
|
-
provider_a = JsonlTracingProvider.configured(
|
|
136
|
-
provider_b = JsonlTracingProvider.configured(
|
|
136
|
+
provider_a = JsonlTracingProvider.configured(path=Path("a.jsonl"))
|
|
137
|
+
provider_b = JsonlTracingProvider.configured(path=Path("b.jsonl"))
|
|
137
138
|
|
|
138
139
|
# provider_a._path and provider_b._path are independent.
|
|
139
140
|
# JsonlTracingProvider._path is still None (unchanged).
|
|
@@ -160,7 +161,7 @@ class TracingProvider(ABC):
|
|
|
160
161
|
primary storage has been written::
|
|
161
162
|
|
|
162
163
|
provider = JsonlTracingProvider.configured(
|
|
163
|
-
|
|
164
|
+
path=Path("traces.jsonl"),
|
|
164
165
|
_exporters=[OTelExporter(endpoint="http://...")],
|
|
165
166
|
)
|
|
166
167
|
|
|
@@ -211,7 +212,7 @@ class TracingProvider(ABC):
|
|
|
211
212
|
(uploads failing or falling behind). ``None`` reads ``TIMBAL_TRACE_MAX_LAG_S``, else 30 s."""
|
|
212
213
|
|
|
213
214
|
@classmethod
|
|
214
|
-
def configured(cls, **kwargs) -> type["TracingProvider"]:
|
|
215
|
+
def configured(cls, **kwargs: Any) -> type["TracingProvider"]:
|
|
215
216
|
"""Return a configured subclass with the given class-level attributes.
|
|
216
217
|
|
|
217
218
|
Creates a new subclass with the specified attributes set at the class
|
|
@@ -222,11 +223,17 @@ class TracingProvider(ABC):
|
|
|
222
223
|
**kwargs: Class-level attributes to set on the new subclass.
|
|
223
224
|
What attributes are valid depends on the provider — see
|
|
224
225
|
the provider's class docstring for the full list.
|
|
225
|
-
|
|
226
|
+
``path`` is the public alias of ``_path`` for file-backed
|
|
227
|
+
providers. Pass ``_exporters=[...]`` to attach write-only sinks.
|
|
226
228
|
|
|
227
229
|
Returns:
|
|
228
230
|
A new subclass of this provider with the given attributes applied.
|
|
229
231
|
"""
|
|
232
|
+
if "path" in kwargs:
|
|
233
|
+
if "_path" in kwargs:
|
|
234
|
+
raise TypeError(f"{cls.__name__}.configured() received both path and _path")
|
|
235
|
+
path = kwargs.pop("path")
|
|
236
|
+
kwargs["_path"] = path if isinstance(path, Path) else Path(path)
|
|
230
237
|
return type(cls.__name__, (cls,), kwargs)
|
|
231
238
|
|
|
232
239
|
@classmethod
|
|
@@ -77,7 +77,7 @@ class JsonlTracingProvider(TracingProvider):
|
|
|
77
77
|
|
|
78
78
|
Configure via the base-class ``configured()`` method::
|
|
79
79
|
|
|
80
|
-
provider = JsonlTracingProvider.configured(
|
|
80
|
+
provider = JsonlTracingProvider.configured(path=Path("traces.jsonl"))
|
|
81
81
|
agent = Agent(name="my_agent", model=..., tracing_provider=provider)
|
|
82
82
|
|
|
83
83
|
Class-level attributes:
|
|
@@ -178,7 +178,7 @@ class JsonlTracingProvider(TracingProvider):
|
|
|
178
178
|
if cls._path is None:
|
|
179
179
|
raise RuntimeError(
|
|
180
180
|
"JsonlTracingProvider._path is not set. "
|
|
181
|
-
"Use JsonlTracingProvider.configured(
|
|
181
|
+
"Use JsonlTracingProvider.configured(path=Path(...)) to create a configured provider."
|
|
182
182
|
)
|
|
183
183
|
|
|
184
184
|
def _claim() -> bool:
|
|
@@ -222,7 +222,7 @@ class JsonlTracingProvider(TracingProvider):
|
|
|
222
222
|
if cls._path is None:
|
|
223
223
|
raise RuntimeError(
|
|
224
224
|
"JsonlTracingProvider._path is not set. "
|
|
225
|
-
"Use JsonlTracingProvider.configured(
|
|
225
|
+
"Use JsonlTracingProvider.configured(path=Path(...)) to create a configured provider."
|
|
226
226
|
)
|
|
227
227
|
run_id = str(run_context.id)
|
|
228
228
|
new_record = {
|
|
@@ -26,7 +26,7 @@ class SqliteTracingProvider(TracingProvider):
|
|
|
26
26
|
|
|
27
27
|
Configure via the base-class ``configured()`` method::
|
|
28
28
|
|
|
29
|
-
provider = SqliteTracingProvider.configured(
|
|
29
|
+
provider = SqliteTracingProvider.configured(path=Path("traces.db"))
|
|
30
30
|
agent = Agent(name="my_agent", model=..., tracing_provider=provider)
|
|
31
31
|
|
|
32
32
|
Class-level attributes:
|
|
@@ -136,7 +136,7 @@ class SqliteTracingProvider(TracingProvider):
|
|
|
136
136
|
if cls._path is None:
|
|
137
137
|
raise RuntimeError(
|
|
138
138
|
"SqliteTracingProvider._path is not set. "
|
|
139
|
-
"Use SqliteTracingProvider.configured(
|
|
139
|
+
"Use SqliteTracingProvider.configured(path=Path(...)) to create a configured provider."
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
def _claim() -> bool:
|
|
@@ -180,7 +180,7 @@ class SqliteTracingProvider(TracingProvider):
|
|
|
180
180
|
if cls._path is None:
|
|
181
181
|
raise RuntimeError(
|
|
182
182
|
"SqliteTracingProvider._path is not set. "
|
|
183
|
-
"Use SqliteTracingProvider.configured(
|
|
183
|
+
"Use SqliteTracingProvider.configured(path=Path(...)) to create a configured provider."
|
|
184
184
|
)
|
|
185
185
|
|
|
186
186
|
run_id = str(run_context.id)
|
|
@@ -486,9 +486,14 @@ class File(io.IOBase):
|
|
|
486
486
|
|
|
487
487
|
path = "files"
|
|
488
488
|
files = {"file": (self.name, content, self.__content_type__)}
|
|
489
|
+
# The platform counts the upload against this org's files_upload_rate
|
|
490
|
+
# instead of the per-user default. It only accepts numeric org ids;
|
|
491
|
+
# platforms without the parameter ignore it.
|
|
492
|
+
org_id = run_context.platform_config.subject.org_id
|
|
493
|
+
params = {"org_id": org_id} if org_id.isdigit() else None
|
|
489
494
|
|
|
490
495
|
from ..platform.utils import _request
|
|
491
|
-
res = await _request("POST", path, files=files)
|
|
496
|
+
res = await _request("POST", path, params=params, files=files)
|
|
492
497
|
upload_response = UploadFileResponse.model_validate(res.json())
|
|
493
498
|
# The platform returns a fully percent-encoded URL — use it verbatim.
|
|
494
499
|
# Reconstructing it from `name` (raw, unencoded) breaks whenever the name
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|