langfun 0.1.2.dev202504240804__tar.gz → 0.1.2.dev202504260803__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.
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/PKG-INFO +1 -1
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action.py +41 -20
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action_test.py +4 -2
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/evaluation.py +36 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/runners.py +5 -4
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/rest.py +3 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/logging.py +69 -16
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/logging_test.py +9 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/message.py +5 -2
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/message_test.py +9 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/querying.py +16 -2
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/querying_test.py +3 -1
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/schema_test.py +0 -1
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/template_test.py +3 -3
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/PKG-INFO +1 -1
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/LICENSE +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/README.md +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action_eval.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action_eval_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/correction.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/correction_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/execution.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/execution_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/generation.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/generation_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/parsing.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/parsing_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/sandboxing.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/python/sandboxing_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/component.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/component_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/concurrent.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/concurrent_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/console.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/console_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/anthropic.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/anthropic_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/gemini.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/gemini_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/openai.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/conversion/openai_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/base.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/base_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/matching.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/matching_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/patching.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/patching_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/scoring.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/scoring_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/checkpointing.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/checkpointing_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/eval_test_helper.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/evaluation_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/example.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/example_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/experiment.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/experiment_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metric_values.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metric_values_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metrics.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metrics_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/progress.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/progress_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/progress_tracking.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/reporting.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/reporting_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/runners_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/langfunc.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/langfunc_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/language_model.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/language_model_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/anthropic.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/anthropic_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/azure_openai.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/azure_openai_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/base.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/in_memory.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/in_memory_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/compositional.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/compositional_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/deepseek.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/deepseek_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/fake.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/fake_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/gemini.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/gemini_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/google_genai.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/google_genai_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/groq.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/groq_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/llama_cpp.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/llama_cpp_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/openai.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/openai_compatible.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/openai_compatible_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/openai_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/rest_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/vertexai.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/vertexai_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/memories/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/memories/conversation_history.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/memories/conversation_history_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/memory.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/audio.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/audio_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/image.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/image_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/mime.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/mime_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/pdf.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/pdf_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/video.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/video_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modality.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modality_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/natural_language.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/natural_language_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/sampling.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/sampling_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/completion.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/completion_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/description.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/description_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/function_generation.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/function_generation_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/mapping.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/mapping_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/parsing.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/parsing_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/schema.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/schema_generation.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/schema_generation_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/scoring.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/scoring_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/tokenization.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/tokenization_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/subscription.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/subscription_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/template.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/__init__.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/completion.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/completion_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/conversation.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/conversation_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/demonstration.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/demonstration_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/selfplay.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/selfplay_test.py +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/SOURCES.txt +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/dependency_links.txt +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/requires.txt +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/top_level.txt +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/setup.cfg +0 -0
- {langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/setup.py +0 -0
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action.py
RENAMED
@@ -15,11 +15,11 @@
|
|
15
15
|
|
16
16
|
import abc
|
17
17
|
import contextlib
|
18
|
-
import datetime
|
19
18
|
import threading
|
20
19
|
import time
|
21
20
|
import typing
|
22
21
|
from typing import Annotated, Any, Callable, Iterable, Iterator, Optional, Type, Union
|
22
|
+
import uuid
|
23
23
|
import langfun.core as lf
|
24
24
|
from langfun.core import structured as lf_structured
|
25
25
|
import pyglove as pg
|
@@ -54,7 +54,9 @@ class Action(pg.Object):
|
|
54
54
|
session: Optional['Session'] = None,
|
55
55
|
*,
|
56
56
|
show_progress: bool = True,
|
57
|
-
|
57
|
+
verbose: bool = False,
|
58
|
+
**kwargs
|
59
|
+
) -> Any:
|
58
60
|
"""Executes the action."""
|
59
61
|
new_session = session is None
|
60
62
|
if new_session:
|
@@ -63,7 +65,17 @@ class Action(pg.Object):
|
|
63
65
|
lf.console.display(pg.view(session, name='agent_session'))
|
64
66
|
|
65
67
|
with session.track_action(self):
|
66
|
-
|
68
|
+
if verbose:
|
69
|
+
session.info(f'Executing action {self!r}...', keep=False)
|
70
|
+
|
71
|
+
result = self.call(session=session, verbose=verbose, **kwargs)
|
72
|
+
|
73
|
+
if verbose:
|
74
|
+
session.info(
|
75
|
+
f'Action {self.__class__.__name__} completed successfully.',
|
76
|
+
keep=False,
|
77
|
+
result=result
|
78
|
+
)
|
67
79
|
|
68
80
|
# For the top-level action, we store the session in the metadata.
|
69
81
|
if new_session:
|
@@ -792,6 +804,11 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
792
804
|
self._tls = threading.local()
|
793
805
|
self._current_action = self.root
|
794
806
|
self._current_execution = self.root.execution
|
807
|
+
if self.id is None:
|
808
|
+
self.rebind(
|
809
|
+
id=f'session@{uuid.uuid4().hex[-7:]}',
|
810
|
+
skip_notification=True
|
811
|
+
)
|
795
812
|
|
796
813
|
#
|
797
814
|
# Context-manager for information tracking.
|
@@ -1044,35 +1061,39 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
1044
1061
|
with self.track_queries():
|
1045
1062
|
return lf_structured.query_output(response, schema=schema, **kwargs)
|
1046
1063
|
|
1047
|
-
def _log(
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1064
|
+
def _log(
|
1065
|
+
self,
|
1066
|
+
level: lf.logging.LogLevel,
|
1067
|
+
message: str,
|
1068
|
+
keep: bool,
|
1069
|
+
**kwargs
|
1070
|
+
) -> None:
|
1071
|
+
"""Logs a message to the session."""
|
1072
|
+
log_entry = lf.logging.log(
|
1073
|
+
level, f'[{self.id}]: {message}]', **kwargs
|
1055
1074
|
)
|
1075
|
+
if keep:
|
1076
|
+
self._current_execution.append(log_entry)
|
1056
1077
|
|
1057
|
-
def debug(self, message: str, **kwargs):
|
1078
|
+
def debug(self, message: str, keep: bool = True, **kwargs):
|
1058
1079
|
"""Logs a debug message to the session."""
|
1059
|
-
self._log('debug', message, **kwargs)
|
1080
|
+
self._log('debug', message, keep=keep, **kwargs)
|
1060
1081
|
|
1061
|
-
def info(self, message: str, **kwargs):
|
1082
|
+
def info(self, message: str, keep: bool = True, **kwargs):
|
1062
1083
|
"""Logs an info message to the session."""
|
1063
|
-
self._log('info', message, **kwargs)
|
1084
|
+
self._log('info', message, keep=keep, **kwargs)
|
1064
1085
|
|
1065
|
-
def warning(self, message: str, **kwargs):
|
1086
|
+
def warning(self, message: str, keep: bool = True, **kwargs):
|
1066
1087
|
"""Logs a warning message to the session."""
|
1067
|
-
self._log('warning', message, **kwargs)
|
1088
|
+
self._log('warning', message, keep=keep, **kwargs)
|
1068
1089
|
|
1069
|
-
def error(self, message: str, **kwargs):
|
1090
|
+
def error(self, message: str, keep: bool = True, **kwargs):
|
1070
1091
|
"""Logs an error message to the session."""
|
1071
|
-
self._log('error', message, **kwargs)
|
1092
|
+
self._log('error', message, keep=keep, **kwargs)
|
1072
1093
|
|
1073
1094
|
def fatal(self, message: str, **kwargs):
|
1074
1095
|
"""Logs a fatal message to the session."""
|
1075
|
-
self._log('fatal', message, **kwargs)
|
1096
|
+
self._log('fatal', message, keep=True, **kwargs)
|
1076
1097
|
|
1077
1098
|
def as_message(self) -> lf.AIMessage:
|
1078
1099
|
"""Returns the session as a message."""
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action_test.py
RENAMED
@@ -65,9 +65,10 @@ class SessionTest(unittest.TestCase):
|
|
65
65
|
|
66
66
|
lm = fake.StaticResponse('lm response')
|
67
67
|
foo = Foo(1)
|
68
|
-
self.assertEqual(foo(lm=lm), 3)
|
68
|
+
self.assertEqual(foo(lm=lm, verbose=True), 3)
|
69
69
|
|
70
70
|
session = foo.session
|
71
|
+
self.assertIn('session@', session.id)
|
71
72
|
self.assertIsNotNone(session)
|
72
73
|
self.assertIsInstance(session.root.action, action_lib.RootAction)
|
73
74
|
self.assertIs(session.current_action, session.root)
|
@@ -152,7 +153,8 @@ class SessionTest(unittest.TestCase):
|
|
152
153
|
session.fatal('hi', x=1, y=2)
|
153
154
|
|
154
155
|
def test_as_message(self):
|
155
|
-
session = action_lib.Session()
|
156
|
+
session = action_lib.Session(id='abc')
|
157
|
+
self.assertEqual(session.id, 'abc')
|
156
158
|
self.assertIsInstance(session.as_message(), lf.AIMessage)
|
157
159
|
|
158
160
|
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/evaluation.py
RENAMED
@@ -169,9 +169,23 @@ class Evaluation(experiment_lib.Experiment):
|
|
169
169
|
checkpointed = self._state.ckpt_example(example.id)
|
170
170
|
with pg.timeit('evaluate') as timeit, lf.track_usages() as usage_summary:
|
171
171
|
if checkpointed is None or checkpointed.has_error:
|
172
|
+
if checkpointed is None:
|
173
|
+
self.info(
|
174
|
+
f'Example {example.id} is being processed for the first time '
|
175
|
+
'as no prior run is found. '
|
176
|
+
)
|
177
|
+
else:
|
178
|
+
self.info(
|
179
|
+
f'Example {example.id} is being reprocessed as prior run '
|
180
|
+
f'contains error: {checkpointed.error}'
|
181
|
+
)
|
172
182
|
example.start_time = time.time()
|
173
183
|
self._process(example, raise_if_has_error=raise_if_has_error)
|
174
184
|
else:
|
185
|
+
self.info(
|
186
|
+
f'Example {example.id} skipped processing as prior run '
|
187
|
+
'is available and error free.'
|
188
|
+
)
|
175
189
|
example.start_time = checkpointed.start_time
|
176
190
|
|
177
191
|
# Use the output and metadata obtained from the previous processing.
|
@@ -190,10 +204,12 @@ class Evaluation(experiment_lib.Experiment):
|
|
190
204
|
# NOTE(daiyip): It's possible that metrics could use LLMs, so we need to
|
191
205
|
# track the usage of the metrics separately.
|
192
206
|
with pg.timeit('metric'):
|
207
|
+
self.info(f'Starting metric computation for example {example.id}.')
|
193
208
|
metric_metadata = {}
|
194
209
|
for metric in self.metrics:
|
195
210
|
metric_metadata.update(metric.audit(example))
|
196
211
|
example.metric_metadata = metric_metadata
|
212
|
+
self.info(f'Completed metric computation for example {example.id}.')
|
197
213
|
|
198
214
|
# For previously processed examples, we keep the execution status for the
|
199
215
|
# processing step.
|
@@ -315,6 +331,26 @@ class Evaluation(experiment_lib.Experiment):
|
|
315
331
|
with self._log_lock:
|
316
332
|
self._log_entries.append(log_entry)
|
317
333
|
|
334
|
+
# Also add system log.
|
335
|
+
match level:
|
336
|
+
case 'debug':
|
337
|
+
sys_log_func = pg.logging.debug
|
338
|
+
case 'info':
|
339
|
+
sys_log_func = pg.logging.info
|
340
|
+
case 'warning':
|
341
|
+
sys_log_func = pg.logging.warning
|
342
|
+
case 'error':
|
343
|
+
sys_log_func = pg.logging.error
|
344
|
+
case 'fatal':
|
345
|
+
sys_log_func = pg.logging.error
|
346
|
+
case _:
|
347
|
+
raise ValueError(f'Unsupported log level: {level}')
|
348
|
+
|
349
|
+
sys_log_func(
|
350
|
+
'%s: %s\nMetadata: %s',
|
351
|
+
self.id, message, pg.format(kwargs)
|
352
|
+
)
|
353
|
+
|
318
354
|
def debug(self, message: str, **kwargs):
|
319
355
|
"""Logs a debug message to the session."""
|
320
356
|
self._log(pg.logging.debug, 'debug', message, **kwargs)
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/runners.py
RENAMED
@@ -249,22 +249,23 @@ class RunnerBase(Runner):
|
|
249
249
|
if example.error is None:
|
250
250
|
experiment.progress.increment_processed()
|
251
251
|
experiment.info(
|
252
|
-
f'Example {example.id} is successfully evaluated in '
|
253
|
-
f'{example.elapse:.2f} seconds.'
|
252
|
+
f'Example {example.id} is successfully evaluated (with process) in '
|
253
|
+
f'{example.elapse:.2f} seconds.'
|
254
254
|
)
|
255
255
|
else:
|
256
256
|
experiment.progress.increment_failed()
|
257
257
|
experiment.error(
|
258
258
|
(
|
259
259
|
f'Failed to evaluate example {example.id} in'
|
260
|
-
f'{example.elapse:.2f} seconds.'
|
260
|
+
f'{example.elapse:.2f} seconds.'
|
261
261
|
),
|
262
262
|
error=example.error
|
263
263
|
)
|
264
264
|
else:
|
265
265
|
experiment.progress.increment_skipped()
|
266
266
|
experiment.info(
|
267
|
-
f'
|
267
|
+
f'Example {example.id} is successfully evaluated (without reprocess) '
|
268
|
+
f'in {example.elapse:.2f} seconds.'
|
268
269
|
)
|
269
270
|
|
270
271
|
experiment.usage_summary.merge(example.usage_summary)
|
@@ -103,6 +103,8 @@ class REST(lf.LanguageModel):
|
|
103
103
|
error_message = str(e)
|
104
104
|
if 'REJECTED_CLIENT_THROTTLED' in error_message:
|
105
105
|
raise lf.TemporaryLMError(error_message) from e
|
106
|
+
if 'UNREACHABLE_ERROR' in error_message:
|
107
|
+
raise lf.TemporaryLMError(error_message) from e
|
106
108
|
raise lf.LMError(error_message) from e
|
107
109
|
|
108
110
|
def _error(self, status_code: int, content: str) -> lf.LMError:
|
@@ -113,6 +115,7 @@ class REST(lf.LanguageModel):
|
|
113
115
|
502, # Bad gateway (upstream issue, might retry).
|
114
116
|
503, # Servers currently under load, retry after a brief wait.
|
115
117
|
529, # Overloaded, retry after a brief wait.
|
118
|
+
499, # Client Closed Request
|
116
119
|
):
|
117
120
|
error_cls = lf.TemporaryLMError
|
118
121
|
else:
|
@@ -17,10 +17,10 @@ import contextlib
|
|
17
17
|
import datetime
|
18
18
|
import functools
|
19
19
|
import typing
|
20
|
-
from typing import Any, Iterator, Literal
|
20
|
+
from typing import Any, Callable, Iterator, Literal
|
21
21
|
|
22
22
|
from langfun.core import component
|
23
|
-
from langfun.core import console
|
23
|
+
from langfun.core import console as console_lib
|
24
24
|
import pyglove as pg
|
25
25
|
|
26
26
|
|
@@ -43,6 +43,22 @@ def get_log_level() -> LogLevel:
|
|
43
43
|
return component.context_value('__event_log_level__', 'info')
|
44
44
|
|
45
45
|
|
46
|
+
def system_log_func(level: LogLevel) -> Callable[..., None]:
|
47
|
+
match level:
|
48
|
+
case 'debug':
|
49
|
+
return pg.logging.debug
|
50
|
+
case 'info':
|
51
|
+
return pg.logging.info
|
52
|
+
case 'warning':
|
53
|
+
return pg.logging.warning
|
54
|
+
case 'error':
|
55
|
+
return pg.logging.error
|
56
|
+
case 'fatal':
|
57
|
+
return pg.logging.error
|
58
|
+
case _:
|
59
|
+
raise ValueError(f'Unsupported log level: {level}')
|
60
|
+
|
61
|
+
|
46
62
|
class LogEntry(pg.Object, pg.views.HtmlTreeView.Extension):
|
47
63
|
"""Event log entry."""
|
48
64
|
time: datetime.datetime
|
@@ -241,6 +257,7 @@ def log(level: LogLevel,
|
|
241
257
|
message: str,
|
242
258
|
*,
|
243
259
|
indent: int = 0,
|
260
|
+
console: bool = False,
|
244
261
|
**kwargs) -> LogEntry:
|
245
262
|
"""Logs a message."""
|
246
263
|
entry = LogEntry(
|
@@ -250,35 +267,71 @@ def log(level: LogLevel,
|
|
250
267
|
message=message,
|
251
268
|
metadata=kwargs,
|
252
269
|
)
|
270
|
+
|
253
271
|
if entry.should_output(get_log_level()):
|
254
|
-
if
|
255
|
-
|
256
|
-
|
272
|
+
if console_lib.under_notebook():
|
273
|
+
console_lib.display(entry)
|
274
|
+
elif console:
|
257
275
|
# TODO(daiyip): Improve the console output formatting.
|
258
|
-
|
276
|
+
console_lib.write(entry)
|
277
|
+
|
278
|
+
if not console:
|
279
|
+
if kwargs:
|
280
|
+
message = f'{message} (metadata: {pg.format(kwargs)})'
|
281
|
+
system_log_func(level)(message)
|
259
282
|
return entry
|
260
283
|
|
261
284
|
|
262
|
-
def debug(
|
285
|
+
def debug(
|
286
|
+
message: str,
|
287
|
+
*,
|
288
|
+
indent: int = 0,
|
289
|
+
console: bool = False,
|
290
|
+
**kwargs
|
291
|
+
) -> LogEntry:
|
263
292
|
"""Logs a debug message to the session."""
|
264
|
-
return log('debug', message, indent=indent, **kwargs)
|
293
|
+
return log('debug', message, indent=indent, console=console, **kwargs)
|
265
294
|
|
266
295
|
|
267
|
-
def info(
|
296
|
+
def info(
|
297
|
+
message: str,
|
298
|
+
*,
|
299
|
+
indent: int = 0,
|
300
|
+
console: bool = False,
|
301
|
+
**kwargs
|
302
|
+
) -> LogEntry:
|
268
303
|
"""Logs an info message to the session."""
|
269
|
-
return log('info', message, indent=indent, **kwargs)
|
304
|
+
return log('info', message, indent=indent, console=console, **kwargs)
|
270
305
|
|
271
306
|
|
272
|
-
def warning(
|
307
|
+
def warning(
|
308
|
+
message: str,
|
309
|
+
*,
|
310
|
+
indent: int = 0,
|
311
|
+
console: bool = False,
|
312
|
+
**kwargs
|
313
|
+
) -> LogEntry:
|
273
314
|
"""Logs an info message to the session."""
|
274
|
-
return log('warning', message, indent=indent, **kwargs)
|
315
|
+
return log('warning', message, indent=indent, console=console, **kwargs)
|
275
316
|
|
276
317
|
|
277
|
-
def error(
|
318
|
+
def error(
|
319
|
+
message: str,
|
320
|
+
*,
|
321
|
+
indent: int = 0,
|
322
|
+
console: bool = False,
|
323
|
+
**kwargs
|
324
|
+
) -> LogEntry:
|
278
325
|
"""Logs an error message to the session."""
|
279
|
-
return log('error', message, indent=indent, **kwargs)
|
326
|
+
return log('error', message, indent=indent, console=console, **kwargs)
|
280
327
|
|
281
328
|
|
282
|
-
def fatal(
|
329
|
+
def fatal(
|
330
|
+
message: str,
|
331
|
+
*,
|
332
|
+
indent: int = 0,
|
333
|
+
console: bool = False,
|
334
|
+
**kwargs
|
335
|
+
) -> LogEntry:
|
283
336
|
"""Logs a fatal message to the session."""
|
284
|
-
return log('fatal', message, indent=indent, **kwargs)
|
337
|
+
return log('fatal', message, indent=indent, console=console, **kwargs)
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/logging_test.py
RENAMED
@@ -13,8 +13,10 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
"""Tests for langfun.core.logging."""
|
15
15
|
|
16
|
+
import contextlib
|
16
17
|
import datetime
|
17
18
|
import inspect
|
19
|
+
import io
|
18
20
|
import unittest
|
19
21
|
|
20
22
|
from langfun.core import logging
|
@@ -44,6 +46,13 @@ class LoggingTest(unittest.TestCase):
|
|
44
46
|
self.assertEqual(logging.error('hi').level, 'error')
|
45
47
|
self.assertEqual(logging.fatal('hi').level, 'fatal')
|
46
48
|
|
49
|
+
def test_log_without_system_logging(self):
|
50
|
+
with contextlib.redirect_stdout(io.StringIO()) as stdout:
|
51
|
+
logging.log('info', 'hi', indent=1, x=1, y=2, console=True)
|
52
|
+
self.assertIn(
|
53
|
+
'hi (metadata: {x=1, y=2})', stdout.getvalue()
|
54
|
+
)
|
55
|
+
|
47
56
|
def test_repr_html(self):
|
48
57
|
def assert_color(entry, color):
|
49
58
|
self.assertIn(f'background-color: {color}', entry._repr_html_())
|
@@ -443,11 +443,14 @@ class Message(
|
|
443
443
|
metadata = dict()
|
444
444
|
last_char = None
|
445
445
|
for i, chunk in enumerate(chunks):
|
446
|
-
if i > 0 and last_char not in ('\t', ' ', '\n'):
|
446
|
+
if i > 0 and last_char not in ('\t', ' ', '\n', None):
|
447
447
|
fused_text.write(separator)
|
448
448
|
if isinstance(chunk, str):
|
449
449
|
fused_text.write(chunk)
|
450
|
-
|
450
|
+
if chunk:
|
451
|
+
last_char = chunk[-1]
|
452
|
+
else:
|
453
|
+
last_char = None
|
451
454
|
else:
|
452
455
|
assert isinstance(chunk, modality.Modality), chunk
|
453
456
|
var_name = f'obj{ref_index}'
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/message_test.py
RENAMED
@@ -476,6 +476,15 @@ class MessageTest(unittest.TestCase):
|
|
476
476
|
"""
|
477
477
|
)
|
478
478
|
|
479
|
+
def test_from_chunks_with_empty_str(self):
|
480
|
+
chunks = ['Hello', '', 'World']
|
481
|
+
msg = message.AIMessage.from_chunks(chunks)
|
482
|
+
self.assertEqual(msg.text, 'Hello World')
|
483
|
+
|
484
|
+
chunks = ['', 'hello']
|
485
|
+
msg = message.AIMessage.from_chunks(chunks)
|
486
|
+
self.assertEqual(msg.text, 'hello')
|
487
|
+
|
479
488
|
|
480
489
|
class MessageConverterTest(unittest.TestCase):
|
481
490
|
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/querying.py
RENAMED
@@ -17,6 +17,7 @@ import contextlib
|
|
17
17
|
import functools
|
18
18
|
import time
|
19
19
|
from typing import Annotated, Any, Callable, Iterator, Type, Union
|
20
|
+
import uuid
|
20
21
|
|
21
22
|
import langfun.core as lf
|
22
23
|
from langfun.core.structured import mapping
|
@@ -118,6 +119,7 @@ def query(
|
|
118
119
|
protocol: schema_lib.SchemaProtocol = 'python',
|
119
120
|
returns_message: bool = False,
|
120
121
|
skip_lm: bool = False,
|
122
|
+
invocation_id: str | None = None,
|
121
123
|
**kwargs,
|
122
124
|
) -> Any:
|
123
125
|
"""Query one or more language models for structured or unstructured outputs.
|
@@ -263,6 +265,9 @@ def query(
|
|
263
265
|
the final parsed result.
|
264
266
|
skip_lm: If `True`, skips the LLM call and returns the rendered
|
265
267
|
prompt as a `UserMessage` object.
|
268
|
+
invocation_id: The ID of the query invocation, which will be passed to
|
269
|
+
`lf.QueryInvocation` when `lf.trackIf `None`, a unique ID will
|
270
|
+
be generated.
|
266
271
|
**kwargs: Additional keyword arguments for:
|
267
272
|
- Rendering templates (e.g., `template_str`, `preamble`),
|
268
273
|
- Configuring `lf.structured.Mapping`.
|
@@ -275,11 +280,12 @@ def query(
|
|
275
280
|
"""
|
276
281
|
# Internal usage logging.
|
277
282
|
|
283
|
+
invocation_id = invocation_id or f'query@{uuid.uuid4().hex[-7:]}'
|
278
284
|
# Multiple quries will be issued when `lm` is a list or `num_samples` is
|
279
285
|
# greater than 1.
|
280
286
|
if isinstance(lm, list) or num_samples != 1:
|
281
287
|
def _single_query(inputs):
|
282
|
-
lm, example_i = inputs
|
288
|
+
i, (lm, example_i) = inputs
|
283
289
|
return query(
|
284
290
|
prompt,
|
285
291
|
schema,
|
@@ -298,6 +304,7 @@ def query(
|
|
298
304
|
protocol=protocol,
|
299
305
|
returns_message=returns_message,
|
300
306
|
skip_lm=skip_lm,
|
307
|
+
invocation_id=f'{invocation_id}:{i}',
|
301
308
|
**kwargs,
|
302
309
|
)
|
303
310
|
lm_list = lm if isinstance(lm, list) else [lm]
|
@@ -317,7 +324,8 @@ def query(
|
|
317
324
|
|
318
325
|
samples = []
|
319
326
|
for _, output, error in lf.concurrent_map(
|
320
|
-
_single_query, query_inputs
|
327
|
+
_single_query, enumerate(query_inputs),
|
328
|
+
max_workers=max(64, total_queries),
|
321
329
|
ordered=True,
|
322
330
|
):
|
323
331
|
if error is None:
|
@@ -409,6 +417,7 @@ def query(
|
|
409
417
|
metadata.pop('usage', None)
|
410
418
|
|
411
419
|
invocation = QueryInvocation(
|
420
|
+
id=invocation_id,
|
412
421
|
input=pg.Ref(query_input),
|
413
422
|
schema=(
|
414
423
|
schema_lib.Schema.from_value(schema)
|
@@ -565,6 +574,11 @@ def _reward_fn(cls) -> Callable[
|
|
565
574
|
class QueryInvocation(pg.Object, pg.views.HtmlTreeView.Extension):
|
566
575
|
"""A class to represent the invocation of `lf.query`."""
|
567
576
|
|
577
|
+
id: Annotated[
|
578
|
+
str,
|
579
|
+
'The ID of the query invocation.'
|
580
|
+
]
|
581
|
+
|
568
582
|
input: Annotated[
|
569
583
|
Union[lf.Template, pg.Symbolic],
|
570
584
|
'Mapping input of `lf.query`.'
|
@@ -1076,8 +1076,9 @@ class QueryInvocationTest(unittest.TestCase):
|
|
1076
1076
|
'Activity(description="hi"',
|
1077
1077
|
])
|
1078
1078
|
with querying.track_queries() as queries:
|
1079
|
-
querying.query('foo', Activity, default=None, lm=lm)
|
1079
|
+
querying.query('foo', Activity, default=None, lm=lm, invocation_id='123')
|
1080
1080
|
|
1081
|
+
self.assertEqual(queries[0].id, '123')
|
1081
1082
|
self.assertTrue(queries[0].has_error)
|
1082
1083
|
self.assertIsInstance(queries[0].output, mapping.MappingError)
|
1083
1084
|
|
@@ -1088,6 +1089,7 @@ class QueryInvocationTest(unittest.TestCase):
|
|
1088
1089
|
with querying.track_queries() as queries:
|
1089
1090
|
querying.query('foo', Activity, lm=lm)
|
1090
1091
|
|
1092
|
+
self.assertIn('query@', queries[0].id)
|
1091
1093
|
self.assertIn('schema', queries[0].to_html_str())
|
1092
1094
|
self.assertEqual(queries[0].lm_response.score, 1.0)
|
1093
1095
|
self.assertFalse(queries[0].lm_response.is_cached)
|
@@ -71,7 +71,6 @@ class SchemaTest(unittest.TestCase):
|
|
71
71
|
self.assert_schema(float, pg.typing.Float())
|
72
72
|
self.assert_schema(str, pg.typing.Str())
|
73
73
|
self.assert_schema(bool, pg.typing.Bool())
|
74
|
-
self.assert_schema(bool | None, pg.typing.Bool().noneable())
|
75
74
|
|
76
75
|
# Top-level dictionary with 'result' as the only key is flattened.
|
77
76
|
self.assert_schema(dict(result=int), pg.typing.Int())
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/template_test.py
RENAMED
@@ -80,10 +80,10 @@ class BasicTest(unittest.TestCase):
|
|
80
80
|
|
81
81
|
def test_custom_typing(self):
|
82
82
|
class Foo(component.Component):
|
83
|
-
x: str | None
|
84
|
-
y: int | None
|
83
|
+
x: str | None = None
|
84
|
+
y: int | None = None
|
85
85
|
z: str
|
86
|
-
p: component.Component | None
|
86
|
+
p: component.Component | None = None
|
87
87
|
|
88
88
|
d = Foo(z='bar')
|
89
89
|
# String template can be assigned to str.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/__init__.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/agentic/action_eval.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/coding/__init__.py
RENAMED
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
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/component_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/concurrent_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/console_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/data/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/__init__.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/base_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/matching.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/matching_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/patching.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/patching_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/scoring.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/scoring_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/example.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/example_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/experiment.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metrics.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/metrics_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/progress.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/reporting.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/eval/v2/runners_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/langfunc_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/language_model.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/language_model_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/__init__.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/anthropic.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/anthropic_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/azure_openai.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/__init__.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/base.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/cache/in_memory.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/compositional.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/deepseek.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/deepseek_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/fake_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/gemini_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/google_genai.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/groq_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/llama_cpp.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/llama_cpp_test.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/openai_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/rest_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/vertexai.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/llms/vertexai_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/memories/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/__init__.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/audio.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/image.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/mime.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/mime_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/pdf.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/pdf_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modalities/video.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/modality_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/natural_language.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/sampling_test.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/mapping.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/parsing.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/schema.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/structured/scoring.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/subscription.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/subscription_test.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/__init__.py
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/completion.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun/core/templates/selfplay.py
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/requires.txt
RENAMED
File without changes
|
{langfun-0.1.2.dev202504240804 → langfun-0.1.2.dev202504260803}/langfun.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|