langfun 0.1.2.dev202505120804__tar.gz → 0.1.2.dev202505140804__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.
Potentially problematic release.
This version of langfun might be problematic. Click here for more details.
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/PKG-INFO +1 -1
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action.py +172 -87
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_eval.py +4 -6
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/correction.py +4 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/console.py +6 -3
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/language_model.py +57 -5
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/gemini.py +7 -1
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/logging.py +3 -4
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/mapping.py +6 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/querying.py +324 -91
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/querying_test.py +242 -2
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema.py +8 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_generation.py +1 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_test.py +6 -3
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/PKG-INFO +1 -1
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/LICENSE +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/README.md +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_eval_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/correction_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/execution.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/execution_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/generation.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/generation_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/parsing.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/parsing_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/sandboxing.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/sandboxing_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/component.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/component_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/concurrent.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/concurrent_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/console_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/anthropic.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/anthropic_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/gemini.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/gemini_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/openai.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/openai_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/base.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/base_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/matching.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/matching_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/patching.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/patching_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/scoring.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/scoring_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/checkpointing.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/checkpointing_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/eval_test_helper.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/evaluation.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/evaluation_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/example.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/example_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/experiment.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/experiment_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metric_values.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metric_values_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metrics.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metrics_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_tracking.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/reporting.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/reporting_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/runners.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/runners_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/langfunc.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/langfunc_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/language_model_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/anthropic.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/anthropic_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/azure_openai.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/azure_openai_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/base.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/in_memory.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/in_memory_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/compositional.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/compositional_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/deepseek.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/deepseek_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/fake.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/fake_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/gemini_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/google_genai.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/google_genai_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/groq.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/groq_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/llama_cpp.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/llama_cpp_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_compatible.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_compatible_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/rest.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/rest_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/vertexai.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/vertexai_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/logging_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/conversation_history.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/conversation_history_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/memory.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/message.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/message_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/audio.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/audio_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/image.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/image_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/mime.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/mime_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/pdf.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/pdf_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/video.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/video_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modality.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/modality_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/natural_language.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/natural_language_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/sampling.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/sampling_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/completion.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/completion_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/description.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/description_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/function_generation.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/function_generation_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/mapping_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/parsing.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/parsing_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_generation_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/scoring.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/scoring_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/tokenization.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/tokenization_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/subscription.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/subscription_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/template.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/template_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/__init__.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/completion.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/completion_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/conversation.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/conversation_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/demonstration.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/demonstration_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/selfplay.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/selfplay_test.py +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/SOURCES.txt +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/dependency_links.txt +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/requires.txt +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/top_level.txt +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/setup.cfg +0 -0
- {langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/setup.py +0 -0
{langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action.py
RENAMED
@@ -209,7 +209,7 @@ class Action(pg.Object):
|
|
209
209
|
) -> Any:
|
210
210
|
"""Executes the action."""
|
211
211
|
if session is None:
|
212
|
-
session = Session()
|
212
|
+
session = Session(verbose=verbose)
|
213
213
|
session.start()
|
214
214
|
|
215
215
|
if show_progress:
|
@@ -220,45 +220,13 @@ class Action(pg.Object):
|
|
220
220
|
else:
|
221
221
|
self._session = None
|
222
222
|
|
223
|
-
with session.track_action(self)
|
224
|
-
if verbose:
|
225
|
-
session.info('Action execution started.', keep=False, action=self)
|
226
|
-
|
223
|
+
with session.track_action(self):
|
227
224
|
try:
|
228
|
-
result = self.call(session=session,
|
225
|
+
result = self.call(session=session, **kwargs)
|
229
226
|
self._invocation.end(result)
|
230
|
-
if verbose:
|
231
|
-
session.info(
|
232
|
-
(
|
233
|
-
f'Action execution succeeded in '
|
234
|
-
f'{self._invocation.execution.elapse:.2f} seconds.'
|
235
|
-
),
|
236
|
-
keep=False,
|
237
|
-
result=result
|
238
|
-
)
|
239
227
|
except BaseException as e:
|
240
228
|
error = pg.utils.ErrorInfo.from_exception(e)
|
241
229
|
self._invocation.end(result=None, error=error)
|
242
|
-
if invocation.parent_action is session.root:
|
243
|
-
session.error(
|
244
|
-
(
|
245
|
-
f'Top-level action execution failed in '
|
246
|
-
f'{self._invocation.execution.elapse:.2f} seconds.'
|
247
|
-
),
|
248
|
-
keep=True,
|
249
|
-
action=self,
|
250
|
-
error=error
|
251
|
-
)
|
252
|
-
else:
|
253
|
-
session.warning(
|
254
|
-
(
|
255
|
-
f'Action execution failed in '
|
256
|
-
f'{self._invocation.execution.elapse:.2f} seconds.'
|
257
|
-
),
|
258
|
-
keep=False,
|
259
|
-
action=self,
|
260
|
-
error=error
|
261
|
-
)
|
262
230
|
if self._session is not None:
|
263
231
|
self._session.end(result=None, error=error)
|
264
232
|
raise
|
@@ -477,21 +445,26 @@ class ExecutionTrace(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
477
445
|
def __getitem__(self, index: int) -> TracedItem:
|
478
446
|
return self.items[index]
|
479
447
|
|
448
|
+
def merge_usage_summary(self, usage_summary: lf.UsageSummary) -> None:
|
449
|
+
if usage_summary.total.num_requests == 0:
|
450
|
+
return
|
451
|
+
current_invocation = self
|
452
|
+
while current_invocation is not None:
|
453
|
+
current_invocation.usage_summary.merge(usage_summary)
|
454
|
+
current_invocation = typing.cast(
|
455
|
+
ExecutionTrace,
|
456
|
+
current_invocation.sym_ancestor(
|
457
|
+
lambda x: isinstance(x, ExecutionTrace)
|
458
|
+
)
|
459
|
+
)
|
460
|
+
|
480
461
|
def append(self, item: TracedItem) -> None:
|
481
462
|
"""Appends an item to the sequence."""
|
482
463
|
with pg.notify_on_change(False):
|
483
464
|
self.items.append(item)
|
484
465
|
|
485
466
|
if isinstance(item, lf_structured.QueryInvocation):
|
486
|
-
|
487
|
-
while current_invocation is not None:
|
488
|
-
current_invocation.usage_summary.merge(item.usage_summary)
|
489
|
-
current_invocation = typing.cast(
|
490
|
-
ExecutionTrace,
|
491
|
-
current_invocation.sym_ancestor(
|
492
|
-
lambda x: isinstance(x, ExecutionTrace)
|
493
|
-
)
|
494
|
-
)
|
467
|
+
self.merge_usage_summary(item.usage_summary)
|
495
468
|
|
496
469
|
if self._tab_control is not None:
|
497
470
|
self._tab_control.append(self._execution_item_tab(item))
|
@@ -519,15 +492,46 @@ class ExecutionTrace(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
519
492
|
def execution_summary(self) -> dict[str, Any]:
|
520
493
|
"""Execution summary string."""
|
521
494
|
return pg.Dict(
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
495
|
+
subtree=dict(
|
496
|
+
num_actions=len(self.all_actions),
|
497
|
+
num_action_failures=len([
|
498
|
+
a for a in self.all_actions if a.has_error
|
499
|
+
]),
|
500
|
+
num_queries=len(self.all_queries),
|
501
|
+
num_oop_failures=len([
|
502
|
+
q for q in self.all_queries if q.has_oop_error
|
503
|
+
]),
|
504
|
+
num_non_oop_failures=len([
|
505
|
+
q for q in self.all_queries
|
506
|
+
if q.has_error and not q.has_oop_error
|
507
|
+
]),
|
508
|
+
total_query_time=sum(q.elapse for q in self.all_queries),
|
509
|
+
),
|
510
|
+
current_level=dict(
|
511
|
+
num_actions=len(self.actions),
|
512
|
+
num_action_failures=len([
|
513
|
+
a for a in self.actions if a.has_error
|
514
|
+
]),
|
515
|
+
num_queries=len(self.queries),
|
516
|
+
num_oop_failures=len([
|
517
|
+
q for q in self.queries if q.has_oop_error
|
518
|
+
]),
|
519
|
+
num_non_oop_failures=len([
|
520
|
+
q for q in self.queries
|
521
|
+
if q.has_error and not q.has_oop_error
|
522
|
+
]),
|
523
|
+
execution_breakdown=[
|
524
|
+
dict(
|
525
|
+
action=action.action.__class__.__name__,
|
526
|
+
usage=dict(
|
527
|
+
total_tokens=action.usage_summary.total.total_tokens,
|
528
|
+
estimated_cost=action.usage_summary.total.estimated_cost,
|
529
|
+
),
|
530
|
+
execution_time=action.execution.elapse,
|
531
|
+
)
|
532
|
+
for action in self.actions
|
533
|
+
]
|
534
|
+
)
|
531
535
|
)
|
532
536
|
|
533
537
|
#
|
@@ -1025,9 +1029,6 @@ class ActionInvocation(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
1025
1029
|
self.usage_summary.to_html( # pylint: disable=g-long-ternary
|
1026
1030
|
extra_flags=dict(as_badge=True)
|
1027
1031
|
)
|
1028
|
-
if (interactive
|
1029
|
-
or self.usage_summary.total.num_requests > 0)
|
1030
|
-
else None
|
1031
1032
|
),
|
1032
1033
|
],
|
1033
1034
|
css_classes=['execution-tab-title']
|
@@ -1069,12 +1070,24 @@ class RootAction(Action):
|
|
1069
1070
|
class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
1070
1071
|
"""Session for performing an agentic task."""
|
1071
1072
|
|
1072
|
-
root:
|
1073
|
+
root: Annotated[
|
1074
|
+
ActionInvocation,
|
1075
|
+
'The root action invocation of the session.'
|
1076
|
+
] = ActionInvocation(RootAction())
|
1077
|
+
|
1073
1078
|
id: Annotated[
|
1074
1079
|
str | None,
|
1075
1080
|
'An optional identifier for the sessin, which will be used for logging.'
|
1076
1081
|
] = None
|
1077
1082
|
|
1083
|
+
verbose: Annotated[
|
1084
|
+
bool,
|
1085
|
+
(
|
1086
|
+
'If True, the session will be logged with verbose action and query '
|
1087
|
+
'activities.'
|
1088
|
+
)
|
1089
|
+
] = False
|
1090
|
+
|
1078
1091
|
# NOTE(daiyip): Action execution may involve multi-threading, hence current
|
1079
1092
|
# action and execution are thread-local.
|
1080
1093
|
|
@@ -1169,8 +1182,45 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
1169
1182
|
self._current_execution = invocation.execution
|
1170
1183
|
# Start the execution of the current action.
|
1171
1184
|
self._current_action.start()
|
1185
|
+
if self.verbose:
|
1186
|
+
self.info(
|
1187
|
+
'Action execution started.',
|
1188
|
+
action=invocation.action,
|
1189
|
+
keep=False,
|
1190
|
+
)
|
1172
1191
|
yield invocation
|
1173
1192
|
finally:
|
1193
|
+
if invocation.has_error:
|
1194
|
+
if invocation.parent_action is self.root:
|
1195
|
+
self.error(
|
1196
|
+
(
|
1197
|
+
f'Top-level action execution failed in '
|
1198
|
+
f'{invocation.execution.elapse:.2f} seconds.'
|
1199
|
+
),
|
1200
|
+
action=invocation.action,
|
1201
|
+
error=invocation.error,
|
1202
|
+
keep=True,
|
1203
|
+
)
|
1204
|
+
else:
|
1205
|
+
self.warning(
|
1206
|
+
(
|
1207
|
+
f'Action execution failed in '
|
1208
|
+
f'{invocation.execution.elapse:.2f} seconds.'
|
1209
|
+
),
|
1210
|
+
action=invocation.action,
|
1211
|
+
error=invocation.error,
|
1212
|
+
keep=True,
|
1213
|
+
)
|
1214
|
+
elif self.verbose:
|
1215
|
+
self.info(
|
1216
|
+
(
|
1217
|
+
f'Action execution succeeded in '
|
1218
|
+
f'{invocation.execution.elapse:.2f} seconds.'
|
1219
|
+
),
|
1220
|
+
action=invocation.action,
|
1221
|
+
result=invocation.result,
|
1222
|
+
keep=False,
|
1223
|
+
)
|
1174
1224
|
self._current_execution = parent_execution
|
1175
1225
|
self._current_action = parent_action
|
1176
1226
|
|
@@ -1208,18 +1258,63 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
1208
1258
|
A list of `lf.QueryInvocation` objects, each for a single `lf.query`
|
1209
1259
|
call.
|
1210
1260
|
"""
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1261
|
+
def _query_start(invocation: lf_structured.QueryInvocation):
|
1262
|
+
execution = self._current_execution
|
1263
|
+
invocation.rebind(
|
1264
|
+
id=f'{execution.id}/q{len(execution.queries) + 1}',
|
1265
|
+
skip_notification=False, raise_on_no_change=False
|
1266
|
+
)
|
1267
|
+
execution.append(invocation)
|
1268
|
+
if self.verbose:
|
1269
|
+
self.info(
|
1270
|
+
'Querying LLM started.',
|
1271
|
+
lm=invocation.lm.model_id,
|
1272
|
+
output_type=(
|
1273
|
+
lf_structured.annotation(invocation.schema.spec)
|
1274
|
+
if invocation.schema is not None else None
|
1275
|
+
),
|
1276
|
+
keep=False,
|
1277
|
+
)
|
1278
|
+
|
1279
|
+
def _query_end(invocation: lf_structured.QueryInvocation):
|
1280
|
+
self._current_execution.merge_usage_summary(invocation.usage_summary)
|
1281
|
+
if invocation.has_error:
|
1282
|
+
self.warning(
|
1283
|
+
(
|
1284
|
+
f'Querying LLM failed in '
|
1285
|
+
f'{time.time() - invocation.start_time:.2f} seconds.'
|
1286
|
+
),
|
1287
|
+
lm=invocation.lm.model_id,
|
1288
|
+
output_type=(
|
1289
|
+
lf_structured.annotation(invocation.schema.spec)
|
1290
|
+
if invocation.schema is not None else None
|
1291
|
+
),
|
1292
|
+
error=invocation.error,
|
1293
|
+
keep=True,
|
1294
|
+
)
|
1295
|
+
elif self.verbose:
|
1296
|
+
self.info(
|
1297
|
+
(
|
1298
|
+
f'Querying LLM succeeded in '
|
1299
|
+
f'{time.time() - invocation.start_time:.2f} seconds.'
|
1300
|
+
),
|
1301
|
+
lm=invocation.lm.model_id,
|
1302
|
+
output_type=(
|
1303
|
+
lf_structured.annotation(invocation.schema.spec)
|
1304
|
+
if invocation.schema is not None else None
|
1305
|
+
),
|
1306
|
+
keep=False,
|
1307
|
+
)
|
1308
|
+
|
1309
|
+
with self.track_phase(phase), lf_structured.track_queries(
|
1310
|
+
include_child_scopes=False,
|
1311
|
+
start_callabck=_query_start,
|
1312
|
+
end_callabck=_query_end,
|
1313
|
+
) as queries:
|
1314
|
+
try:
|
1315
|
+
yield queries
|
1316
|
+
finally:
|
1317
|
+
pass
|
1223
1318
|
|
1224
1319
|
#
|
1225
1320
|
# Operations with activity tracking.
|
@@ -1272,24 +1367,14 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
1272
1367
|
The result of the query.
|
1273
1368
|
"""
|
1274
1369
|
with self.track_queries():
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
**kwargs
|
1284
|
-
)
|
1285
|
-
except BaseException as e:
|
1286
|
-
elapse = time.time() - start_time
|
1287
|
-
self.warning(
|
1288
|
-
f'Failed to query LLM ({lm.model_id}) in {elapse:.2f} seconds.',
|
1289
|
-
error=pg.utils.ErrorInfo.from_exception(e),
|
1290
|
-
keep=False,
|
1291
|
-
)
|
1292
|
-
raise
|
1370
|
+
return lf_structured.query(
|
1371
|
+
prompt,
|
1372
|
+
schema=schema,
|
1373
|
+
default=default,
|
1374
|
+
lm=lm,
|
1375
|
+
examples=examples,
|
1376
|
+
**kwargs
|
1377
|
+
)
|
1293
1378
|
|
1294
1379
|
def concurrent_map(
|
1295
1380
|
self,
|
{langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_eval.py
RENAMED
@@ -36,17 +36,15 @@ class ActionEval(lf.eval.v2.Evaluation):
|
|
36
36
|
action = example_input.action
|
37
37
|
|
38
38
|
# We explicitly create a session here to use a custom session ID.
|
39
|
-
with action_lib.Session(
|
39
|
+
with action_lib.Session(
|
40
|
+
id=f'{self.id}#example-{example.id}', verbose=True
|
41
|
+
) as session:
|
40
42
|
|
41
43
|
# NOTE(daiyip): Setting session as metadata before action execution, so we
|
42
44
|
# could use `Evaluation.state.in_progress_examples` to access the session
|
43
45
|
# for status reporting from other threads.
|
44
46
|
example.metadata['session'] = session
|
45
|
-
|
46
|
-
with lf.logging.use_log_level('fatal'):
|
47
|
-
kwargs = self.action_args.copy()
|
48
|
-
kwargs.update(verbose=True)
|
49
|
-
action(session=session, **kwargs)
|
47
|
+
action(session=session, **self.action_args)
|
50
48
|
|
51
49
|
return session.final_result, dict(session=session)
|
52
50
|
|
@@ -37,6 +37,7 @@ def run_with_correction(
|
|
37
37
|
lm: lf.LanguageModel | None = None,
|
38
38
|
max_attempts: int = 5,
|
39
39
|
sandbox: bool | None = None,
|
40
|
+
permission: pg.coding.CodePermission = pg.coding.CodePermission.ALL,
|
40
41
|
timeout: int | None = 5,
|
41
42
|
returns_code: bool = False,
|
42
43
|
returns_stdout: bool = False,
|
@@ -58,6 +59,7 @@ def run_with_correction(
|
|
58
59
|
process. If None, run in sandbox first, if the output could not be
|
59
60
|
serialized and pass to current process, run the code again in current
|
60
61
|
process.
|
62
|
+
permission: The permission to run the code.
|
61
63
|
timeout: The timeout for running the corrected code. If None, there is no
|
62
64
|
timeout. Applicable only when sandbox is set to True.
|
63
65
|
returns_code: If True, the return value is a tuple of (result, final code).
|
@@ -88,6 +90,7 @@ def run_with_correction(
|
|
88
90
|
global_vars=global_vars,
|
89
91
|
sandbox=sandbox,
|
90
92
|
timeout=timeout,
|
93
|
+
permission=permission,
|
91
94
|
returns_stdout=returns_stdout,
|
92
95
|
outputs_intermediate=outputs_intermediate,
|
93
96
|
)
|
@@ -102,6 +105,7 @@ def run_with_correction(
|
|
102
105
|
global_vars=global_vars,
|
103
106
|
sandbox=sandbox,
|
104
107
|
timeout=timeout,
|
108
|
+
permission=permission,
|
105
109
|
outputs_intermediate=outputs_intermediate,
|
106
110
|
)
|
107
111
|
)
|
@@ -52,10 +52,13 @@ def write(
|
|
52
52
|
)
|
53
53
|
|
54
54
|
|
55
|
+
_notebook = None
|
55
56
|
try:
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
ipython_module = sys.modules['IPython']
|
58
|
+
if 'IPKernelApp' in ipython_module.get_ipython().config:
|
59
|
+
_notebook = ipython_module.display
|
60
|
+
except (KeyError, AttributeError): # pylint: disable=broad-except
|
61
|
+
pass
|
59
62
|
|
60
63
|
|
61
64
|
def under_notebook() -> bool:
|
{langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/language_model.py
RENAMED
@@ -1019,11 +1019,21 @@ class LanguageModel(component.Component):
|
|
1019
1019
|
] = RetryableLMError,
|
1020
1020
|
) -> list[Any]:
|
1021
1021
|
"""Helper method for subclasses for implementing _sample."""
|
1022
|
+
if self.max_concurrency is None:
|
1023
|
+
execute = action
|
1024
|
+
executor = None
|
1025
|
+
max_workers = len(inputs)
|
1026
|
+
else:
|
1027
|
+
execute = lambda x: _ConcurrencyControl.get(
|
1028
|
+
self.resource_id, self.max_concurrency)(action, x)
|
1029
|
+
executor = self.resource_id if len(inputs) > 1 else None
|
1030
|
+
max_workers = self.max_concurrency
|
1031
|
+
|
1022
1032
|
executed_jobs = concurrent.concurrent_execute(
|
1023
|
-
|
1033
|
+
execute,
|
1024
1034
|
inputs,
|
1025
|
-
executor=
|
1026
|
-
max_workers=
|
1035
|
+
executor=executor,
|
1036
|
+
max_workers=max_workers,
|
1027
1037
|
retry_on_errors=retry_on_errors,
|
1028
1038
|
max_attempts=self.max_attempts,
|
1029
1039
|
retry_interval=self.retry_interval,
|
@@ -1323,6 +1333,46 @@ class LanguageModel(component.Component):
|
|
1323
1333
|
return None
|
1324
1334
|
|
1325
1335
|
|
1336
|
+
class _ConcurrencyControl:
|
1337
|
+
"""Controls the max concurrent LLM calls for a given model."""
|
1338
|
+
|
1339
|
+
_MODEL_CONCURRENCY: ClassVar[dict[str, '_ConcurrencyControl']] = {}
|
1340
|
+
|
1341
|
+
def __init__(self, max_concurrency: int):
|
1342
|
+
self.max_concurrency = max_concurrency
|
1343
|
+
self._concurrency = 0
|
1344
|
+
|
1345
|
+
@property
|
1346
|
+
def concurrency(self) -> int:
|
1347
|
+
"""Returns the current concurrency."""
|
1348
|
+
return self._concurrency
|
1349
|
+
|
1350
|
+
def __call__(self, fn: Callable[..., Any], *args, **kwargs):
|
1351
|
+
"""Calls the function with concurrency control."""
|
1352
|
+
while self._concurrency >= self.max_concurrency:
|
1353
|
+
time.sleep(0.01)
|
1354
|
+
|
1355
|
+
try:
|
1356
|
+
# Increment/decrement is atomic in Python, so we don't need to protect it
|
1357
|
+
# with a lock.
|
1358
|
+
self._concurrency += 1
|
1359
|
+
return fn(*args, **kwargs)
|
1360
|
+
finally:
|
1361
|
+
self._concurrency -= 1
|
1362
|
+
|
1363
|
+
@classmethod
|
1364
|
+
def get(
|
1365
|
+
cls, model_id: str, max_concurrency: int | None = None
|
1366
|
+
) -> '_ConcurrencyControl':
|
1367
|
+
"""Returns the concurrency control for the given model ID."""
|
1368
|
+
control = cls._MODEL_CONCURRENCY.get(model_id, None)
|
1369
|
+
if control is None:
|
1370
|
+
assert max_concurrency is not None
|
1371
|
+
control = cls(max_concurrency)
|
1372
|
+
cls._MODEL_CONCURRENCY[model_id] = control
|
1373
|
+
return control
|
1374
|
+
|
1375
|
+
|
1326
1376
|
class UsageSummary(pg.Object, pg.views.HtmlTreeView.Extension):
|
1327
1377
|
"""Usage sumary."""
|
1328
1378
|
|
@@ -1403,7 +1453,8 @@ class UsageSummary(pg.Object, pg.views.HtmlTreeView.Extension):
|
|
1403
1453
|
self._usage_badge.update(
|
1404
1454
|
self._badge_text(),
|
1405
1455
|
tooltip=pg.format(
|
1406
|
-
self, verbose=False, custom_format=self._tooltip_format
|
1456
|
+
self, verbose=False, custom_format=self._tooltip_format,
|
1457
|
+
hide_default_values=True,
|
1407
1458
|
),
|
1408
1459
|
styles=dict(color=self._badge_color()),
|
1409
1460
|
)
|
@@ -1450,7 +1501,8 @@ class UsageSummary(pg.Object, pg.views.HtmlTreeView.Extension):
|
|
1450
1501
|
usage_badge = pg.views.html.controls.Badge(
|
1451
1502
|
self._badge_text(),
|
1452
1503
|
tooltip=pg.format(
|
1453
|
-
self, custom_format=self._tooltip_format, verbose=False
|
1504
|
+
self, custom_format=self._tooltip_format, verbose=False,
|
1505
|
+
hide_default_values=True,
|
1454
1506
|
),
|
1455
1507
|
css_classes=['usage-summary'],
|
1456
1508
|
styles=dict(color=self._badge_color()),
|
@@ -678,9 +678,15 @@ class Gemini(rest.REST):
|
|
678
678
|
return config
|
679
679
|
|
680
680
|
def result(self, json: dict[str, Any]) -> lf.LMSamplingResult:
|
681
|
+
candidates = json.get('candidates')
|
682
|
+
if candidates is None:
|
683
|
+
raise lf.TemporaryLMError(
|
684
|
+
'No candidates found in response. This is a Gemini API issue that '
|
685
|
+
'happens occasionally, and retrying should fix it. '
|
686
|
+
)
|
681
687
|
messages = [
|
682
688
|
lf.Message.from_value(candidate['content'], format='gemini')
|
683
|
-
for candidate in
|
689
|
+
for candidate in candidates
|
684
690
|
]
|
685
691
|
usage = json['usageMetadata']
|
686
692
|
input_tokens = usage['promptTokenCount']
|
@@ -268,14 +268,13 @@ def log(level: LogLevel,
|
|
268
268
|
metadata=kwargs,
|
269
269
|
)
|
270
270
|
|
271
|
-
if entry.should_output(get_log_level()):
|
271
|
+
if console and entry.should_output(get_log_level()):
|
272
272
|
if console_lib.under_notebook():
|
273
273
|
console_lib.display(entry)
|
274
|
-
|
274
|
+
else:
|
275
275
|
# TODO(daiyip): Improve the console output formatting.
|
276
276
|
console_lib.write(entry)
|
277
|
-
|
278
|
-
if not console:
|
277
|
+
elif not console:
|
279
278
|
if kwargs:
|
280
279
|
message = f'{message} (metadata: {pg.format(kwargs)})'
|
281
280
|
system_log_func(level)(message)
|
{langfun-0.1.2.dev202505120804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/mapping.py
RENAMED
@@ -278,6 +278,11 @@ class Mapping(lf.LangFunc):
|
|
278
278
|
'A `lf.structured.Schema` object that constrains mapping output ',
|
279
279
|
] = None
|
280
280
|
|
281
|
+
permission: Annotated[
|
282
|
+
pg.coding.CodePermission,
|
283
|
+
'The permission to run the LLM generated code.'
|
284
|
+
] = pg.coding.CodePermission.ASSIGN | pg.coding.CodePermission.CALL
|
285
|
+
|
281
286
|
@property
|
282
287
|
def mapping_request(self) -> MappingExample:
|
283
288
|
"""Returns a MappingExample as the mapping request."""
|
@@ -434,6 +439,7 @@ class Mapping(lf.LangFunc):
|
|
434
439
|
additional_context=self.globals(),
|
435
440
|
autofix=self.autofix,
|
436
441
|
autofix_lm=self.autofix_lm or self.lm,
|
442
|
+
permission=self.permission,
|
437
443
|
)
|
438
444
|
|
439
445
|
def postprocess_response(self, response: lf.Message) -> lf.Message:
|