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.
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/PKG-INFO +1 -1
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/__init__.py +45 -17
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic.py +1 -123
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic_test.py +0 -48
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/gemini.py +1 -1
- langfun-0.1.2.dev202501180803/langfun/core/llms/vertexai.py +561 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/vertexai_test.py +52 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/PKG-INFO +1 -1
- langfun-0.1.2.dev202501160804/langfun/core/llms/vertexai.py +0 -192
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/LICENSE +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/README.md +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_eval.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_eval_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/agentic/action_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/correction.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/correction_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/execution.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/execution_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/generation.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/generation_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/parsing.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/coding/python/parsing_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/component.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/component_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/concurrent.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/concurrent_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/console.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/console_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/base.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/base_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/matching.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/matching_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/patching.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/patching_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/scoring.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/scoring_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/checkpointing.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/checkpointing_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/eval_test_helper.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/evaluation.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/evaluation_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/example.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/example_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/experiment.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/experiment_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metric_values.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metric_values_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metrics.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/metrics_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_tracking.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/progress_tracking_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/reporting.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/reporting_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/runners.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/eval/v2/runners_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/langfunc.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/langfunc_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/language_model.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/language_model_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/base.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/in_memory.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/cache/in_memory_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/compositional.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/compositional_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/deepseek.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/deepseek_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/fake.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/fake_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/gemini_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/google_genai.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/google_genai_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/groq.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/groq_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/llama_cpp.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/llama_cpp_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_compatible.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_compatible_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/openai_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/rest.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/rest_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/logging.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/logging_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/conversation_history.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memories/conversation_history_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/memory.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/message.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/message_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/audio.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/audio_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/image.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/image_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/mime.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/mime_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/ms_office.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/ms_office_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/pdf.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/pdf_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/video.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modalities/video_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modality.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/modality_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/natural_language.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/natural_language_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/sampling.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/sampling_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/completion.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/completion_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/description.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/description_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/function_generation.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/function_generation_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/mapping.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/mapping_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/parsing.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/parsing_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/querying.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/querying_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_generation.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_generation_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/schema_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/scoring.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/scoring_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/tokenization.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/structured/tokenization_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/subscription.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/subscription_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/template.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/template_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/__init__.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/completion.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/completion_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/conversation.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/conversation_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/demonstration.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/demonstration_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/selfplay.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/templates/selfplay_test.py +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/SOURCES.txt +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/dependency_links.txt +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/requires.txt +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun.egg-info/top_level.txt +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/setup.cfg +0 -0
- {langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/setup.py +0 -0
{langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/__init__.py
RENAMED
@@ -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
|
-
#
|
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
|
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
|
-
|
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.
|
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
|
-
|
140
|
-
|
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
|
|
{langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic.py
RENAMED
@@ -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
|
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'
|
{langfun-0.1.2.dev202501160804 → langfun-0.1.2.dev202501180803}/langfun/core/llms/anthropic_test.py
RENAMED
@@ -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()
|