langfun 0.1.2.dev202501160804__tar.gz → 0.1.2.dev202501180803__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 (159) hide show
  1. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/PKG-INFO +1 -1
  2. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/__init__.py +45 -17
  3. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic.py +1 -123
  4. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic_test.py +0 -48
  5. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/gemini.py +1 -1
  6. langfun-0.1.2.dev202501180803/langfun/core/llms/vertexai.py +561 -0
  7. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/vertexai_test.py +52 -0
  8. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/PKG-INFO +1 -1
  9. langfun-0.1.2.dev202501160804/langfun/core/llms/vertexai.py +0 -192
  10. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/LICENSE +0 -0
  11. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/README.md +0 -0
  12. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/__init__.py +0 -0
  13. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/__init__.py +0 -0
  14. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/__init__.py +0 -0
  15. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action.py +0 -0
  16. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_eval.py +0 -0
  17. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_eval_test.py +0 -0
  18. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_test.py +0 -0
  19. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/__init__.py +0 -0
  20. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/__init__.py +0 -0
  21. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/correction.py +0 -0
  22. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/correction_test.py +0 -0
  23. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/execution.py +0 -0
  24. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/execution_test.py +0 -0
  25. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/generation.py +0 -0
  26. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/generation_test.py +0 -0
  27. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/parsing.py +0 -0
  28. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/parsing_test.py +0 -0
  29. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/component.py +0 -0
  30. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/component_test.py +0 -0
  31. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/concurrent.py +0 -0
  32. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/concurrent_test.py +0 -0
  33. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/console.py +0 -0
  34. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/console_test.py +0 -0
  35. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/__init__.py +0 -0
  36. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/base.py +0 -0
  37. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/base_test.py +0 -0
  38. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/matching.py +0 -0
  39. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/matching_test.py +0 -0
  40. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/patching.py +0 -0
  41. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/patching_test.py +0 -0
  42. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/scoring.py +0 -0
  43. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/scoring_test.py +0 -0
  44. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/__init__.py +0 -0
  45. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/checkpointing.py +0 -0
  46. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/checkpointing_test.py +0 -0
  47. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/eval_test_helper.py +0 -0
  48. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/evaluation.py +0 -0
  49. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/evaluation_test.py +0 -0
  50. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/example.py +0 -0
  51. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/example_test.py +0 -0
  52. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/experiment.py +0 -0
  53. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/experiment_test.py +0 -0
  54. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metric_values.py +0 -0
  55. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metric_values_test.py +0 -0
  56. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metrics.py +0 -0
  57. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metrics_test.py +0 -0
  58. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress.py +0 -0
  59. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_test.py +0 -0
  60. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_tracking.py +0 -0
  61. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
  62. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/reporting.py +0 -0
  63. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/reporting_test.py +0 -0
  64. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/runners.py +0 -0
  65. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/runners_test.py +0 -0
  66. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/langfunc.py +0 -0
  67. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/langfunc_test.py +0 -0
  68. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/language_model.py +0 -0
  69. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/language_model_test.py +0 -0
  70. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/__init__.py +0 -0
  71. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/base.py +0 -0
  72. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/in_memory.py +0 -0
  73. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/in_memory_test.py +0 -0
  74. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/compositional.py +0 -0
  75. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/compositional_test.py +0 -0
  76. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/deepseek.py +0 -0
  77. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/deepseek_test.py +0 -0
  78. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/fake.py +0 -0
  79. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/fake_test.py +0 -0
  80. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/gemini_test.py +0 -0
  81. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/google_genai.py +0 -0
  82. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/google_genai_test.py +0 -0
  83. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/groq.py +0 -0
  84. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/groq_test.py +0 -0
  85. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/llama_cpp.py +0 -0
  86. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/llama_cpp_test.py +0 -0
  87. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai.py +0 -0
  88. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_compatible.py +0 -0
  89. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_compatible_test.py +0 -0
  90. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_test.py +0 -0
  91. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/rest.py +0 -0
  92. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/rest_test.py +0 -0
  93. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/logging.py +0 -0
  94. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/logging_test.py +0 -0
  95. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/__init__.py +0 -0
  96. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/conversation_history.py +0 -0
  97. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/conversation_history_test.py +0 -0
  98. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memory.py +0 -0
  99. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/message.py +0 -0
  100. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/message_test.py +0 -0
  101. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/__init__.py +0 -0
  102. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/audio.py +0 -0
  103. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/audio_test.py +0 -0
  104. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/image.py +0 -0
  105. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/image_test.py +0 -0
  106. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/mime.py +0 -0
  107. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/mime_test.py +0 -0
  108. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/ms_office.py +0 -0
  109. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/ms_office_test.py +0 -0
  110. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/pdf.py +0 -0
  111. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/pdf_test.py +0 -0
  112. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/video.py +0 -0
  113. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/video_test.py +0 -0
  114. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modality.py +0 -0
  115. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modality_test.py +0 -0
  116. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/natural_language.py +0 -0
  117. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/natural_language_test.py +0 -0
  118. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/sampling.py +0 -0
  119. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/sampling_test.py +0 -0
  120. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/__init__.py +0 -0
  121. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/completion.py +0 -0
  122. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/completion_test.py +0 -0
  123. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/description.py +0 -0
  124. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/description_test.py +0 -0
  125. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/function_generation.py +0 -0
  126. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/function_generation_test.py +0 -0
  127. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/mapping.py +0 -0
  128. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/mapping_test.py +0 -0
  129. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/parsing.py +0 -0
  130. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/parsing_test.py +0 -0
  131. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/querying.py +0 -0
  132. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/querying_test.py +0 -0
  133. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema.py +0 -0
  134. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_generation.py +0 -0
  135. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_generation_test.py +0 -0
  136. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_test.py +0 -0
  137. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/scoring.py +0 -0
  138. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/scoring_test.py +0 -0
  139. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/tokenization.py +0 -0
  140. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/tokenization_test.py +0 -0
  141. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/subscription.py +0 -0
  142. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/subscription_test.py +0 -0
  143. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/template.py +0 -0
  144. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/template_test.py +0 -0
  145. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/__init__.py +0 -0
  146. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/completion.py +0 -0
  147. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/completion_test.py +0 -0
  148. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/conversation.py +0 -0
  149. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/conversation_test.py +0 -0
  150. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/demonstration.py +0 -0
  151. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/demonstration_test.py +0 -0
  152. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/selfplay.py +0 -0
  153. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/selfplay_test.py +0 -0
  154. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/SOURCES.txt +0 -0
  155. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/dependency_links.txt +0 -0
  156. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/requires.txt +0 -0
  157. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/top_level.txt +0 -0
  158. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/setup.cfg +0 -0
  159. {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langfun
3
- Version: 0.1.2.dev202501160804
3
+ Version: 0.1.2.dev202501180803
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -27,8 +27,15 @@ from langfun.core.llms.fake import StaticSequence
27
27
  # Compositional models.
28
28
  from langfun.core.llms.compositional import RandomChoice
29
29
 
30
- # REST-based models.
30
+ # Base models by request/response protocol.
31
31
  from langfun.core.llms.rest import REST
32
+ from langfun.core.llms.openai_compatible import OpenAICompatible
33
+ from langfun.core.llms.gemini import Gemini
34
+ from langfun.core.llms.anthropic import Anthropic
35
+
36
+ # Base models by serving platforms.
37
+ from langfun.core.llms.vertexai import VertexAI
38
+ from langfun.core.llms.groq import Groq
32
39
 
33
40
  # Gemini models.
34
41
  from langfun.core.llms.google_genai import GenAI
@@ -44,7 +51,7 @@ from langfun.core.llms.google_genai import GeminiFlash1_5_002
44
51
  from langfun.core.llms.google_genai import GeminiFlash1_5_001
45
52
  from langfun.core.llms.google_genai import GeminiPro1
46
53
 
47
- from langfun.core.llms.vertexai import VertexAI
54
+ from langfun.core.llms.vertexai import VertexAIGemini
48
55
  from langfun.core.llms.vertexai import VertexAIGeminiFlash2_0ThinkingExp_20241219
49
56
  from langfun.core.llms.vertexai import VertexAIGeminiFlash2_0Exp
50
57
  from langfun.core.llms.vertexai import VertexAIGeminiExp_20241206
@@ -57,9 +64,6 @@ from langfun.core.llms.vertexai import VertexAIGeminiFlash1_5_002
57
64
  from langfun.core.llms.vertexai import VertexAIGeminiFlash1_5_001
58
65
  from langfun.core.llms.vertexai import VertexAIGeminiPro1
59
66
 
60
- # Base for OpenAI-compatible models.
61
- from langfun.core.llms.openai_compatible import OpenAICompatible
62
-
63
67
  # OpenAI models.
64
68
  from langfun.core.llms.openai import OpenAI
65
69
 
@@ -114,20 +118,34 @@ from langfun.core.llms.openai import Gpt3Curie
114
118
  from langfun.core.llms.openai import Gpt3Babbage
115
119
  from langfun.core.llms.openai import Gpt3Ada
116
120
 
117
- from langfun.core.llms.anthropic import Anthropic
121
+ # Anthropic models.
122
+
118
123
  from langfun.core.llms.anthropic import Claude35Sonnet
119
124
  from langfun.core.llms.anthropic import Claude35Sonnet20241022
120
125
  from langfun.core.llms.anthropic import Claude35Sonnet20240620
121
126
  from langfun.core.llms.anthropic import Claude3Opus
122
127
  from langfun.core.llms.anthropic import Claude3Sonnet
123
128
  from langfun.core.llms.anthropic import Claude3Haiku
124
- from langfun.core.llms.anthropic import VertexAIAnthropic
125
- from langfun.core.llms.anthropic import VertexAIClaude3_5_Sonnet_20241022
126
- from langfun.core.llms.anthropic import VertexAIClaude3_5_Sonnet_20240620
127
- from langfun.core.llms.anthropic import VertexAIClaude3_5_Haiku_20241022
128
- from langfun.core.llms.anthropic import VertexAIClaude3_Opus_20240229
129
129
 
130
- from langfun.core.llms.groq import Groq
130
+ from langfun.core.llms.vertexai import VertexAIAnthropic
131
+ from langfun.core.llms.vertexai import VertexAIClaude3_5_Sonnet_20241022
132
+ from langfun.core.llms.vertexai import VertexAIClaude3_5_Sonnet_20240620
133
+ from langfun.core.llms.vertexai import VertexAIClaude3_5_Haiku_20241022
134
+ from langfun.core.llms.vertexai import VertexAIClaude3_Opus_20240229
135
+
136
+ # Misc open source models.
137
+
138
+ # Gemma models.
139
+ from langfun.core.llms.groq import GroqGemma2_9B_IT
140
+ from langfun.core.llms.groq import GroqGemma_7B_IT
141
+
142
+ # Llama models.
143
+ from langfun.core.llms.vertexai import VertexAILlama
144
+ from langfun.core.llms.vertexai import VertexAILlama3_2_90B
145
+ from langfun.core.llms.vertexai import VertexAILlama3_1_405B
146
+ from langfun.core.llms.vertexai import VertexAILlama3_1_70B
147
+ from langfun.core.llms.vertexai import VertexAILlama3_1_8B
148
+
131
149
  from langfun.core.llms.groq import GroqLlama3_2_3B
132
150
  from langfun.core.llms.groq import GroqLlama3_2_1B
133
151
  from langfun.core.llms.groq import GroqLlama3_1_70B
@@ -135,18 +153,28 @@ from langfun.core.llms.groq import GroqLlama3_1_8B
135
153
  from langfun.core.llms.groq import GroqLlama3_70B
136
154
  from langfun.core.llms.groq import GroqLlama3_8B
137
155
  from langfun.core.llms.groq import GroqLlama2_70B
156
+
157
+ # Mistral models.
158
+ from langfun.core.llms.vertexai import VertexAIMistral
159
+ from langfun.core.llms.vertexai import VertexAIMistralLarge_20241121
160
+ from langfun.core.llms.vertexai import VertexAIMistralLarge_20240724
161
+ from langfun.core.llms.vertexai import VertexAIMistralNemo_20240724
162
+ from langfun.core.llms.vertexai import VertexAICodestral_20250113
163
+ from langfun.core.llms.vertexai import VertexAICodestral_20240529
164
+
138
165
  from langfun.core.llms.groq import GroqMistral_8x7B
139
- from langfun.core.llms.groq import GroqGemma2_9B_IT
140
- from langfun.core.llms.groq import GroqGemma_7B_IT
166
+
167
+ # DeepSeek models.
168
+ from langfun.core.llms.deepseek import DeepSeek
169
+ from langfun.core.llms.deepseek import DeepSeekChat
170
+
171
+ # Whisper models.
141
172
  from langfun.core.llms.groq import GroqWhisper_Large_v3
142
173
  from langfun.core.llms.groq import GroqWhisper_Large_v3Turbo
143
174
 
144
175
  # LLaMA C++ models.
145
176
  from langfun.core.llms.llama_cpp import LlamaCppRemote
146
177
 
147
- # DeepSeek models.
148
- from langfun.core.llms.deepseek import DeepSeek
149
- from langfun.core.llms.deepseek import DeepSeekChat
150
178
 
151
179
  # Placeholder for Google-internal imports.
152
180
 
@@ -14,9 +14,8 @@
14
14
  """Language models from Anthropic."""
15
15
 
16
16
  import base64
17
- import functools
18
17
  import os
19
- from typing import Annotated, Any, Literal
18
+ from typing import Annotated, Any
20
19
 
21
20
  import langfun.core as lf
22
21
  from langfun.core import modalities as lf_modalities
@@ -24,20 +23,6 @@ from langfun.core.llms import rest
24
23
  import pyglove as pg
25
24
 
26
25
 
27
- try:
28
- # pylint: disable=g-import-not-at-top
29
- from google import auth as google_auth
30
- from google.auth import credentials as credentials_lib
31
- from google.auth.transport import requests as auth_requests
32
- Credentials = credentials_lib.Credentials
33
- # pylint: enable=g-import-not-at-top
34
- except ImportError:
35
- google_auth = None
36
- auth_requests = None
37
- credentials_lib = None
38
- Credentials = Any # pylint: disable=invalid-name
39
-
40
-
41
26
  SUPPORTED_MODELS_AND_SETTINGS = {
42
27
  # See https://docs.anthropic.com/claude/docs/models-overview
43
28
  # Rate limits from https://docs.anthropic.com/claude/reference/rate-limits
@@ -379,110 +364,3 @@ class Claude21(Anthropic):
379
364
  class ClaudeInstant(Anthropic):
380
365
  """Cheapest small and fast model, 100K context window."""
381
366
  model = 'claude-instant-1.2'
382
-
383
-
384
- #
385
- # Authropic models on VertexAI.
386
- #
387
-
388
-
389
- class VertexAIAnthropic(Anthropic):
390
- """Anthropic models on VertexAI."""
391
-
392
- project: Annotated[
393
- str | None,
394
- 'Google Cloud project ID.',
395
- ] = None
396
-
397
- location: Annotated[
398
- Literal['us-east5', 'europe-west1'],
399
- 'GCP location with Anthropic models hosted.'
400
- ] = 'us-east5'
401
-
402
- credentials: Annotated[
403
- Credentials | None, # pytype: disable=invalid-annotation
404
- (
405
- 'Credentials to use. If None, the default credentials '
406
- 'to the environment will be used.'
407
- ),
408
- ] = None
409
-
410
- api_version = 'vertex-2023-10-16'
411
-
412
- def _on_bound(self):
413
- super()._on_bound()
414
- if google_auth is None:
415
- raise ValueError(
416
- 'Please install "langfun[llm-google-vertex]" to use Vertex AI models.'
417
- )
418
- self._project = None
419
- self._credentials = None
420
-
421
- def _initialize(self):
422
- project = self.project or os.environ.get('VERTEXAI_PROJECT', None)
423
- if not project:
424
- raise ValueError(
425
- 'Please specify `project` during `__init__` or set environment '
426
- 'variable `VERTEXAI_PROJECT` with your Vertex AI project ID.'
427
- )
428
- self._project = project
429
- credentials = self.credentials
430
- if credentials is None:
431
- # Use default credentials.
432
- credentials = google_auth.default(
433
- scopes=['https://www.googleapis.com/auth/cloud-platform']
434
- )
435
- self._credentials = credentials
436
-
437
- @functools.cached_property
438
- def _session(self):
439
- assert self._api_initialized
440
- assert self._credentials is not None
441
- assert auth_requests is not None
442
- s = auth_requests.AuthorizedSession(self._credentials)
443
- s.headers.update(self.headers or {})
444
- return s
445
-
446
- @property
447
- def headers(self):
448
- return {
449
- 'Content-Type': 'application/json; charset=utf-8',
450
- }
451
-
452
- @property
453
- def api_endpoint(self) -> str:
454
- return (
455
- f'https://{self.location}-aiplatform.googleapis.com/v1/projects/'
456
- f'{self._project}/locations/{self.location}/publishers/anthropic/'
457
- f'models/{self.model}:streamRawPredict'
458
- )
459
-
460
- def request(
461
- self,
462
- prompt: lf.Message,
463
- sampling_options: lf.LMSamplingOptions
464
- ):
465
- request = super().request(prompt, sampling_options)
466
- request['anthropic_version'] = self.api_version
467
- del request['model']
468
- return request
469
-
470
-
471
- class VertexAIClaude3_Opus_20240229(VertexAIAnthropic): # pylint: disable=invalid-name
472
- """Anthropic's Claude 3 Opus model on VertexAI."""
473
- model = 'claude-3-opus@20240229'
474
-
475
-
476
- class VertexAIClaude3_5_Sonnet_20241022(VertexAIAnthropic): # pylint: disable=invalid-name
477
- """Anthropic's Claude 3.5 Sonnet model on VertexAI."""
478
- model = 'claude-3-5-sonnet-v2@20241022'
479
-
480
-
481
- class VertexAIClaude3_5_Sonnet_20240620(VertexAIAnthropic): # pylint: disable=invalid-name
482
- """Anthropic's Claude 3.5 Sonnet model on VertexAI."""
483
- model = 'claude-3-5-sonnet@20240620'
484
-
485
-
486
- class VertexAIClaude3_5_Haiku_20241022(VertexAIAnthropic): # pylint: disable=invalid-name
487
- """Anthropic's Claude 3.5 Haiku model on VertexAI."""
488
- model = 'claude-3-5-haiku@20241022'
@@ -19,9 +19,6 @@ from typing import Any
19
19
  import unittest
20
20
  from unittest import mock
21
21
 
22
- from google.auth import exceptions
23
- from langfun.core import language_model
24
- from langfun.core import message as lf_message
25
22
  from langfun.core import modalities as lf_modalities
26
23
  from langfun.core.llms import anthropic
27
24
  import pyglove as pg
@@ -186,50 +183,5 @@ class AnthropicTest(unittest.TestCase):
186
183
  lm('hello', max_attempts=1)
187
184
 
188
185
 
189
- class VertexAIAnthropicTest(unittest.TestCase):
190
- """Tests for VertexAI Anthropic models."""
191
-
192
- def test_basics(self):
193
- with self.assertRaisesRegex(ValueError, 'Please specify `project`'):
194
- lm = anthropic.VertexAIClaude3_5_Sonnet_20241022()
195
- lm('hi')
196
-
197
- model = anthropic.VertexAIClaude3_5_Sonnet_20241022(project='langfun')
198
-
199
- # NOTE(daiyip): For OSS users, default credentials are not available unless
200
- # users have already set up their GCP project. Therefore we ignore the
201
- # exception here.
202
- try:
203
- model._initialize()
204
- except exceptions.DefaultCredentialsError:
205
- pass
206
-
207
- self.assertEqual(
208
- model.api_endpoint,
209
- (
210
- 'https://us-east5-aiplatform.googleapis.com/v1/projects/'
211
- 'langfun/locations/us-east5/publishers/anthropic/'
212
- 'models/claude-3-5-sonnet-v2@20241022:streamRawPredict'
213
- )
214
- )
215
- request = model.request(
216
- lf_message.UserMessage('hi'),
217
- language_model.LMSamplingOptions(temperature=0.0),
218
- )
219
- self.assertEqual(
220
- request,
221
- {
222
- 'anthropic_version': 'vertex-2023-10-16',
223
- 'max_tokens': 8192,
224
- 'messages': [
225
- {'content': [{'text': 'hi', 'type': 'text'}], 'role': 'user'}
226
- ],
227
- 'stream': False,
228
- 'temperature': 0.0,
229
- 'top_k': 40,
230
- },
231
- )
232
-
233
-
234
186
  if __name__ == '__main__':
235
187
  unittest.main()
@@ -380,7 +380,7 @@ class Gemini(rest.REST):
380
380
  return (
381
381
  cost_per_1m_input_tokens * num_input_tokens
382
382
  + cost_per_1m_output_tokens * num_output_tokens
383
- ) / 1000_1000
383
+ ) / 1000_000
384
384
 
385
385
  @property
386
386
  def model_id(self) -> str: