langfun 0.1.2.dev202505130804__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.

Files changed (168) hide show
  1. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/PKG-INFO +1 -1
  2. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action.py +172 -87
  3. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_eval.py +4 -6
  4. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/correction.py +4 -0
  5. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/console.py +6 -3
  6. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/language_model.py +4 -2
  7. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/logging.py +3 -4
  8. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/mapping.py +6 -0
  9. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/querying.py +324 -91
  10. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/querying_test.py +242 -2
  11. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema.py +8 -0
  12. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_generation.py +1 -0
  13. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_test.py +6 -3
  14. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/PKG-INFO +1 -1
  15. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/LICENSE +0 -0
  16. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/README.md +0 -0
  17. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/__init__.py +0 -0
  18. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/__init__.py +0 -0
  19. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/__init__.py +0 -0
  20. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_eval_test.py +0 -0
  21. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/agentic/action_test.py +0 -0
  22. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/__init__.py +0 -0
  23. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/__init__.py +0 -0
  24. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/correction_test.py +0 -0
  25. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/execution.py +0 -0
  26. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/execution_test.py +0 -0
  27. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/generation.py +0 -0
  28. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/generation_test.py +0 -0
  29. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/parsing.py +0 -0
  30. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/parsing_test.py +0 -0
  31. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/sandboxing.py +0 -0
  32. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/coding/python/sandboxing_test.py +0 -0
  33. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/component.py +0 -0
  34. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/component_test.py +0 -0
  35. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/concurrent.py +0 -0
  36. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/concurrent_test.py +0 -0
  37. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/console_test.py +0 -0
  38. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/__init__.py +0 -0
  39. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/__init__.py +0 -0
  40. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/anthropic.py +0 -0
  41. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/anthropic_test.py +0 -0
  42. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/gemini.py +0 -0
  43. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/gemini_test.py +0 -0
  44. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/openai.py +0 -0
  45. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/data/conversion/openai_test.py +0 -0
  46. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/__init__.py +0 -0
  47. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/base.py +0 -0
  48. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/base_test.py +0 -0
  49. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/matching.py +0 -0
  50. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/matching_test.py +0 -0
  51. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/patching.py +0 -0
  52. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/patching_test.py +0 -0
  53. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/scoring.py +0 -0
  54. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/scoring_test.py +0 -0
  55. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/__init__.py +0 -0
  56. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/checkpointing.py +0 -0
  57. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/checkpointing_test.py +0 -0
  58. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/eval_test_helper.py +0 -0
  59. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/evaluation.py +0 -0
  60. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/evaluation_test.py +0 -0
  61. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/example.py +0 -0
  62. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/example_test.py +0 -0
  63. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/experiment.py +0 -0
  64. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/experiment_test.py +0 -0
  65. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metric_values.py +0 -0
  66. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metric_values_test.py +0 -0
  67. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metrics.py +0 -0
  68. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/metrics_test.py +0 -0
  69. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress.py +0 -0
  70. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_test.py +0 -0
  71. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_tracking.py +0 -0
  72. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
  73. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/reporting.py +0 -0
  74. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/reporting_test.py +0 -0
  75. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/runners.py +0 -0
  76. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/eval/v2/runners_test.py +0 -0
  77. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/langfunc.py +0 -0
  78. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/langfunc_test.py +0 -0
  79. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/language_model_test.py +0 -0
  80. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/__init__.py +0 -0
  81. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/anthropic.py +0 -0
  82. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/anthropic_test.py +0 -0
  83. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/azure_openai.py +0 -0
  84. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/azure_openai_test.py +0 -0
  85. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/__init__.py +0 -0
  86. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/base.py +0 -0
  87. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/in_memory.py +0 -0
  88. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/cache/in_memory_test.py +0 -0
  89. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/compositional.py +0 -0
  90. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/compositional_test.py +0 -0
  91. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/deepseek.py +0 -0
  92. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/deepseek_test.py +0 -0
  93. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/fake.py +0 -0
  94. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/fake_test.py +0 -0
  95. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/gemini.py +0 -0
  96. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/gemini_test.py +0 -0
  97. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/google_genai.py +0 -0
  98. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/google_genai_test.py +0 -0
  99. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/groq.py +0 -0
  100. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/groq_test.py +0 -0
  101. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/llama_cpp.py +0 -0
  102. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/llama_cpp_test.py +0 -0
  103. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai.py +0 -0
  104. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_compatible.py +0 -0
  105. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_compatible_test.py +0 -0
  106. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/openai_test.py +0 -0
  107. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/rest.py +0 -0
  108. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/rest_test.py +0 -0
  109. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/vertexai.py +0 -0
  110. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/llms/vertexai_test.py +0 -0
  111. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/logging_test.py +0 -0
  112. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/__init__.py +0 -0
  113. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/conversation_history.py +0 -0
  114. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/memories/conversation_history_test.py +0 -0
  115. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/memory.py +0 -0
  116. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/message.py +0 -0
  117. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/message_test.py +0 -0
  118. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/__init__.py +0 -0
  119. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/audio.py +0 -0
  120. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/audio_test.py +0 -0
  121. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/image.py +0 -0
  122. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/image_test.py +0 -0
  123. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/mime.py +0 -0
  124. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/mime_test.py +0 -0
  125. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/pdf.py +0 -0
  126. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/pdf_test.py +0 -0
  127. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/video.py +0 -0
  128. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modalities/video_test.py +0 -0
  129. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modality.py +0 -0
  130. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/modality_test.py +0 -0
  131. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/natural_language.py +0 -0
  132. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/natural_language_test.py +0 -0
  133. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/sampling.py +0 -0
  134. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/sampling_test.py +0 -0
  135. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/__init__.py +0 -0
  136. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/completion.py +0 -0
  137. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/completion_test.py +0 -0
  138. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/description.py +0 -0
  139. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/description_test.py +0 -0
  140. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/function_generation.py +0 -0
  141. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/function_generation_test.py +0 -0
  142. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/mapping_test.py +0 -0
  143. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/parsing.py +0 -0
  144. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/parsing_test.py +0 -0
  145. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/schema_generation_test.py +0 -0
  146. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/scoring.py +0 -0
  147. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/scoring_test.py +0 -0
  148. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/tokenization.py +0 -0
  149. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/structured/tokenization_test.py +0 -0
  150. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/subscription.py +0 -0
  151. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/subscription_test.py +0 -0
  152. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/template.py +0 -0
  153. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/template_test.py +0 -0
  154. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/__init__.py +0 -0
  155. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/completion.py +0 -0
  156. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/completion_test.py +0 -0
  157. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/conversation.py +0 -0
  158. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/conversation_test.py +0 -0
  159. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/demonstration.py +0 -0
  160. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/demonstration_test.py +0 -0
  161. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/selfplay.py +0 -0
  162. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun/core/templates/selfplay_test.py +0 -0
  163. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/SOURCES.txt +0 -0
  164. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/dependency_links.txt +0 -0
  165. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/requires.txt +0 -0
  166. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/langfun.egg-info/top_level.txt +0 -0
  167. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/setup.cfg +0 -0
  168. {langfun-0.1.2.dev202505130804 → langfun-0.1.2.dev202505140804}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langfun
3
- Version: 0.1.2.dev202505130804
3
+ Version: 0.1.2.dev202505140804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -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) as invocation:
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, verbose=verbose, **kwargs)
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
- current_invocation = self
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
- num_queries=len(self.queries),
523
- execution_breakdown=[
524
- dict(
525
- action=action.action.__class__.__name__,
526
- usage=action.usage_summary.total,
527
- execution_time=action.execution.elapse,
528
- )
529
- for action in self.actions
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: ActionInvocation = ActionInvocation(RootAction())
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
- with self.track_phase(phase) as execution:
1212
- with lf_structured.track_queries(include_child_scopes=False) as queries:
1213
- try:
1214
- yield queries
1215
- finally:
1216
- for i, query in enumerate(queries):
1217
- query.rebind(
1218
- id=f'{execution.id}/q{len(execution.queries) + i + 1}',
1219
- skip_notification=False,
1220
- raise_on_no_change=False
1221
- )
1222
- execution.extend(queries)
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
- start_time = time.time()
1276
- try:
1277
- return lf_structured.query(
1278
- prompt,
1279
- schema=schema,
1280
- default=default,
1281
- lm=lm,
1282
- examples=examples,
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,
@@ -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(id=f'{self.id}#example-{example.id}') as 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
- _notebook = sys.modules['IPython'].display
57
- except Exception: # pylint: disable=broad-except
58
- _notebook = None
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:
@@ -1453,7 +1453,8 @@ class UsageSummary(pg.Object, pg.views.HtmlTreeView.Extension):
1453
1453
  self._usage_badge.update(
1454
1454
  self._badge_text(),
1455
1455
  tooltip=pg.format(
1456
- self, verbose=False, custom_format=self._tooltip_format
1456
+ self, verbose=False, custom_format=self._tooltip_format,
1457
+ hide_default_values=True,
1457
1458
  ),
1458
1459
  styles=dict(color=self._badge_color()),
1459
1460
  )
@@ -1500,7 +1501,8 @@ class UsageSummary(pg.Object, pg.views.HtmlTreeView.Extension):
1500
1501
  usage_badge = pg.views.html.controls.Badge(
1501
1502
  self._badge_text(),
1502
1503
  tooltip=pg.format(
1503
- self, custom_format=self._tooltip_format, verbose=False
1504
+ self, custom_format=self._tooltip_format, verbose=False,
1505
+ hide_default_values=True,
1504
1506
  ),
1505
1507
  css_classes=['usage-summary'],
1506
1508
  styles=dict(color=self._badge_color()),
@@ -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
- elif console:
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)
@@ -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: