langfun 0.1.2.dev202505060804__tar.gz → 0.1.2.dev202505080804__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.dev202505060804 → langfun-0.1.2.dev202505080804}/PKG-INFO +1 -1
  2. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/experiment.py +12 -0
  3. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/runners.py +3 -0
  4. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/runners_test.py +9 -0
  5. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/__init__.py +2 -0
  6. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/gemini.py +23 -0
  7. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/google_genai.py +4 -0
  8. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/vertexai.py +4 -0
  9. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/memories/conversation_history.py +6 -6
  10. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/memories/conversation_history_test.py +31 -27
  11. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/memory.py +12 -21
  12. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/schema.py +13 -3
  13. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/schema_test.py +16 -0
  14. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/conversation.py +1 -1
  15. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun.egg-info/PKG-INFO +1 -1
  16. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/LICENSE +0 -0
  17. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/README.md +0 -0
  18. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/__init__.py +0 -0
  19. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/__init__.py +0 -0
  20. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/agentic/__init__.py +0 -0
  21. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/agentic/action.py +0 -0
  22. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/agentic/action_eval.py +0 -0
  23. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/agentic/action_eval_test.py +0 -0
  24. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/agentic/action_test.py +0 -0
  25. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/__init__.py +0 -0
  26. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/__init__.py +0 -0
  27. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/correction.py +0 -0
  28. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/correction_test.py +0 -0
  29. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/execution.py +0 -0
  30. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/execution_test.py +0 -0
  31. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/generation.py +0 -0
  32. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/generation_test.py +0 -0
  33. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/parsing.py +0 -0
  34. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/parsing_test.py +0 -0
  35. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/sandboxing.py +0 -0
  36. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/coding/python/sandboxing_test.py +0 -0
  37. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/component.py +0 -0
  38. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/component_test.py +0 -0
  39. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/concurrent.py +0 -0
  40. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/concurrent_test.py +0 -0
  41. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/console.py +0 -0
  42. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/console_test.py +0 -0
  43. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/__init__.py +0 -0
  44. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/__init__.py +0 -0
  45. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/anthropic.py +0 -0
  46. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/anthropic_test.py +0 -0
  47. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/gemini.py +0 -0
  48. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/gemini_test.py +0 -0
  49. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/openai.py +0 -0
  50. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/data/conversion/openai_test.py +0 -0
  51. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/__init__.py +0 -0
  52. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/base.py +0 -0
  53. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/base_test.py +0 -0
  54. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/matching.py +0 -0
  55. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/matching_test.py +0 -0
  56. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/patching.py +0 -0
  57. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/patching_test.py +0 -0
  58. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/scoring.py +0 -0
  59. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/scoring_test.py +0 -0
  60. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/__init__.py +0 -0
  61. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/checkpointing.py +0 -0
  62. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/checkpointing_test.py +0 -0
  63. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/eval_test_helper.py +0 -0
  64. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/evaluation.py +0 -0
  65. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/evaluation_test.py +0 -0
  66. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/example.py +0 -0
  67. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/example_test.py +0 -0
  68. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/experiment_test.py +0 -0
  69. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/metric_values.py +0 -0
  70. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/metric_values_test.py +0 -0
  71. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/metrics.py +0 -0
  72. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/metrics_test.py +0 -0
  73. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/progress.py +0 -0
  74. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/progress_test.py +0 -0
  75. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/progress_tracking.py +0 -0
  76. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
  77. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/reporting.py +0 -0
  78. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/eval/v2/reporting_test.py +0 -0
  79. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/langfunc.py +0 -0
  80. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/langfunc_test.py +0 -0
  81. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/language_model.py +0 -0
  82. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/language_model_test.py +0 -0
  83. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/anthropic.py +0 -0
  84. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/anthropic_test.py +0 -0
  85. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/azure_openai.py +0 -0
  86. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/azure_openai_test.py +0 -0
  87. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/cache/__init__.py +0 -0
  88. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/cache/base.py +0 -0
  89. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/cache/in_memory.py +0 -0
  90. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/cache/in_memory_test.py +0 -0
  91. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/compositional.py +0 -0
  92. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/compositional_test.py +0 -0
  93. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/deepseek.py +0 -0
  94. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/deepseek_test.py +0 -0
  95. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/fake.py +0 -0
  96. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/fake_test.py +0 -0
  97. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/gemini_test.py +0 -0
  98. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/google_genai_test.py +0 -0
  99. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/groq.py +0 -0
  100. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/groq_test.py +0 -0
  101. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/llama_cpp.py +0 -0
  102. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/llama_cpp_test.py +0 -0
  103. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/openai.py +0 -0
  104. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/openai_compatible.py +0 -0
  105. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/openai_compatible_test.py +0 -0
  106. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/openai_test.py +0 -0
  107. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/rest.py +0 -0
  108. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/rest_test.py +0 -0
  109. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/llms/vertexai_test.py +0 -0
  110. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/logging.py +0 -0
  111. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/logging_test.py +0 -0
  112. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/memories/__init__.py +0 -0
  113. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/message.py +0 -0
  114. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/message_test.py +0 -0
  115. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/__init__.py +0 -0
  116. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/audio.py +0 -0
  117. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/audio_test.py +0 -0
  118. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/image.py +0 -0
  119. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/image_test.py +0 -0
  120. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/mime.py +0 -0
  121. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/mime_test.py +0 -0
  122. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/pdf.py +0 -0
  123. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/pdf_test.py +0 -0
  124. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/video.py +0 -0
  125. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modalities/video_test.py +0 -0
  126. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modality.py +0 -0
  127. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/modality_test.py +0 -0
  128. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/natural_language.py +0 -0
  129. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/natural_language_test.py +0 -0
  130. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/sampling.py +0 -0
  131. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/sampling_test.py +0 -0
  132. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/__init__.py +0 -0
  133. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/completion.py +0 -0
  134. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/completion_test.py +0 -0
  135. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/description.py +0 -0
  136. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/description_test.py +0 -0
  137. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/function_generation.py +0 -0
  138. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/function_generation_test.py +0 -0
  139. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/mapping.py +0 -0
  140. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/mapping_test.py +0 -0
  141. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/parsing.py +0 -0
  142. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/parsing_test.py +0 -0
  143. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/querying.py +0 -0
  144. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/querying_test.py +0 -0
  145. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/schema_generation.py +0 -0
  146. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/schema_generation_test.py +0 -0
  147. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/scoring.py +0 -0
  148. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/scoring_test.py +0 -0
  149. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/tokenization.py +0 -0
  150. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/structured/tokenization_test.py +0 -0
  151. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/subscription.py +0 -0
  152. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/subscription_test.py +0 -0
  153. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/template.py +0 -0
  154. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/template_test.py +0 -0
  155. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/__init__.py +0 -0
  156. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/completion.py +0 -0
  157. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/completion_test.py +0 -0
  158. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/conversation_test.py +0 -0
  159. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/demonstration.py +0 -0
  160. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/demonstration_test.py +0 -0
  161. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/selfplay.py +0 -0
  162. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun/core/templates/selfplay_test.py +0 -0
  163. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun.egg-info/SOURCES.txt +0 -0
  164. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun.egg-info/dependency_links.txt +0 -0
  165. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun.egg-info/requires.txt +0 -0
  166. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/langfun.egg-info/top_level.txt +0 -0
  167. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/setup.cfg +0 -0
  168. {langfun-0.1.2.dev202505060804 → langfun-0.1.2.dev202505080804}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langfun
3
- Version: 0.1.2.dev202505060804
3
+ Version: 0.1.2.dev202505080804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -382,6 +382,7 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
382
382
  warm_start_from: str | None = None,
383
383
  filter: Callable[['Experiment'], bool] | None = None, # pylint: disable=redefined-builtin
384
384
  example_ids: list[int] | None = None,
385
+ shuffle_inputs: bool = False,
385
386
  raise_if_has_error: bool = False,
386
387
  reprocess: bool | list[int] = False,
387
388
  generate_example_html: Literal['new', 'all', 'no'] | list[int] = 'new',
@@ -431,6 +432,8 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
431
432
  filter: A filter function to decide whether an experiment should be run
432
433
  or not.
433
434
  example_ids: The example IDs to run. If None, it will run all examples.
435
+ shuffle_inputs: If True, the order of evaluatin examples will be shuffled.
436
+ Neverthless, the example ID remains unchanged for each example.
434
437
  raise_if_has_error: If True, it will raise an error if any example fails.
435
438
  Otherwise, it will continue and report the error in the output.
436
439
  reprocess: A boolean or a list of example IDs. If boolean, it indicates
@@ -470,6 +473,7 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
470
473
  warm_start_from=warm_start_from,
471
474
  filter=filter,
472
475
  example_ids=example_ids,
476
+ shuffle_inputs=shuffle_inputs,
473
477
  raise_if_has_error=raise_if_has_error,
474
478
  reprocess=reprocess,
475
479
  generate_example_html=generate_example_html,
@@ -816,6 +820,14 @@ class Run(pg.Object, pg.views.html.HtmlTreeView.Extension):
816
820
  )
817
821
  ] = None
818
822
 
823
+ shuffle_inputs: Annotated[
824
+ bool,
825
+ (
826
+ 'If True, the order of evaluating examples will be shuffled.'
827
+ 'Otherwise an increasing order will be used.'
828
+ )
829
+ ] = False
830
+
819
831
  raise_if_has_error: Annotated[
820
832
  bool,
821
833
  (
@@ -356,6 +356,9 @@ class RunnerBase(Runner):
356
356
  input=evaluation.example_input_by_id(example_id)
357
357
  ) for example_id in self.current_run.example_ids
358
358
  )
359
+ if self.current_run.shuffle_inputs:
360
+ items = list(items)
361
+ random.shuffle(items)
359
362
  self._evaluate_items(evaluation, items)
360
363
 
361
364
  if cache:
@@ -163,6 +163,15 @@ class RunnerTest(unittest.TestCase):
163
163
  self.assertEqual(plugin.started_example_ids, [5, 7, 9] * 6)
164
164
  self.assertEqual(plugin.completed_example_ids, [5, 7, 9] * 6)
165
165
 
166
+ def test_shuffle_inputs(self):
167
+ root_dir = os.path.join(tempfile.gettempdir(), 'test_shuffle_inputs')
168
+ exp = eval_test_helper.test_experiment()
169
+ plugin = TestPlugin()
170
+ run = exp.run(
171
+ root_dir, runner='sequential', plugins=[plugin], shuffle_inputs=True
172
+ )
173
+ self.assertTrue(run.shuffle_inputs)
174
+
166
175
  def test_filter(self):
167
176
  plugin = TestPlugin()
168
177
  exp = eval_test_helper.test_experiment()
@@ -40,6 +40,7 @@ from langfun.core.llms.azure_openai import AzureOpenAI
40
40
 
41
41
  # Gemini models.
42
42
  from langfun.core.llms.google_genai import GenAI
43
+ from langfun.core.llms.google_genai import Gemini25ProPreview_20250506
43
44
  from langfun.core.llms.google_genai import Gemini25FlashPreview_20250417
44
45
  from langfun.core.llms.google_genai import Gemini25ProPreview_20250325
45
46
  from langfun.core.llms.google_genai import Gemini2Flash
@@ -77,6 +78,7 @@ from langfun.core.llms.vertexai import VertexAIGeminiExp_20241206
77
78
  from langfun.core.llms.vertexai import VertexAIGemini25ProExp_20250325
78
79
  from langfun.core.llms.vertexai import VertexAIGemini25ProPreview_20250325
79
80
  from langfun.core.llms.vertexai import VertexAIGemini25FlashPreview_20250417
81
+ from langfun.core.llms.vertexai import VertexAIGemini25ProPreview_20250506
80
82
 
81
83
  # For backward compatibility.
82
84
  GeminiPro1_5 = Gemini15Pro
@@ -151,6 +151,29 @@ SUPPORTED_MODELS = [
151
151
  #
152
152
  # Production models.
153
153
  #
154
+ # Gemini 2.5 Pro Preview
155
+ GeminiModelInfo(
156
+ model_id='gemini-2.5-pro-preview-05-06',
157
+ in_service=True,
158
+ provider=pg.oneof(['Google GenAI', ' VertexAI']),
159
+ model_type='instruction-tuned',
160
+ description='Gemini 2.5 Pro.',
161
+ release_date=datetime.datetime(2025, 5, 6),
162
+ input_modalities=GeminiModelInfo.ALL_SUPPORTED_INPUT_TYPES,
163
+ context_length=lf.ModelInfo.ContextLength(
164
+ max_input_tokens=1_048_576,
165
+ max_output_tokens=65_536,
166
+ ),
167
+ pricing=GeminiModelInfo.Pricing(
168
+ cost_per_1m_cached_input_tokens=1.25,
169
+ cost_per_1m_input_tokens=1.25,
170
+ cost_per_1m_output_tokens=10.0,
171
+ ),
172
+ rate_limits=lf.ModelInfo.RateLimits(
173
+ max_requests_per_minute=2000,
174
+ max_tokens_per_minute=4_000_000,
175
+ )
176
+ ),
154
177
  # Gemini 2.5 Flash Preview
155
178
  GeminiModelInfo(
156
179
  model_id='gemini-2.5-flash-preview-04-17',
@@ -106,6 +106,10 @@ class GeminiExp_20241206(GenAI):
106
106
  #
107
107
  # Production models.
108
108
  #
109
+ class Gemini25ProPreview_20250506(GenAI):
110
+ """Gemini 2.5 Pro model launched on 05/06/2025."""
111
+
112
+ model = 'gemini-2.5-pro-preview-05-06'
109
113
 
110
114
 
111
115
  class Gemini25FlashPreview_20250417(GenAI):
@@ -173,9 +173,13 @@ class VertexAIGemini(VertexAI, gemini.Gemini):
173
173
  def model_info(self) -> gemini.GeminiModelInfo:
174
174
  return super().model_info.clone(override=dict(provider='VertexAI'))
175
175
 
176
+
176
177
  #
177
178
  # Production models.
178
179
  #
180
+ class VertexAIGemini25ProPreview_20250506(VertexAIGemini): # pylint: disable=invalid-name
181
+ """Gemini 2.5 Pro model launched on 05/06/2025."""
182
+ model = 'gemini-2.5-pro-preview-05-06'
179
183
 
180
184
 
181
185
  class VertexAIGemini25FlashPreview_20250417(VertexAIGemini): # pylint: disable=invalid-name
@@ -43,19 +43,19 @@ class ConversationHistory(lf.Memory):
43
43
  messages.append(r[1])
44
44
  return messages
45
45
 
46
- def _recollect(self, **kwargs) -> lf.MemoryRecord:
47
- return lf.MemoryRecord(
48
- '\n'.join([f'{m.sender}: {m.text}' for m in self.messages]))
46
+ def _recollect(self, **kwargs) -> str:
47
+ return '\n'.join([f'{m.sender}: {m.text}' for m in self.messages])
49
48
 
50
49
  def _remember(
51
50
  self,
52
- input_message: lf.Message,
53
- output_message: lf.Message | None = None,
51
+ value: tuple[str | lf.Message, str | lf.Message],
54
52
  **kwargs
55
53
  ) -> None:
56
54
  if self.max_turns and self.max_turns == len(self._turns):
57
55
  self._turns.pop(0)
58
- self._turns.append((input_message, output_message))
56
+ self._turns.append(
57
+ (lf.UserMessage.from_value(value[0]), lf.AIMessage.from_value(value[1]))
58
+ )
59
59
 
60
60
  def _reset(self, **kwargs) -> None:
61
61
  self._turns = []
@@ -13,58 +13,62 @@
13
13
  # limitations under the License.
14
14
  """Base memory test."""
15
15
 
16
- import inspect
17
16
  import unittest
18
17
  import langfun.core as lf
19
18
  from langfun.core.memories.conversation_history import ConversationHistory
19
+ import pyglove as pg
20
20
 
21
21
 
22
22
  class ConversationHistoryTest(unittest.TestCase):
23
23
 
24
24
  def test_history_with_no_round_limit(self):
25
25
  m = ConversationHistory()
26
- m.remember('hi', 'hello')
26
+ m.remember(('hi', 'hello'))
27
27
  m.remember(
28
- 'how are you',
29
- 'Fine, thank you. Anything I can help with?',
28
+ ('how are you', 'Fine, thank you. Anything I can help with?'),
30
29
  )
31
30
  m.remember(
32
- 'Not for now, bye.',
33
- 'Okay, bye!',
31
+ ('Not for now, bye.', 'Okay, bye!'),
34
32
  )
35
33
  self.assertEqual(len(m.turns), 3)
36
34
  self.assertEqual(len(m.messages), 6)
37
- self.assertEqual(
38
- m.recollect(),
39
- lf.MemoryRecord(inspect.cleandoc("""
40
- User: hi
41
- AI: hello
42
- User: how are you
43
- AI: Fine, thank you. Anything I can help with?
44
- User: Not for now, bye.
45
- AI: Okay, bye!
46
- """)),
35
+ self.assertTrue(
36
+ pg.eq(
37
+ m.recollect(),
38
+ lf.Template(
39
+ """
40
+ User: hi
41
+ AI: hello
42
+ User: how are you
43
+ AI: Fine, thank you. Anything I can help with?
44
+ User: Not for now, bye.
45
+ AI: Okay, bye!
46
+ """
47
+ )
48
+ )
47
49
  )
48
50
 
49
51
  def test_history_with_round_limit(self):
50
52
  m = ConversationHistory(max_turns=1)
51
- m.remember('hi', 'hello')
53
+ m.remember(('hi', 'hello'))
52
54
  m.remember(
53
- 'how are you',
54
- 'Fine, thank you. Anything I can help with?',
55
+ ('how are you', 'Fine, thank you. Anything I can help with?'),
55
56
  )
56
57
  m.remember(
57
- 'Not for now, bye.',
58
- 'Okay, bye!',
58
+ ('Not for now, bye.', 'Okay, bye!'),
59
59
  )
60
60
  self.assertEqual(len(m.turns), 1)
61
61
  self.assertEqual(len(m.messages), 2)
62
- self.assertEqual(
63
- m.recollect(),
64
- lf.MemoryRecord(inspect.cleandoc("""
65
- User: Not for now, bye.
66
- AI: Okay, bye!
67
- """)),
62
+ self.assertTrue(
63
+ pg.eq(
64
+ m.recollect(),
65
+ lf.Template(
66
+ """
67
+ User: Not for now, bye.
68
+ AI: Okay, bye!
69
+ """
70
+ )
71
+ )
68
72
  )
69
73
 
70
74
 
@@ -14,7 +14,9 @@
14
14
  """Interface for memories."""
15
15
 
16
16
  import abc
17
- from langfun.core import message as message_lib
17
+ from typing import Any
18
+
19
+ from langfun.core import template as template_lib
18
20
  from langfun.core.component import Component
19
21
  from langfun.core.natural_language import NaturalLanguageFormattable
20
22
 
@@ -30,40 +32,29 @@ class Memory(NaturalLanguageFormattable, Component):
30
32
  """
31
33
 
32
34
  def natural_language_format(self) -> str:
33
- return self.recollect().text
35
+ return self.recollect().render().text
34
36
 
35
- def recollect(self, **kwargs) -> message_lib.MemoryRecord:
37
+ def recollect(self, **kwargs) -> template_lib.Template:
36
38
  """Recollects a message from the memory."""
37
- return self._recollect(**kwargs)
39
+ return template_lib.Template.from_value(self._recollect(**kwargs))
38
40
 
39
41
  def remember(
40
42
  self,
41
- input_message: str | message_lib.Message,
42
- output_message: str | message_lib.Message,
43
+ value: Any,
43
44
  **kwargs
44
- ) -> str:
45
- if isinstance(input_message, str):
46
- input_message = message_lib.UserMessage(input_message)
47
- if isinstance(output_message, str):
48
- output_message = message_lib.AIMessage(output_message)
49
- self._remember(input_message, output_message, **kwargs)
50
- return output_message.text
45
+ ) -> None:
46
+ self._remember(value, **kwargs)
51
47
 
52
48
  def reset(self, **kwargs) -> None:
53
49
  """Resets the memory."""
54
- self._reset()
50
+ self._reset(**kwargs)
55
51
 
56
52
  @abc.abstractmethod
57
- def _recollect(self, **kwargs) -> message_lib.MemoryRecord:
53
+ def _recollect(self, **kwargs) -> str | template_lib.Template:
58
54
  """Recollects a message from the memory."""
59
55
 
60
56
  @abc.abstractmethod
61
- def _remember(
62
- self,
63
- input_message: message_lib.Message,
64
- output_message: message_lib.Message,
65
- **kwargs
66
- ) -> None:
57
+ def _remember(self, value: Any, **kwargs) -> None:
67
58
  """Remembers the input message and the output message."""
68
59
 
69
60
  @abc.abstractmethod
@@ -185,10 +185,14 @@ class Schema(
185
185
  def class_dependencies(
186
186
  self,
187
187
  include_base_classes: bool = True,
188
- include_subclasses: bool = True) -> list[Type[Any]]:
188
+ include_subclasses: bool = True,
189
+ include_generated_subclasses: bool = False) -> list[Type[Any]]:
189
190
  """Returns a list of class dependencies for current schema."""
190
191
  return class_dependencies(
191
- self.spec, include_base_classes, include_subclasses
192
+ self.spec,
193
+ include_base_classes,
194
+ include_subclasses,
195
+ include_generated_subclasses
192
196
  )
193
197
 
194
198
  @classmethod
@@ -247,6 +251,7 @@ def class_dependencies(
247
251
  ],
248
252
  include_base_classes: bool = True,
249
253
  include_subclasses: bool = True,
254
+ include_generated_subclasses: bool = False,
250
255
  ) -> list[Type[Any]]:
251
256
  """Returns a list of class dependencies from a value or specs."""
252
257
  if isinstance(value_or_spec, Schema):
@@ -301,7 +306,12 @@ def class_dependencies(
301
306
  # Check subclasses if available.
302
307
  if include_subclasses:
303
308
  for cls in vs.cls.__subclasses__():
304
- if cls not in dependencies:
309
+ # NOTE(daiyip): To prevent LLM-generated "hallucinated" classes from
310
+ # polluting the generation space, classes dynamically created by
311
+ # 'eval' (which have __module__ == 'builtins') are excluded from
312
+ # dependencies by default.
313
+ if ((include_generated_subclasses or cls.__module__ != 'builtins')
314
+ and cls not in dependencies):
305
315
  _fill_dependencies(pg.typing.Object(cls), include_subclasses=True)
306
316
 
307
317
  if isinstance(vs, pg.typing.List):
@@ -144,6 +144,14 @@ class SchemaTest(unittest.TestCase):
144
144
  foo2: Foo | X
145
145
 
146
146
  schema = schema_lib.Schema([B])
147
+ v = schema_lib.structure_from_python(
148
+ """
149
+ class C(B):
150
+ pass
151
+ """,
152
+ global_vars=dict(B=B)
153
+ )
154
+ self.assertEqual(v.__module__, 'builtins')
147
155
  self.assertEqual(schema.class_dependencies(), [Foo, A, Bar, X, B])
148
156
 
149
157
  def test_class_dependencies_non_pyglove(self):
@@ -162,6 +170,14 @@ class SchemaTest(unittest.TestCase):
162
170
  class BB(AA):
163
171
  foo2: Baz | XX
164
172
 
173
+ v = schema_lib.structure_from_python(
174
+ """
175
+ class CC(BB):
176
+ pass
177
+ """,
178
+ global_vars=dict(BB=BB)
179
+ )
180
+ self.assertEqual(v.__module__, 'builtins')
165
181
  schema = schema_lib.Schema([AA])
166
182
  self.assertEqual(schema.class_dependencies(), [Baz, AA, XX, BB])
167
183
 
@@ -90,7 +90,7 @@ class Conversation(Completion):
90
90
  self, input_message: lf.Message | str, lm_response: lf.Message | str
91
91
  ) -> None:
92
92
  """Adds a turn."""
93
- self.memory.remember(input_message, lm_response)
93
+ self.memory.remember((input_message, lm_response))
94
94
 
95
95
  def reset(self) -> None:
96
96
  """Resets current conversation."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langfun
3
- Version: 0.1.2.dev202505060804
3
+ Version: 0.1.2.dev202505080804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors