langfun 0.1.2.dev202410010804__py3-none-any.whl → 0.1.2.dev202410050804__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.
@@ -171,31 +171,6 @@ class Matching(base.Evaluation):
171
171
  ) -> None:
172
172
  super().save(definition, result, report)
173
173
 
174
- if result:
175
- # Save matches.
176
- pg.save(
177
- [
178
- pg.symbolic.deref(
179
- pg.Dict(input=input, output=output), recursive=True
180
- )
181
- for input, output, _ in self.matches
182
- ],
183
- os.path.join(self.dir, Matching.MATCHES_JSON),
184
- )
185
-
186
- # Save mismatches.
187
- pg.save(
188
- [
189
- # We force the output to be dict as its type may be defined
190
- # within functors which could be deserialized.
191
- pg.symbolic.deref(
192
- pg.Dict(input=input, output=output), recursive=True
193
- )
194
- for input, output, _ in self.mismatches
195
- ],
196
- os.path.join(self.dir, Matching.MISMATCHES_JSON),
197
- )
198
-
199
174
  if report:
200
175
  pg.save(
201
176
  self._html([self._render_result, self._render_matches]),
@@ -152,18 +152,6 @@ class MatchingTest(unittest.TestCase):
152
152
  os.path.join(s.dir, matching.Matching.CACHE_JSON)
153
153
  )
154
154
  )
155
- self.assertTrue(
156
- os.path.exists(
157
- os.path.join(s.dir, matching.Matching.MATCHES_JSON)
158
- )
159
- )
160
- self.assertTrue(
161
- os.path.exists(
162
- os.path.join(
163
- s.dir, matching.Matching.MISMATCHES_JSON
164
- )
165
- )
166
- )
167
155
  self.assertTrue(
168
156
  os.path.exists(
169
157
  os.path.join(
@@ -102,6 +102,7 @@ from langfun.core.llms.groq import GroqMistral_8x7B
102
102
  from langfun.core.llms.groq import GroqGemma7B_IT
103
103
 
104
104
  from langfun.core.llms.vertexai import VertexAI
105
+ from langfun.core.llms.vertexai import VertexAIGemini1_5
105
106
  from langfun.core.llms.vertexai import VertexAIGeminiPro1_5
106
107
  from langfun.core.llms.vertexai import VertexAIGeminiPro1_5_Latest
107
108
  from langfun.core.llms.vertexai import VertexAIGeminiPro1_5_001
@@ -416,104 +416,84 @@ _DOCUMENT_TYPES = [
416
416
  'text/plain',
417
417
  'text/csv',
418
418
  'text/html',
419
+ 'text/xml',
420
+ 'text/x-script.python',
421
+ 'application/json',
419
422
  ]
420
423
 
421
424
 
422
- class VertexAIGeminiPro1_5_Latest(VertexAI): # pylint: disable=invalid-name
423
- """Vertex AI Gemini 1.5 Pro model."""
425
+ class VertexAIGemini1_5(VertexAI): # pylint: disable=invalid-name
426
+ """Vertex AI Gemini 1.5 model."""
424
427
 
425
- model = 'gemini-1.5-pro-latest'
426
428
  supported_modalities = (
427
429
  _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
428
430
  )
429
431
 
430
432
 
431
- class VertexAIGeminiPro1_5(VertexAI): # pylint: disable=invalid-name
433
+ class VertexAIGeminiPro1_5_Latest(VertexAIGemini1_5): # pylint: disable=invalid-name
434
+ """Vertex AI Gemini 1.5 Pro model."""
435
+
436
+ model = 'gemini-1.5-pro-latest'
437
+
438
+
439
+ class VertexAIGeminiPro1_5(VertexAIGemini1_5): # pylint: disable=invalid-name
432
440
  """Vertex AI Gemini 1.5 Pro model."""
433
441
 
434
442
  model = 'gemini-1.5-pro'
435
- supported_modalities = (
436
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
437
- )
438
443
 
439
444
 
440
- class VertexAIGeminiPro1_5_002(VertexAI): # pylint: disable=invalid-name
445
+ class VertexAIGeminiPro1_5_002(VertexAIGemini1_5): # pylint: disable=invalid-name
441
446
  """Vertex AI Gemini 1.5 Pro model."""
442
447
 
443
448
  model = 'gemini-1.5-pro-002'
444
- supported_modalities = (
445
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
446
- )
447
449
 
448
450
 
449
- class VertexAIGeminiPro1_5_001(VertexAI): # pylint: disable=invalid-name
451
+ class VertexAIGeminiPro1_5_001(VertexAIGemini1_5): # pylint: disable=invalid-name
450
452
  """Vertex AI Gemini 1.5 Pro model."""
451
453
 
452
454
  model = 'gemini-1.5-pro-001'
453
- supported_modalities = (
454
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
455
- )
456
455
 
457
456
 
458
- class VertexAIGeminiPro1_5_0514(VertexAI): # pylint: disable=invalid-name
457
+ class VertexAIGeminiPro1_5_0514(VertexAIGemini1_5): # pylint: disable=invalid-name
459
458
  """Vertex AI Gemini 1.5 Pro preview model."""
460
459
 
461
460
  model = 'gemini-1.5-pro-preview-0514'
462
- supported_modalities = (
463
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
464
- )
465
461
 
466
462
 
467
- class VertexAIGeminiPro1_5_0409(VertexAI): # pylint: disable=invalid-name
463
+ class VertexAIGeminiPro1_5_0409(VertexAIGemini1_5): # pylint: disable=invalid-name
468
464
  """Vertex AI Gemini 1.5 Pro preview model."""
469
465
 
470
466
  model = 'gemini-1.5-pro-preview-0409'
471
- supported_modalities = (
472
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
473
- )
474
467
 
475
468
 
476
- class VertexAIGeminiFlash1_5_Latest(VertexAI): # pylint: disable=invalid-name
469
+ class VertexAIGeminiFlash1_5_Latest(VertexAIGemini1_5): # pylint: disable=invalid-name
477
470
  """Vertex AI Gemini 1.5 Flash model."""
478
471
 
479
472
  model = 'gemini-1.5-flash-latest'
480
- supported_modalities = (
481
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
482
- )
483
473
 
484
474
 
485
- class VertexAIGeminiFlash1_5(VertexAI): # pylint: disable=invalid-name
475
+ class VertexAIGeminiFlash1_5(VertexAIGemini1_5): # pylint: disable=invalid-name
486
476
  """Vertex AI Gemini 1.5 Flash model."""
477
+
487
478
  model = 'gemini-1.5-flash'
488
- supported_modalities = (
489
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
490
- )
491
479
 
492
480
 
493
- class VertexAIGeminiFlash1_5_002(VertexAI): # pylint: disable=invalid-name
481
+ class VertexAIGeminiFlash1_5_002(VertexAIGemini1_5): # pylint: disable=invalid-name
494
482
  """Vertex AI Gemini 1.5 Flash model."""
495
483
 
496
484
  model = 'gemini-1.5-flash-002'
497
- supported_modalities = (
498
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
499
- )
500
485
 
501
486
 
502
- class VertexAIGeminiFlash1_5_001(VertexAI): # pylint: disable=invalid-name
487
+ class VertexAIGeminiFlash1_5_001(VertexAIGemini1_5): # pylint: disable=invalid-name
503
488
  """Vertex AI Gemini 1.5 Flash model."""
489
+
504
490
  model = 'gemini-1.5-flash-001'
505
- supported_modalities = (
506
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
507
- )
508
491
 
509
492
 
510
- class VertexAIGeminiFlash1_5_0514(VertexAI): # pylint: disable=invalid-name
493
+ class VertexAIGeminiFlash1_5_0514(VertexAIGemini1_5): # pylint: disable=invalid-name
511
494
  """Vertex AI Gemini 1.5 Flash preview model."""
512
495
 
513
496
  model = 'gemini-1.5-flash-preview-0514'
514
- supported_modalities = (
515
- _DOCUMENT_TYPES + _IMAGE_TYPES + _AUDIO_TYPES + _VIDEO_TYPES
516
- )
517
497
 
518
498
 
519
499
  class VertexAIGeminiPro1(VertexAI): # pylint: disable=invalid-name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.1.2.dev202410010804
3
+ Version: 0.1.2.dev202410050804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -46,13 +46,13 @@ langfun/core/coding/python/permissions_test.py,sha256=w5EDb8QxpxgJyZkojyzVWQvDfg
46
46
  langfun/core/eval/__init__.py,sha256=Ogdr9OtTywhhLPHi3AZzOD2mXX2oyaHWflrSTMm96uA,1899
47
47
  langfun/core/eval/base.py,sha256=3ALt5L51C7jnulLuJMw2uhEvB01d-GNuG-9iMtxM4ic,75230
48
48
  langfun/core/eval/base_test.py,sha256=iL-EEGnBD_HigClBwo34HVyOycupgw9r4S61eIZMShI,26929
49
- langfun/core/eval/matching.py,sha256=KooNeNQFFV56sFbSAdn-kmXuJc2Nj4LEd6rwVJ6lYgY,10033
50
- langfun/core/eval/matching_test.py,sha256=f7iVyXH5KGJBWt4Wp14Bt9J3X59A6Ayfog9MbuFvPew,5532
49
+ langfun/core/eval/matching.py,sha256=lkI3dtvJe5ql1ppA8Dy6oNVvu5YNtemRos73WQMsgSY,9278
50
+ langfun/core/eval/matching_test.py,sha256=QCoYEuf4b_1bkHqUCuRzKMbXHrV3AB2FCOBivo1stC4,5249
51
51
  langfun/core/eval/patching.py,sha256=R0s2eAd1m97exQt06dmUL0V_MBG0W2Hxg7fhNB7cXW0,3866
52
52
  langfun/core/eval/patching_test.py,sha256=8kCd54Egjju22FMgtJuxEsrXkW8ifs-UUBHtrCG1L6w,4775
53
53
  langfun/core/eval/scoring.py,sha256=wZz90Iw5Sco3cAiA1T71cJEWhD6qmvMeE1Ai-pez_aY,6210
54
54
  langfun/core/eval/scoring_test.py,sha256=O8olHbrUEg60gMxwOkWzKBJZpZoUlmVnBANX5Se2SXM,4546
55
- langfun/core/llms/__init__.py,sha256=lmOl2HoUYDeAnSJjObd9DfhEuchfvmrJ-GeKTbVFqds,5427
55
+ langfun/core/llms/__init__.py,sha256=yeN5Bj_QDZpnSG8EeSaDiqpcVGQR3iitxG1EwE6dGAU,5484
56
56
  langfun/core/llms/anthropic.py,sha256=Gon3fOi31RhZFgNd0ijyTnKnUdp9hrWrCoSXyO4UaLw,7316
57
57
  langfun/core/llms/anthropic_test.py,sha256=T-swuMkfnlgs8Fpif4rtXs579exGk0TsbLMirXDZCkg,5533
58
58
  langfun/core/llms/fake.py,sha256=gCHBYBLvBCsC78HI1hpoqXCS-p1FMTgY1P1qh_sGBPk,3070
@@ -67,7 +67,7 @@ langfun/core/llms/openai.py,sha256=vnDrKuD-pli0AtDIDq_TmlltOk7z7_PQ-xpU4K1ARdU,1
67
67
  langfun/core/llms/openai_test.py,sha256=UcBFW_7RkkMEo47Tn5RuVRK_DryTN7bb9ITphlzthE8,17762
68
68
  langfun/core/llms/rest.py,sha256=laopuq-zD8V-3Y6eFDngftHEbE66VlUkCD2-rvvRaLU,3388
69
69
  langfun/core/llms/rest_test.py,sha256=NZ3Nf0XQVpT9kLP5cBVo_yBHLI7vWTYhWQxYEJVMGs4,3472
70
- langfun/core/llms/vertexai.py,sha256=Y3MrxYguUzIbr-IcxzUSGBjAL8FLX0K4TwbgI18OY5c,16977
70
+ langfun/core/llms/vertexai.py,sha256=M6iR_I8hx7SgGFQ7LCZOjOwUml4YRcjtXFOptAyTNVE,16272
71
71
  langfun/core/llms/vertexai_test.py,sha256=EPR-mB2hNUpvpf7E8m_k5bh04epdQTVUuYU6hPgZyu8,10321
72
72
  langfun/core/llms/cache/__init__.py,sha256=QAo3InUMDM_YpteNnVCSejI4zOsnjSMWKJKzkb3VY64,993
73
73
  langfun/core/llms/cache/base.py,sha256=rt3zwmyw0y9jsSGW-ZbV1vAfLxQ7_3AVk0l2EySlse4,3918
@@ -119,8 +119,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
119
119
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
120
120
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
121
121
  langfun/core/templates/selfplay_test.py,sha256=rBW2Qr8yi-aWYwoTwRR-n1peKyMX9QXPZXURjLgoiRs,2264
122
- langfun-0.1.2.dev202410010804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
123
- langfun-0.1.2.dev202410010804.dist-info/METADATA,sha256=eMVQPftNt81odrRYiba82BwjeI0ztGW5iJzZtQPR2J8,8890
124
- langfun-0.1.2.dev202410010804.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
125
- langfun-0.1.2.dev202410010804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
126
- langfun-0.1.2.dev202410010804.dist-info/RECORD,,
122
+ langfun-0.1.2.dev202410050804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
123
+ langfun-0.1.2.dev202410050804.dist-info/METADATA,sha256=0Cl9NYSAnOGw29-OnMCIf-0CMi3wF0p5jDMJADImVKw,8890
124
+ langfun-0.1.2.dev202410050804.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
125
+ langfun-0.1.2.dev202410050804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
126
+ langfun-0.1.2.dev202410050804.dist-info/RECORD,,