langfun 0.0.2.dev20240429__py3-none-any.whl → 0.0.2.dev20240511__py3-none-any.whl

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 (37) hide show
  1. langfun/__init__.py +5 -0
  2. langfun/core/eval/__init__.py +14 -1
  3. langfun/core/eval/base.py +503 -112
  4. langfun/core/eval/base_test.py +185 -53
  5. langfun/core/eval/matching.py +22 -21
  6. langfun/core/eval/matching_test.py +23 -2
  7. langfun/core/eval/patching.py +130 -0
  8. langfun/core/eval/patching_test.py +170 -0
  9. langfun/core/eval/scoring.py +4 -4
  10. langfun/core/eval/scoring_test.py +19 -2
  11. langfun/core/langfunc.py +1 -17
  12. langfun/core/langfunc_test.py +4 -0
  13. langfun/core/language_model.py +6 -0
  14. langfun/core/llms/__init__.py +8 -0
  15. langfun/core/llms/fake.py +6 -6
  16. langfun/core/llms/google_genai.py +8 -0
  17. langfun/core/llms/openai.py +3 -2
  18. langfun/core/llms/openai_test.py +2 -1
  19. langfun/core/llms/vertexai.py +291 -0
  20. langfun/core/llms/vertexai_test.py +233 -0
  21. langfun/core/modalities/image.py +1 -3
  22. langfun/core/modalities/mime.py +6 -0
  23. langfun/core/modalities/video.py +1 -3
  24. langfun/core/structured/__init__.py +2 -0
  25. langfun/core/structured/mapping.py +5 -1
  26. langfun/core/structured/prompting.py +39 -11
  27. langfun/core/structured/prompting_test.py +43 -0
  28. langfun/core/structured/schema.py +34 -4
  29. langfun/core/structured/schema_test.py +32 -1
  30. langfun/core/structured/scoring.py +4 -1
  31. langfun/core/structured/scoring_test.py +6 -0
  32. langfun/core/template.py +22 -1
  33. {langfun-0.0.2.dev20240429.dist-info → langfun-0.0.2.dev20240511.dist-info}/METADATA +2 -2
  34. {langfun-0.0.2.dev20240429.dist-info → langfun-0.0.2.dev20240511.dist-info}/RECORD +37 -33
  35. {langfun-0.0.2.dev20240429.dist-info → langfun-0.0.2.dev20240511.dist-info}/LICENSE +0 -0
  36. {langfun-0.0.2.dev20240429.dist-info → langfun-0.0.2.dev20240511.dist-info}/WHEEL +0 -0
  37. {langfun-0.0.2.dev20240429.dist-info → langfun-0.0.2.dev20240511.dist-info}/top_level.txt +0 -0
langfun/__init__.py CHANGED
@@ -33,6 +33,11 @@ complete = structured.complete
33
33
  score = structured.score
34
34
  generate_class = structured.generate_class
35
35
 
36
+ # Helper functions for input/output transformations based on
37
+ # `lf.query` (e.g. jax-on-beam could use these for batch processing)
38
+ query_prompt = structured.query_prompt
39
+ query_output = structured.query_output
40
+
36
41
  source_form = structured.source_form
37
42
  function_gen = structured.function_gen
38
43
 
@@ -16,7 +16,11 @@
16
16
  # pylint: disable=g-importing-member
17
17
  # pylint: disable=g-bad-import-order
18
18
 
19
- from langfun.core.eval.base import app_run
19
+ from langfun.core.eval.base import register
20
+ from langfun.core.eval.base import registered_names
21
+ from langfun.core.eval.base import get_evaluation
22
+ from langfun.core.eval.base import get
23
+ from langfun.core.eval.base import run
20
24
 
21
25
  from langfun.core.eval.base import Evaluable
22
26
  from langfun.core.eval.base import Evaluation
@@ -34,6 +38,15 @@ from langfun.core.eval.base import as_inputs
34
38
  from langfun.core.eval.matching import Matching
35
39
  from langfun.core.eval.scoring import Scoring
36
40
 
41
+ # Experiment patching.
42
+ from langfun.core.eval.patching import patch_member
37
43
 
44
+ from langfun.core.eval.patching import patch_lm
45
+ from langfun.core.eval.patching import patch_parsing_lm
46
+ from langfun.core.eval.patching import patch_inputs
47
+ from langfun.core.eval.patching import patch_prompt
48
+ from langfun.core.eval.patching import patch_schema_fn
49
+
50
+ # Placeholder for Google-internal imports.
38
51
  # pylint: enable=g-bad-import-order
39
52
  # pylint: enable=g-importing-member