langfun 0.1.2.dev202505140804__tar.gz → 0.1.2.dev202505160805__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.dev202505140804 → langfun-0.1.2.dev202505160805}/PKG-INFO +1 -1
  2. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/agentic/action.py +85 -41
  3. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/agentic/action_test.py +15 -9
  4. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/metrics_test.py +4 -4
  5. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/anthropic.py +4 -8
  6. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/anthropic_test.py +38 -13
  7. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/gemini.py +2 -2
  8. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/logging.py +1 -1
  9. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun.egg-info/PKG-INFO +1 -1
  10. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/LICENSE +0 -0
  11. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/README.md +0 -0
  12. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/__init__.py +0 -0
  13. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/__init__.py +0 -0
  14. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/agentic/__init__.py +0 -0
  15. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/agentic/action_eval.py +0 -0
  16. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/agentic/action_eval_test.py +0 -0
  17. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/__init__.py +0 -0
  18. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/__init__.py +0 -0
  19. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/correction.py +0 -0
  20. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/correction_test.py +0 -0
  21. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/execution.py +0 -0
  22. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/execution_test.py +0 -0
  23. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/generation.py +0 -0
  24. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/generation_test.py +0 -0
  25. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/parsing.py +0 -0
  26. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/parsing_test.py +0 -0
  27. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/sandboxing.py +0 -0
  28. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/coding/python/sandboxing_test.py +0 -0
  29. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/component.py +0 -0
  30. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/component_test.py +0 -0
  31. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/concurrent.py +0 -0
  32. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/concurrent_test.py +0 -0
  33. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/console.py +0 -0
  34. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/console_test.py +0 -0
  35. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/__init__.py +0 -0
  36. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/__init__.py +0 -0
  37. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/anthropic.py +0 -0
  38. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/anthropic_test.py +0 -0
  39. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/gemini.py +0 -0
  40. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/gemini_test.py +0 -0
  41. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/openai.py +0 -0
  42. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/data/conversion/openai_test.py +0 -0
  43. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/__init__.py +0 -0
  44. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/base.py +0 -0
  45. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/base_test.py +0 -0
  46. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/matching.py +0 -0
  47. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/matching_test.py +0 -0
  48. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/patching.py +0 -0
  49. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/patching_test.py +0 -0
  50. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/scoring.py +0 -0
  51. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/scoring_test.py +0 -0
  52. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/__init__.py +0 -0
  53. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/checkpointing.py +0 -0
  54. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/checkpointing_test.py +0 -0
  55. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/eval_test_helper.py +0 -0
  56. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/evaluation.py +0 -0
  57. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/evaluation_test.py +0 -0
  58. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/example.py +0 -0
  59. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/example_test.py +0 -0
  60. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/experiment.py +0 -0
  61. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/experiment_test.py +0 -0
  62. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/metric_values.py +0 -0
  63. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/metric_values_test.py +0 -0
  64. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/metrics.py +0 -0
  65. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/progress.py +0 -0
  66. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/progress_test.py +0 -0
  67. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/progress_tracking.py +0 -0
  68. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
  69. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/reporting.py +0 -0
  70. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/reporting_test.py +0 -0
  71. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/runners.py +0 -0
  72. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/eval/v2/runners_test.py +0 -0
  73. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/langfunc.py +0 -0
  74. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/langfunc_test.py +0 -0
  75. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/language_model.py +0 -0
  76. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/language_model_test.py +0 -0
  77. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/__init__.py +0 -0
  78. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/azure_openai.py +0 -0
  79. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/azure_openai_test.py +0 -0
  80. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/cache/__init__.py +0 -0
  81. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/cache/base.py +0 -0
  82. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/cache/in_memory.py +0 -0
  83. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/cache/in_memory_test.py +0 -0
  84. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/compositional.py +0 -0
  85. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/compositional_test.py +0 -0
  86. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/deepseek.py +0 -0
  87. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/deepseek_test.py +0 -0
  88. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/fake.py +0 -0
  89. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/fake_test.py +0 -0
  90. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/gemini_test.py +0 -0
  91. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/google_genai.py +0 -0
  92. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/google_genai_test.py +0 -0
  93. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/groq.py +0 -0
  94. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/groq_test.py +0 -0
  95. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/llama_cpp.py +0 -0
  96. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/llama_cpp_test.py +0 -0
  97. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/openai.py +0 -0
  98. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/openai_compatible.py +0 -0
  99. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/openai_compatible_test.py +0 -0
  100. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/openai_test.py +0 -0
  101. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/rest.py +0 -0
  102. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/rest_test.py +0 -0
  103. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/vertexai.py +0 -0
  104. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/llms/vertexai_test.py +0 -0
  105. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/logging_test.py +0 -0
  106. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/memories/__init__.py +0 -0
  107. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/memories/conversation_history.py +0 -0
  108. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/memories/conversation_history_test.py +0 -0
  109. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/memory.py +0 -0
  110. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/message.py +0 -0
  111. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/message_test.py +0 -0
  112. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/__init__.py +0 -0
  113. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/audio.py +0 -0
  114. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/audio_test.py +0 -0
  115. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/image.py +0 -0
  116. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/image_test.py +0 -0
  117. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/mime.py +0 -0
  118. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/mime_test.py +0 -0
  119. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/pdf.py +0 -0
  120. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/pdf_test.py +0 -0
  121. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/video.py +0 -0
  122. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modalities/video_test.py +0 -0
  123. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modality.py +0 -0
  124. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/modality_test.py +0 -0
  125. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/natural_language.py +0 -0
  126. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/natural_language_test.py +0 -0
  127. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/sampling.py +0 -0
  128. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/sampling_test.py +0 -0
  129. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/__init__.py +0 -0
  130. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/completion.py +0 -0
  131. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/completion_test.py +0 -0
  132. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/description.py +0 -0
  133. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/description_test.py +0 -0
  134. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/function_generation.py +0 -0
  135. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/function_generation_test.py +0 -0
  136. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/mapping.py +0 -0
  137. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/mapping_test.py +0 -0
  138. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/parsing.py +0 -0
  139. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/parsing_test.py +0 -0
  140. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/querying.py +0 -0
  141. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/querying_test.py +0 -0
  142. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/schema.py +0 -0
  143. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/schema_generation.py +0 -0
  144. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/schema_generation_test.py +0 -0
  145. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/schema_test.py +0 -0
  146. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/scoring.py +0 -0
  147. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/scoring_test.py +0 -0
  148. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/tokenization.py +0 -0
  149. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/structured/tokenization_test.py +0 -0
  150. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/subscription.py +0 -0
  151. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/subscription_test.py +0 -0
  152. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/template.py +0 -0
  153. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/template_test.py +0 -0
  154. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/__init__.py +0 -0
  155. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/completion.py +0 -0
  156. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/completion_test.py +0 -0
  157. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/conversation.py +0 -0
  158. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/conversation_test.py +0 -0
  159. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/demonstration.py +0 -0
  160. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/demonstration_test.py +0 -0
  161. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/selfplay.py +0 -0
  162. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun/core/templates/selfplay_test.py +0 -0
  163. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun.egg-info/SOURCES.txt +0 -0
  164. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun.egg-info/dependency_links.txt +0 -0
  165. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun.egg-info/requires.txt +0 -0
  166. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/langfun.egg-info/top_level.txt +0 -0
  167. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/setup.cfg +0 -0
  168. {langfun-0.1.2.dev202505140804 → langfun-0.1.2.dev202505160805}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langfun
3
- Version: 0.1.2.dev202505140804
3
+ Version: 0.1.2.dev202505160805
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -898,6 +898,11 @@ class ActionInvocation(pg.Object, pg.views.html.HtmlTreeView.Extension):
898
898
  """Returns the usage summary of the action."""
899
899
  return self.execution.usage_summary
900
900
 
901
+ @property
902
+ def elapse(self) -> float:
903
+ """Returns the elapsed time of the action."""
904
+ return self.execution.elapse
905
+
901
906
  def start(self) -> None:
902
907
  """Starts the execution of the action."""
903
908
  self.execution.start()
@@ -1088,6 +1093,60 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
1088
1093
  )
1089
1094
  ] = False
1090
1095
 
1096
+ #
1097
+ # Shortcut methods for accessing the root action invocation.
1098
+ #
1099
+
1100
+ @property
1101
+ def all_queries(self) -> list[lf_structured.QueryInvocation]:
1102
+ """Returns all queries made by the session."""
1103
+ return self.root.all_queries
1104
+
1105
+ @property
1106
+ def all_actions(self) -> list[ActionInvocation]:
1107
+ """Returns all actions made by the session."""
1108
+ return self.root.all_actions
1109
+
1110
+ @property
1111
+ def all_logs(self) -> list[lf.logging.LogEntry]:
1112
+ """Returns all logs made by the session."""
1113
+ return self.root.all_logs
1114
+
1115
+ @property
1116
+ def usage_summary(self) -> lf.UsageSummary:
1117
+ """Returns the usage summary of the session."""
1118
+ return self.root.usage_summary
1119
+
1120
+ @property
1121
+ def has_started(self) -> bool:
1122
+ """Returns True if the session has started."""
1123
+ return self.root.execution.has_started
1124
+
1125
+ @property
1126
+ def has_stopped(self) -> bool:
1127
+ """Returns True if the session has stopped."""
1128
+ return self.root.execution.has_stopped
1129
+
1130
+ @property
1131
+ def has_error(self) -> bool:
1132
+ """Returns True if the session has an error."""
1133
+ return self.root.has_error
1134
+
1135
+ @property
1136
+ def final_result(self) -> Any:
1137
+ """Returns the final result of the session."""
1138
+ return self.root.result
1139
+
1140
+ @property
1141
+ def final_error(self) -> pg.utils.ErrorInfo | None:
1142
+ """Returns the error of the session."""
1143
+ return self.root.error
1144
+
1145
+ @property
1146
+ def elapse(self) -> float:
1147
+ """Returns the elapsed time of the session."""
1148
+ return self.root.elapse
1149
+
1091
1150
  # NOTE(daiyip): Action execution may involve multi-threading, hence current
1092
1151
  # action and execution are thread-local.
1093
1152
 
@@ -1131,6 +1190,20 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
1131
1190
  metadata: dict[str, Any] | None = None,
1132
1191
  ) -> None:
1133
1192
  """Ends the session."""
1193
+ if error is not None:
1194
+ self.error(
1195
+ f'Trajectory failed in {self.elapse:.2f} seconds.',
1196
+ error=error,
1197
+ metadata=metadata,
1198
+ keep=True,
1199
+ )
1200
+ elif self.verbose:
1201
+ self.info(
1202
+ f'Trajectory succeeded in {self.elapse:.2f} seconds.',
1203
+ result=result,
1204
+ metadata=metadata,
1205
+ keep=False,
1206
+ )
1134
1207
  self.root.end(result, error, metadata)
1135
1208
 
1136
1209
  def __enter__(self):
@@ -1191,26 +1264,15 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
1191
1264
  yield invocation
1192
1265
  finally:
1193
1266
  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
- )
1267
+ self.warning(
1268
+ (
1269
+ f'Action execution failed in '
1270
+ f'{invocation.execution.elapse:.2f} seconds.'
1271
+ ),
1272
+ action=invocation.action,
1273
+ error=invocation.error,
1274
+ keep=True,
1275
+ )
1214
1276
  elif self.verbose:
1215
1277
  self.info(
1216
1278
  (
@@ -1522,7 +1584,9 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
1522
1584
  for_action = self._current_action
1523
1585
  elif isinstance(for_action, Action):
1524
1586
  for_action = for_action.invocation
1525
- assert for_action is not None
1587
+ assert for_action is not None, (
1588
+ f'Action must be called before it can be logged: {for_action}'
1589
+ )
1526
1590
 
1527
1591
  log_entry = lf.logging.log(
1528
1592
  level,
@@ -1607,26 +1671,6 @@ class Session(pg.Object, pg.views.html.HtmlTreeView.Extension):
1607
1671
  result=self.root
1608
1672
  )
1609
1673
 
1610
- @property
1611
- def final_result(self) -> Any:
1612
- """Returns the final result of the session."""
1613
- return self.root.result
1614
-
1615
- @property
1616
- def has_started(self) -> bool:
1617
- """Returns whether the session has started."""
1618
- return self.root.execution.has_started
1619
-
1620
- @property
1621
- def has_stopped(self) -> bool:
1622
- """Returns whether the session has stopped."""
1623
- return self.root.execution.has_stopped
1624
-
1625
- @property
1626
- def has_error(self) -> bool:
1627
- """Returns whether the session has an error."""
1628
- return self.root.has_error
1629
-
1630
1674
  @property
1631
1675
  def current_action(self) -> ActionInvocation:
1632
1676
  """Returns the current invocation."""
@@ -155,15 +155,19 @@ class SessionTest(unittest.TestCase):
155
155
  )
156
156
 
157
157
  # The root space should have one action (foo), no queries, and no logs.
158
- self.assertEqual(len(list(root.actions)), 1)
159
- self.assertEqual(len(list(root.queries)), 0)
160
- self.assertEqual(len(list(root.logs)), 0)
158
+ self.assertEqual(len(root.actions), 1)
159
+ self.assertEqual(len(root.queries), 0)
160
+ self.assertEqual(len(root.logs), 0)
161
161
  # 1 query from Bar, 2 from Foo and 3 from parallel executions.
162
- self.assertEqual(len(list(root.all_queries)), 6)
162
+ self.assertEqual(len(session.all_queries), 6)
163
+ self.assertEqual(len(root.all_queries), 6)
163
164
  # 2 actions: Foo and Bar.
164
- self.assertEqual(len(list(root.all_actions)), 2)
165
+ self.assertEqual(len(session.all_actions), 2)
166
+ self.assertEqual(len(root.all_actions), 2)
165
167
  # 1 log from Bar and 1 from Foo.
166
- self.assertEqual(len(list(root.all_logs)), 2)
168
+ self.assertEqual(len(session.all_logs), 2)
169
+ self.assertEqual(len(root.all_logs), 2)
170
+ self.assertIs(session.usage_summary, root.usage_summary)
167
171
  self.assertEqual(root.usage_summary.total.num_requests, 6)
168
172
 
169
173
  # Inspecting the top-level action (Foo)
@@ -276,7 +280,7 @@ class SessionTest(unittest.TestCase):
276
280
  foo_invocation = root.execution[0]
277
281
  self.assertIsInstance(foo_invocation, action_lib.ActionInvocation)
278
282
  self.assertTrue(foo_invocation.has_error)
279
- self.assertEqual(len(foo_invocation.execution.items), 2)
283
+ self.assertEqual(len(foo_invocation.execution.items), 3)
280
284
 
281
285
  def test_succeeded_with_implicit_session(self):
282
286
  lm = fake.StaticResponse('lm response')
@@ -304,7 +308,7 @@ class SessionTest(unittest.TestCase):
304
308
  self.assertTrue(session.has_started)
305
309
  self.assertTrue(session.has_stopped)
306
310
  self.assertTrue(session.has_error)
307
- self.assertIsInstance(session.root.error, pg.utils.ErrorInfo)
311
+ self.assertIsInstance(session.final_error, pg.utils.ErrorInfo)
308
312
  self.assertIn('Bar error', str(session.root.error))
309
313
 
310
314
  def test_succeeded_with_explicit_session(self):
@@ -409,7 +413,9 @@ class SessionTest(unittest.TestCase):
409
413
  self.assertTrue(session.has_stopped)
410
414
  self.assertTrue(session.has_error)
411
415
  self.assertIsInstance(session.root.error, pg.utils.ErrorInfo)
412
- self.assertEqual(len(session.root.execution), 2)
416
+ self.assertEqual(len(session.root.execution), 3)
417
+ self.assertEqual(len(session.root.actions), 2)
418
+ self.assertEqual(len(session.root.logs), 1)
413
419
  self.assertFalse(session.root.execution[0].has_error)
414
420
  self.assertTrue(session.root.execution[1].has_error)
415
421
 
@@ -37,7 +37,7 @@ class MatchTest(unittest.TestCase):
37
37
  Example(
38
38
  id=3,
39
39
  input=pg.Dict(groundtruth=1),
40
- error=pg.object_utils.ErrorInfo(
40
+ error=pg.symbolic.ErrorInfo(
41
41
  tag='ValueError',
42
42
  description='Bad input.',
43
43
  stacktrace='...',
@@ -51,7 +51,7 @@ class MatchTest(unittest.TestCase):
51
51
  Example(
52
52
  id=3,
53
53
  input=pg.Dict(groundtruth=1),
54
- error=pg.object_utils.ErrorInfo(
54
+ error=pg.symbolic.ErrorInfo(
55
55
  tag='MappingError.CodeError',
56
56
  description='Bad input.',
57
57
  stacktrace='...',
@@ -130,7 +130,7 @@ class ScoreTest(unittest.TestCase):
130
130
  Example(
131
131
  id=3,
132
132
  input=pg.Dict(x=1),
133
- error=pg.object_utils.ErrorInfo(
133
+ error=pg.symbolic.ErrorInfo(
134
134
  tag='ValueError',
135
135
  description='Bad input.',
136
136
  stacktrace='...',
@@ -144,7 +144,7 @@ class ScoreTest(unittest.TestCase):
144
144
  Example(
145
145
  id=3,
146
146
  input=pg.Dict(x=1),
147
- error=pg.object_utils.ErrorInfo(
147
+ error=pg.symbolic.ErrorInfo(
148
148
  tag='MappingError.CodeError',
149
149
  description='Bad input.',
150
150
  stacktrace='...',
@@ -509,17 +509,13 @@ class Anthropic(rest.REST):
509
509
  raise ValueError(f'Unsupported modality: {chunk!r}.')
510
510
  return chunk
511
511
 
512
- messages = []
513
512
  if system_message := prompt.get('system_message'):
514
513
  assert isinstance(system_message, lf.SystemMessage), type(system_message)
515
- messages.append(
516
- system_message.as_format(
517
- 'anthropic', chunk_preprocessor=modality_check
518
- )
519
- )
520
- messages.append(
514
+ request['system'] = system_message.text
515
+
516
+ messages = [
521
517
  prompt.as_format('anthropic', chunk_preprocessor=modality_check)
522
- )
518
+ ]
523
519
  request.update(messages=messages)
524
520
  return request
525
521
 
@@ -31,21 +31,46 @@ def mock_requests_post(url: str, json: dict[str, Any], **kwargs):
31
31
 
32
32
  response = requests.Response()
33
33
  response.status_code = 200
34
+
35
+ # Construct base text from user/assistant messages payload
36
+ messages_payload_text = '\n'.join(
37
+ c['content'][0]['text']
38
+ for c in json.get('messages', [])
39
+ if c.get('content')
40
+ and isinstance(c['content'], list)
41
+ and c['content']
42
+ and c['content'][0].get('type') == 'text'
43
+ and 'text' in c['content'][0]
44
+ )
45
+
46
+ # Check for a system prompt in the request payload
47
+ system_prompt_text = json.get('system')
48
+
49
+ processed_text_parts = []
50
+ if system_prompt_text:
51
+ processed_text_parts.append(system_prompt_text)
52
+ if messages_payload_text:
53
+ processed_text_parts.append(messages_payload_text)
54
+
55
+ processed_text = '\n'.join(processed_text_parts)
56
+
57
+ response_content_text = (
58
+ f'{processed_text} with temperature={json.get("temperature")}, '
59
+ f'top_k={json.get("top_k")}, '
60
+ f'top_p={json.get("top_p")}, '
61
+ f'max_tokens={json.get("max_tokens")}, '
62
+ f'stop={json.get("stop_sequences")}.'
63
+ )
64
+
34
65
  response._content = pg.to_json_str({
35
- 'content': [{
36
- 'type': 'text',
37
- 'text': (
38
- '\n'.join(c['content'][0]['text'] for c in json['messages']) +
39
- f' with temperature={json.get("temperature")}, '
40
- f'top_k={json.get("top_k")}, '
41
- f'top_p={json.get("top_p")}, '
42
- f'max_tokens={json.get("max_tokens")}, '
43
- f'stop={json.get("stop_sequences")}.'
44
- ),
45
- }],
66
+ 'content': [{'type': 'text', 'text': response_content_text}],
46
67
  'usage': {
47
- 'input_tokens': 2,
48
- 'output_tokens': 1,
68
+ 'input_tokens': (
69
+ 2
70
+ ), # Placeholder: adjust if tests need accurate token counts
71
+ 'output_tokens': (
72
+ 1
73
+ ), # Placeholder: adjust if tests need accurate token counts
49
74
  },
50
75
  }).encode()
51
76
  return response
@@ -155,7 +155,7 @@ SUPPORTED_MODELS = [
155
155
  GeminiModelInfo(
156
156
  model_id='gemini-2.5-pro-preview-05-06',
157
157
  in_service=True,
158
- provider=pg.oneof(['Google GenAI', ' VertexAI']),
158
+ provider=pg.oneof(['Google GenAI', 'VertexAI']),
159
159
  model_type='instruction-tuned',
160
160
  description='Gemini 2.5 Pro.',
161
161
  release_date=datetime.datetime(2025, 5, 6),
@@ -178,7 +178,7 @@ SUPPORTED_MODELS = [
178
178
  GeminiModelInfo(
179
179
  model_id='gemini-2.5-flash-preview-04-17',
180
180
  in_service=True,
181
- provider=pg.oneof(['Google GenAI', ' VertexAI']),
181
+ provider=pg.oneof(['Google GenAI', 'VertexAI']),
182
182
  model_type='instruction-tuned',
183
183
  description='Gemini 2.5 Flash.',
184
184
  release_date=datetime.datetime(2025, 4, 17),
@@ -276,7 +276,7 @@ def log(level: LogLevel,
276
276
  console_lib.write(entry)
277
277
  elif not console:
278
278
  if kwargs:
279
- message = f'{message} (metadata: {pg.format(kwargs)})'
279
+ message = f'{message} (metadata: {pg.format(kwargs, verbose=False)})'
280
280
  system_log_func(level)(message)
281
281
  return entry
282
282
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langfun
3
- Version: 0.1.2.dev202505140804
3
+ Version: 0.1.2.dev202505160805
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors