langfun 0.1.2.dev202409110804__tar.gz → 0.1.2.dev202409120804__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.
Files changed (131) hide show
  1. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/PKG-INFO +4 -4
  2. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/README.md +1 -1
  3. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/component.py +1 -1
  4. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/base.py +1 -1
  5. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/google_genai.py +4 -4
  6. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/google_genai_test.py +27 -25
  7. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/schema.py +2 -12
  8. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun.egg-info/PKG-INFO +4 -4
  9. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun.egg-info/requires.txt +2 -2
  10. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/LICENSE +0 -0
  11. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/__init__.py +0 -0
  12. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/__init__.py +0 -0
  13. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/__init__.py +0 -0
  14. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/__init__.py +0 -0
  15. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/correction.py +0 -0
  16. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/correction_test.py +0 -0
  17. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/errors.py +0 -0
  18. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/errors_test.py +0 -0
  19. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/execution.py +0 -0
  20. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/execution_test.py +0 -0
  21. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/generation.py +0 -0
  22. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/generation_test.py +0 -0
  23. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/parsing.py +0 -0
  24. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/parsing_test.py +0 -0
  25. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/permissions.py +0 -0
  26. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/coding/python/permissions_test.py +0 -0
  27. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/component_test.py +0 -0
  28. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/concurrent.py +0 -0
  29. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/concurrent_test.py +0 -0
  30. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/console.py +0 -0
  31. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/console_test.py +0 -0
  32. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/__init__.py +0 -0
  33. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/base_test.py +0 -0
  34. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/matching.py +0 -0
  35. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/matching_test.py +0 -0
  36. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/patching.py +0 -0
  37. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/patching_test.py +0 -0
  38. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/scoring.py +0 -0
  39. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/eval/scoring_test.py +0 -0
  40. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/langfunc.py +0 -0
  41. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/langfunc_test.py +0 -0
  42. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/language_model.py +0 -0
  43. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/language_model_test.py +0 -0
  44. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/__init__.py +0 -0
  45. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/anthropic.py +0 -0
  46. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/anthropic_test.py +0 -0
  47. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/cache/__init__.py +0 -0
  48. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/cache/base.py +0 -0
  49. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/cache/in_memory.py +0 -0
  50. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/cache/in_memory_test.py +0 -0
  51. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/fake.py +0 -0
  52. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/fake_test.py +0 -0
  53. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/groq.py +0 -0
  54. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/groq_test.py +0 -0
  55. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/llama_cpp.py +0 -0
  56. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/llama_cpp_test.py +0 -0
  57. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/openai.py +0 -0
  58. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/openai_test.py +0 -0
  59. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/rest.py +0 -0
  60. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/rest_test.py +0 -0
  61. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/vertexai.py +0 -0
  62. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/llms/vertexai_test.py +0 -0
  63. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/logging.py +0 -0
  64. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/logging_test.py +0 -0
  65. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/memories/__init__.py +0 -0
  66. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/memories/conversation_history.py +0 -0
  67. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/memories/conversation_history_test.py +0 -0
  68. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/memory.py +0 -0
  69. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/message.py +0 -0
  70. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/message_test.py +0 -0
  71. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/__init__.py +0 -0
  72. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/audio.py +0 -0
  73. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/audio_test.py +0 -0
  74. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/image.py +0 -0
  75. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/image_test.py +0 -0
  76. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/mime.py +0 -0
  77. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/mime_test.py +0 -0
  78. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/ms_office.py +0 -0
  79. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/ms_office_test.py +0 -0
  80. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/pdf.py +0 -0
  81. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/pdf_test.py +0 -0
  82. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/video.py +0 -0
  83. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modalities/video_test.py +0 -0
  84. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modality.py +0 -0
  85. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/modality_test.py +0 -0
  86. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/natural_language.py +0 -0
  87. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/natural_language_test.py +0 -0
  88. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/repr_utils.py +0 -0
  89. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/repr_utils_test.py +0 -0
  90. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/sampling.py +0 -0
  91. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/sampling_test.py +0 -0
  92. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/__init__.py +0 -0
  93. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/completion.py +0 -0
  94. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/completion_test.py +0 -0
  95. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/description.py +0 -0
  96. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/description_test.py +0 -0
  97. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/function_generation.py +0 -0
  98. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/function_generation_test.py +0 -0
  99. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/mapping.py +0 -0
  100. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/mapping_test.py +0 -0
  101. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/parsing.py +0 -0
  102. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/parsing_test.py +0 -0
  103. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/prompting.py +0 -0
  104. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/prompting_test.py +0 -0
  105. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/schema_generation.py +0 -0
  106. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/schema_generation_test.py +0 -0
  107. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/schema_test.py +0 -0
  108. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/scoring.py +0 -0
  109. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/scoring_test.py +0 -0
  110. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/tokenization.py +0 -0
  111. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/structured/tokenization_test.py +0 -0
  112. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/subscription.py +0 -0
  113. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/subscription_test.py +0 -0
  114. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/template.py +0 -0
  115. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/template_test.py +0 -0
  116. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/__init__.py +0 -0
  117. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/completion.py +0 -0
  118. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/completion_test.py +0 -0
  119. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/conversation.py +0 -0
  120. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/conversation_test.py +0 -0
  121. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/demonstration.py +0 -0
  122. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/demonstration_test.py +0 -0
  123. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/selfplay.py +0 -0
  124. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/templates/selfplay_test.py +0 -0
  125. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/text_formatting.py +0 -0
  126. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun/core/text_formatting_test.py +0 -0
  127. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun.egg-info/SOURCES.txt +0 -0
  128. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun.egg-info/dependency_links.txt +0 -0
  129. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/langfun.egg-info/top_level.txt +0 -0
  130. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/setup.cfg +0 -0
  131. {langfun-0.1.2.dev202409110804 → langfun-0.1.2.dev202409120804}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.1.2.dev202409110804
3
+ Version: 0.1.2.dev202409120804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -21,11 +21,11 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Classifier: Topic :: Software Development :: Libraries
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
- Requires-Dist: pyglove>=0.4.5.dev20240824
24
+ Requires-Dist: pyglove>=0.4.5.dev202409110000
25
25
  Requires-Dist: jinja2>=3.1.2
26
26
  Requires-Dist: requests>=2.31.0
27
27
  Provides-Extra: all
28
- Requires-Dist: pyglove>=0.4.5.dev20240824; extra == "all"
28
+ Requires-Dist: pyglove>=0.4.5.dev202409110000; extra == "all"
29
29
  Requires-Dist: jinja2>=3.1.2; extra == "all"
30
30
  Requires-Dist: requests>=2.31.0; extra == "all"
31
31
  Requires-Dist: termcolor==1.1.0; extra == "all"
@@ -80,7 +80,7 @@ Requires-Dist: pandas>=2.0.3; extra == "mime-xlsx"
80
80
  [![codecov](https://codecov.io/gh/google/langfun/branch/main/graph/badge.svg)](https://codecov.io/gh/google/langfun)
81
81
  ![pytest](https://github.com/google/langfun/actions/workflows/ci.yaml/badge.svg)
82
82
 
83
- [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb) | [**Discord community**](https://discord.gg/U6wPN9R68k)
83
+ [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb)
84
84
 
85
85
  ## Introduction
86
86
 
@@ -8,7 +8,7 @@
8
8
  [![codecov](https://codecov.io/gh/google/langfun/branch/main/graph/badge.svg)](https://codecov.io/gh/google/langfun)
9
9
  ![pytest](https://github.com/google/langfun/actions/workflows/ci.yaml/badge.svg)
10
10
 
11
- [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb) | [**Discord community**](https://discord.gg/U6wPN9R68k)
11
+ [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb)
12
12
 
13
13
  ## Introduction
14
14
 
@@ -73,7 +73,7 @@ class Component(pg.Object):
73
73
  field.value.set_default(attr_value)
74
74
  additional_fields.append(field)
75
75
  if additional_fields:
76
- pg.symbolic.update_schema(cls, additional_fields)
76
+ cls.update_schema(additional_fields)
77
77
 
78
78
  def _on_bound(self):
79
79
  super()._on_bound()
@@ -941,7 +941,7 @@ class Evaluation(Evaluable):
941
941
 
942
942
  fields = list(cls.__schema__.values())
943
943
  fields.insert(0, (self.completion_prompt_field, pg.typing.Str()))
944
- pg.symbolic.update_schema(cls, fields, extend=False)
944
+ cls.update_schema(fields, extend=False)
945
945
 
946
946
  def _maybe_adjust_examples_for_completion(
947
947
  self,
@@ -27,18 +27,18 @@ try:
27
27
  import google.generativeai as genai # pylint: disable=g-import-not-at-top
28
28
  BlobDict = genai.types.BlobDict
29
29
  GenerativeModel = genai.GenerativeModel
30
- Completion = genai.types.Completion
30
+ Completion = getattr(genai.types, 'Completion', Any)
31
+ ChatResponse = getattr(genai.types, 'ChatResponse', Any)
32
+ GenerateContentResponse = getattr(genai.types, 'GenerateContentResponse', Any)
31
33
  GenerationConfig = genai.GenerationConfig
32
- GenerateContentResponse = genai.types.GenerateContentResponse
33
- ChatResponse = genai.types.ChatResponse
34
34
  except ImportError:
35
35
  genai = None
36
36
  BlobDict = Any
37
37
  GenerativeModel = Any
38
38
  Completion = Any
39
+ ChatResponse = Any
39
40
  GenerationConfig = Any
40
41
  GenerateContentResponse = Any
41
- ChatResponse = Any
42
42
 
43
43
 
44
44
  @lf.use_init_args(['model'])
@@ -192,39 +192,41 @@ class GenAITest(unittest.TestCase):
192
192
  def test_call_with_legacy_completion_model(self):
193
193
  orig_get_model = genai.get_model
194
194
  genai.get_model = mock_get_model
195
- orig_generate_text = genai.generate_text
196
- genai.generate_text = mock_generate_text
195
+ orig_generate_text = getattr(genai, 'generate_text', None)
196
+ if orig_generate_text is not None:
197
+ genai.generate_text = mock_generate_text
197
198
 
198
- lm = google_genai.Palm2(api_key='test_key')
199
- self.maxDiff = None
200
- self.assertEqual(
201
- lm('hello', temperature=2.0, top_k=20).text,
202
- (
203
- "hello to models/text-bison-001 with {'temperature': 2.0, "
204
- "'top_k': 20, 'top_p': None, 'candidate_count': 1, "
205
- "'max_output_tokens': None, 'stop_sequences': None}"
206
- ),
207
- )
199
+ lm = google_genai.Palm2(api_key='test_key')
200
+ self.maxDiff = None
201
+ self.assertEqual(
202
+ lm('hello', temperature=2.0, top_k=20).text,
203
+ (
204
+ "hello to models/text-bison-001 with {'temperature': 2.0, "
205
+ "'top_k': 20, 'top_p': None, 'candidate_count': 1, "
206
+ "'max_output_tokens': None, 'stop_sequences': None}"
207
+ ),
208
+ )
209
+ genai.generate_text = orig_generate_text
208
210
  genai.get_model = orig_get_model
209
- genai.generate_text = orig_generate_text
210
211
 
211
212
  def test_call_with_legacy_chat_model(self):
212
213
  orig_get_model = genai.get_model
213
214
  genai.get_model = mock_get_model
214
- orig_chat = genai.chat
215
- genai.chat = mock_chat
215
+ orig_chat = getattr(genai, 'chat', None)
216
+ if orig_chat is not None:
217
+ genai.chat = mock_chat
216
218
 
217
- lm = google_genai.Palm2_IT(api_key='test_key')
218
- self.maxDiff = None
219
- self.assertEqual(
220
- lm('hello', temperature=2.0, top_k=20).text,
221
- (
222
- "hello to models/chat-bison-001 with {'temperature': 2.0, "
223
- "'top_k': 20, 'top_p': None, 'candidate_count': 1}"
224
- ),
225
- )
219
+ lm = google_genai.Palm2_IT(api_key='test_key')
220
+ self.maxDiff = None
221
+ self.assertEqual(
222
+ lm('hello', temperature=2.0, top_k=20).text,
223
+ (
224
+ "hello to models/chat-bison-001 with {'temperature': 2.0, "
225
+ "'top_k': 20, 'top_p': None, 'candidate_count': 1}"
226
+ ),
227
+ )
228
+ genai.chat = orig_chat
226
229
  genai.get_model = orig_get_model
227
- genai.chat = orig_chat
228
230
 
229
231
 
230
232
  if __name__ == '__main__':
@@ -262,7 +262,7 @@ def class_dependencies(
262
262
  )
263
263
 
264
264
  # Add members as dependencies.
265
- for field in _pg_schema(vs.cls).values():
265
+ for field in pg.schema(vs.cls).values():
266
266
  _fill_dependencies(field.value, include_subclasses)
267
267
  _add_dependency(vs.cls)
268
268
 
@@ -390,7 +390,7 @@ def class_definition(
390
390
  ) -> str:
391
391
  """Returns the Python class definition."""
392
392
  out = io.StringIO()
393
- schema = _pg_schema(cls)
393
+ schema = pg.schema(cls)
394
394
  eligible_bases = []
395
395
  for base_cls in cls.__bases__:
396
396
  if base_cls is not object:
@@ -913,13 +913,3 @@ class Unknown(pg.Object, pg.typing.CustomTyping):
913
913
 
914
914
 
915
915
  UNKNOWN = Unknown()
916
-
917
-
918
- def _pg_schema(cls: Type[Any]) -> pg.Schema:
919
- """Returns PyGlove schema for the constructor of a class."""
920
- schema = getattr(cls, '__schema__', None)
921
- if schema is None:
922
- schema = pg.symbolic.callable_schema(
923
- cls.__init__, auto_typing=True, auto_doc=True, remove_self=True
924
- )
925
- return schema
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.1.2.dev202409110804
3
+ Version: 0.1.2.dev202409120804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -21,11 +21,11 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Classifier: Topic :: Software Development :: Libraries
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
- Requires-Dist: pyglove>=0.4.5.dev20240824
24
+ Requires-Dist: pyglove>=0.4.5.dev202409110000
25
25
  Requires-Dist: jinja2>=3.1.2
26
26
  Requires-Dist: requests>=2.31.0
27
27
  Provides-Extra: all
28
- Requires-Dist: pyglove>=0.4.5.dev20240824; extra == "all"
28
+ Requires-Dist: pyglove>=0.4.5.dev202409110000; extra == "all"
29
29
  Requires-Dist: jinja2>=3.1.2; extra == "all"
30
30
  Requires-Dist: requests>=2.31.0; extra == "all"
31
31
  Requires-Dist: termcolor==1.1.0; extra == "all"
@@ -80,7 +80,7 @@ Requires-Dist: pandas>=2.0.3; extra == "mime-xlsx"
80
80
  [![codecov](https://codecov.io/gh/google/langfun/branch/main/graph/badge.svg)](https://codecov.io/gh/google/langfun)
81
81
  ![pytest](https://github.com/google/langfun/actions/workflows/ci.yaml/badge.svg)
82
82
 
83
- [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb) | [**Discord community**](https://discord.gg/U6wPN9R68k)
83
+ [**Installation**](#install) | [**Getting started**](#hello-langfun) | [**Tutorial**](https://colab.research.google.com/github/google/langfun/blob/main/docs/notebooks/langfun101.ipynb)
84
84
 
85
85
  ## Introduction
86
86
 
@@ -1,9 +1,9 @@
1
- pyglove>=0.4.5.dev20240824
1
+ pyglove>=0.4.5.dev202409110000
2
2
  jinja2>=3.1.2
3
3
  requests>=2.31.0
4
4
 
5
5
  [all]
6
- pyglove>=0.4.5.dev20240824
6
+ pyglove>=0.4.5.dev202409110000
7
7
  jinja2>=3.1.2
8
8
  requests>=2.31.0
9
9
  termcolor==1.1.0