langfun 0.0.2.dev20240319__py3-none-any.whl → 0.0.2.dev20240429__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.
Files changed (52) hide show
  1. langfun/__init__.py +2 -0
  2. langfun/core/__init__.py +1 -0
  3. langfun/core/coding/python/correction.py +0 -7
  4. langfun/core/component.py +6 -0
  5. langfun/core/component_test.py +1 -0
  6. langfun/core/eval/__init__.py +2 -0
  7. langfun/core/eval/base.py +240 -37
  8. langfun/core/eval/base_test.py +52 -18
  9. langfun/core/eval/matching.py +26 -9
  10. langfun/core/eval/matching_test.py +3 -4
  11. langfun/core/eval/scoring.py +15 -6
  12. langfun/core/eval/scoring_test.py +2 -2
  13. langfun/core/langfunc.py +0 -5
  14. langfun/core/langfunc_test.py +6 -4
  15. langfun/core/language_model.py +124 -24
  16. langfun/core/language_model_test.py +249 -26
  17. langfun/core/llms/__init__.py +24 -5
  18. langfun/core/llms/anthropic.py +263 -0
  19. langfun/core/llms/anthropic_test.py +167 -0
  20. langfun/core/llms/cache/in_memory_test.py +37 -28
  21. langfun/core/llms/fake.py +31 -22
  22. langfun/core/llms/fake_test.py +122 -11
  23. langfun/core/llms/{gemini.py → google_genai.py} +117 -15
  24. langfun/core/llms/{gemini_test.py → google_genai_test.py} +83 -15
  25. langfun/core/llms/groq.py +260 -0
  26. langfun/core/llms/groq_test.py +170 -0
  27. langfun/core/llms/llama_cpp.py +3 -1
  28. langfun/core/llms/openai.py +97 -79
  29. langfun/core/llms/openai_test.py +285 -59
  30. langfun/core/modalities/video.py +5 -2
  31. langfun/core/structured/__init__.py +3 -0
  32. langfun/core/structured/completion_test.py +2 -2
  33. langfun/core/structured/function_generation.py +245 -0
  34. langfun/core/structured/function_generation_test.py +329 -0
  35. langfun/core/structured/mapping.py +59 -3
  36. langfun/core/structured/mapping_test.py +17 -0
  37. langfun/core/structured/parsing.py +2 -1
  38. langfun/core/structured/parsing_test.py +18 -13
  39. langfun/core/structured/prompting.py +27 -6
  40. langfun/core/structured/prompting_test.py +79 -12
  41. langfun/core/structured/schema.py +25 -22
  42. langfun/core/structured/schema_generation.py +2 -3
  43. langfun/core/structured/schema_generation_test.py +2 -2
  44. langfun/core/structured/schema_test.py +42 -27
  45. langfun/core/template.py +125 -10
  46. langfun/core/template_test.py +75 -0
  47. langfun/core/templates/selfplay_test.py +6 -2
  48. {langfun-0.0.2.dev20240319.dist-info → langfun-0.0.2.dev20240429.dist-info}/METADATA +3 -2
  49. {langfun-0.0.2.dev20240319.dist-info → langfun-0.0.2.dev20240429.dist-info}/RECORD +52 -46
  50. {langfun-0.0.2.dev20240319.dist-info → langfun-0.0.2.dev20240429.dist-info}/LICENSE +0 -0
  51. {langfun-0.0.2.dev20240319.dist-info → langfun-0.0.2.dev20240429.dist-info}/WHEEL +0 -0
  52. {langfun-0.0.2.dev20240319.dist-info → langfun-0.0.2.dev20240429.dist-info}/top_level.txt +0 -0
langfun/core/template.py CHANGED
@@ -38,13 +38,22 @@ NO_TEMPLATE_DOCSTR_SIGN = 'THIS IS NOT A TEMPLATE'
38
38
  _TLS_RENDER_STACK = '_template_render_stack'
39
39
  _TLS_RENDER_RESULT_CACHE = '_template_render_result_cache'
40
40
 
41
+ # The prefix for fields or contextual attributes to be treated as additional
42
+ # metadata for rendered message.
43
+ _ADDITIONAL_METADATA_PREFIX = 'metadata_'
44
+
41
45
 
42
46
  class Template(
43
47
  natural_language.NaturalLanguageFormattable,
44
48
  component.Component,
45
49
  pg.typing.CustomTyping,
46
50
  ):
47
- """Langfun string template."""
51
+ """Langfun string template.
52
+
53
+ Langfun uses jinja2 as its template engine. Pleaes check out
54
+ https://jinja.palletsprojects.com/en/3.1.x/templates/ for detailed
55
+ explanation on the template language.
56
+ """
48
57
 
49
58
  template_str: Annotated[
50
59
  str,
@@ -97,6 +106,11 @@ class Template(
97
106
  # Declare template variables as symbolic attributes.
98
107
  template_vars = Template.resolve_vars(template_str)
99
108
  for var_name in template_vars:
109
+ if 'DEFAULT' == var_name:
110
+ raise ValueError(
111
+ '`{{ DEFAULT }}` cannot be used in pre-configured templates. '
112
+ f'Encountered: {template_str!r}'
113
+ )
100
114
  # NOTE(daiyip): This is to avoid warning from accessing
101
115
  # `pg.Object.schema`, which was replaced by `pg.Object.__schema__`.
102
116
  if var_name == 'schema' or not hasattr(cls, var_name):
@@ -149,7 +163,7 @@ class Template(
149
163
  # TODO(daiyip): Consider to delay template parsing upon usage.
150
164
  unassigned_vars = {}
151
165
  for k in self._variables:
152
- if not hasattr(self, k):
166
+ if k not in ('DEFAULT',) and not hasattr(self, k):
153
167
  unassigned_vars[k] = component.contextual()
154
168
  if unassigned_vars:
155
169
  self.rebind(unassigned_vars, skip_notification=True)
@@ -303,19 +317,19 @@ class Template(
303
317
  with modality.format_modality_as_ref():
304
318
  rendered_text = self._template.render(**inputs)
305
319
 
320
+ # Carry additional metadata.
321
+ metadata = self.additional_metadata()
322
+
306
323
  if self.clean:
307
324
  rendered_text = rendered_text.strip()
308
325
 
309
- # Fill the variables for rendering the template as metadata.
310
- message = message_cls(
311
- text=rendered_text,
312
- metadata={
313
- k: pg.Ref(v)
314
- for k, v in inputs.items()
315
- if not inspect.ismethod(v)
316
- },
326
+ metadata.update(
327
+ {k: pg.Ref(v) for k, v in inputs.items() if not inspect.ismethod(v)}
317
328
  )
318
329
 
330
+ # Fill the variables for rendering the template as metadata.
331
+ message = message_cls(text=rendered_text, metadata=metadata)
332
+
319
333
  # Tag input as rendered message.
320
334
  message.tag(message_lib.Message.TAG_RENDERED)
321
335
 
@@ -340,6 +354,20 @@ class Template(
340
354
  top = pg.object_utils.thread_local_pop(_TLS_RENDER_STACK)
341
355
  assert top is self, (top, self)
342
356
 
357
+ def additional_metadata(self) -> dict[str, Any]:
358
+ """Returns additional metadta to be carried in the rendered message."""
359
+ metadata = {}
360
+ # Carry metadata from `lf.context`.
361
+ for k, v in component.all_contextual_values().items():
362
+ if k.startswith(_ADDITIONAL_METADATA_PREFIX):
363
+ metadata[k.removeprefix(_ADDITIONAL_METADATA_PREFIX)] = v
364
+
365
+ # Carry metadata from fields.
366
+ for k, v in self.sym_init_args.items():
367
+ if k.startswith(_ADDITIONAL_METADATA_PREFIX):
368
+ metadata[k.removeprefix(_ADDITIONAL_METADATA_PREFIX)] = v
369
+ return metadata
370
+
343
371
  #
344
372
  # Implements `pg.typing.CustomTyping`.
345
373
  #
@@ -380,6 +408,93 @@ class Template(
380
408
  # Override __hash__ since __eq__ has changed.
381
409
  return object.__hash__(self)
382
410
 
411
+ #
412
+ # Special methods.
413
+ #
414
+
415
+ @property
416
+ def DEFAULT(self) -> 'Template':
417
+ """Referring to the default value used for this template.
418
+
419
+ This method is intended to be used in template for referring to the default
420
+ value of current template. There are two scenarios:
421
+
422
+ Scenario 1: Use instance-level template_str to override the class default.
423
+
424
+ ```
425
+ class Foo(lf.Template):
426
+ '''Foo template.
427
+
428
+ This is {{x}}.
429
+ '''
430
+
431
+ f = Foo(template_str='<h1>{{DEFAULT}}</h1>', x=1)
432
+ f.render()
433
+
434
+ >> <h1>This is 1.</h1>
435
+ ```
436
+
437
+ Scenario 2: Use an ad-hoc template to override a predefined field.
438
+
439
+ ```
440
+ class Bar(lf.Template):
441
+ '''Bar template.
442
+
443
+ {{preamble}}
444
+ {{prompt}}
445
+ '''
446
+ preamble: lf.Template = lf.Template('You are a chat bot.')
447
+ prompt: lf.Template = lf.Template('User: hi')
448
+
449
+ b = Bar(preamble=lf.Template('<h1>{{DEFAULT}}<h1>'),
450
+ prompt=lf.Template('<h2>{{DEFAULT}}</h2>')
451
+ b.render()
452
+
453
+ >> <h1>You are a chat bot.<h1>
454
+ >> <h2>User: hi</h2>
455
+ ```
456
+
457
+ Returns:
458
+ The default (pre-configured) value used for this template.
459
+ """
460
+ base_template = self.__class__.__schema__['template_str'].default_value
461
+ if base_template == pg.MISSING_VALUE:
462
+ if not self.sym_path:
463
+ raise ValueError(
464
+ f'No DEFAULT template found for {self!r}: '
465
+ 'The template neither has a default `template_str` nor is '
466
+ 'contained under another object.'
467
+ )
468
+ key = self.sym_path.key
469
+ assert self.sym_parent is not None
470
+ assigned_field = self.sym_parent.sym_attr_field(key)
471
+ container_cls = self.sym_parent.__class__
472
+
473
+ if (
474
+ assigned_field is None
475
+ or assigned_field.default_value == pg.MISSING_VALUE
476
+ ):
477
+ raise ValueError(
478
+ f'No DEFAULT template found for {self!r}: '
479
+ f'`{container_cls.__name__}.{key}` '
480
+ 'does not have a default value. '
481
+ )
482
+ base_template = assigned_field.default_value
483
+ if isinstance(base_template, Template):
484
+ base_template = base_template.template_str
485
+ if not isinstance(base_template, str):
486
+ raise ValueError(
487
+ f'No DEFAULT template found for {self!r}: The default '
488
+ f'value {base_template!r} of '
489
+ f'`{container_cls.__name__}.{key}` is not a '
490
+ '`lf.Template` object or str.'
491
+ )
492
+ t = Template(base_template)
493
+ # NOTE(daiyip): Set the parent of the newly created template to self so
494
+ # it could access all the contextual variables.
495
+ t.sym_setparent(self)
496
+ return t
497
+
383
498
 
384
499
  # Register converter from str to LangFunc, therefore we can always
385
500
  # pass strs to attributes that accept LangFunc.
@@ -16,6 +16,7 @@ import inspect
16
16
  import unittest
17
17
 
18
18
  from langfun.core import component
19
+ from langfun.core import message as message_lib
19
20
  from langfun.core import modality
20
21
  from langfun.core import subscription
21
22
  from langfun.core.template import Template
@@ -311,6 +312,72 @@ class RenderTest(unittest.TestCase):
311
312
  'This is 1 and {{a}}',
312
313
  )
313
314
 
315
+ def test_render_with_default(self):
316
+
317
+ class Foo(Template):
318
+ """Foo.
319
+
320
+ This is {{x}}
321
+ """
322
+
323
+ f = Foo(template_str='!{{DEFAULT}}!', x=1)
324
+ self.assertEqual(f.DEFAULT.x, 1)
325
+ self.assertEqual(
326
+ f.render(), '!This is 1!'
327
+ )
328
+
329
+ class Bar(Template):
330
+ """Bar.
331
+
332
+ {{preamble}}
333
+ {{prompt}}
334
+ """
335
+
336
+ preamble: Template = Template('You are a chat bot.')
337
+ prompt: Template = Template('User: hi! {{name}}')
338
+
339
+ b = Bar(
340
+ preamble=Template('<h1>{{DEFAULT}}</h1>'),
341
+ prompt=Template('<h2>{{DEFAULT}}</h2>'),
342
+ name='Tom',
343
+ )
344
+ # Test variable access.
345
+ self.assertEqual(
346
+ b.render(),
347
+ inspect.cleandoc("""
348
+ <h1>You are a chat bot.</h1>
349
+ <h2>User: hi! Tom</h2>
350
+ """),
351
+ )
352
+
353
+ with self.assertRaisesRegex(ValueError, '`{{ DEFAULT }}` cannot be used'):
354
+
355
+ class Baz(Template): # pylint: disable=unused-variable
356
+ """Baz.
357
+
358
+ {{DEFAULT}}
359
+ """
360
+
361
+ with self.assertRaisesRegex(
362
+ ValueError, 'The template neither has a default `template_str` nor'
363
+ ):
364
+ Template('{{DEFAULT}}').render()
365
+
366
+ d = pg.Dict(x=Template('{{DEFAULT}}'))
367
+ with self.assertRaisesRegex(
368
+ ValueError, 'does not have a default value'
369
+ ):
370
+ _ = d.x.DEFAULT
371
+
372
+ class Tes(pg.Object):
373
+ x: str | None = None
374
+
375
+ t = Tes(x=Template('{{DEFAULT}}'))
376
+ with self.assertRaisesRegex(
377
+ ValueError, 'is not a `lf.Template` object or str'
378
+ ):
379
+ _ = t.x.DEFAULT
380
+
314
381
  def test_bad_render(self):
315
382
  with self.assertRaises(ValueError):
316
383
  Template('Hello {{x}}').render(allow_partial=False)
@@ -427,6 +494,14 @@ class RenderTest(unittest.TestCase):
427
494
  # Test len.
428
495
  self.assert_partial(Template('Hello {{len(x)}}'), 'Hello {{len(x)}}')
429
496
 
497
+ def test_additional_metadata(self):
498
+ t = Template('hi', metadata_weights=1.0, y=2)
499
+ self.assertEqual(t.render(), message_lib.UserMessage('hi', weights=1.0))
500
+
501
+ t = Template('hi')
502
+ with component.context(metadata_weights=1.0, y=2):
503
+ self.assertEqual(t.render(), message_lib.UserMessage('hi', weights=1.0))
504
+
430
505
 
431
506
  class TemplateRenderEventTest(unittest.TestCase):
432
507
 
@@ -56,7 +56,9 @@ class SelfPlayTest(unittest.TestCase):
56
56
  g = NumberGuess(target_num=10)
57
57
 
58
58
  with lf.context(lm=NumberGuesser(guesses=[50, 20, 5, 10])):
59
- self.assertEqual(g(), lf.AIMessage('10', score=0.0, logprobs=None))
59
+ self.assertEqual(
60
+ g(), lf.AIMessage('10', score=0.0, logprobs=None, usage=None)
61
+ )
60
62
 
61
63
  self.assertEqual(g.num_turns, 4)
62
64
 
@@ -64,7 +66,9 @@ class SelfPlayTest(unittest.TestCase):
64
66
  g = NumberGuess(target_num=10, max_turns=10)
65
67
 
66
68
  with lf.context(lm=NumberGuesser(guesses=[50, 20, 5, 2, 5, 4])):
67
- self.assertEqual(g(), lf.AIMessage('2', score=0.0, logprobs=None))
69
+ self.assertEqual(
70
+ g(), lf.AIMessage('2', score=0.0, logprobs=None, usage=None)
71
+ )
68
72
 
69
73
  self.assertEqual(g.num_turns, 10)
70
74
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.0.2.dev20240319
3
+ Version: 0.0.2.dev20240429
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -21,10 +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: absl-py >=1.0.0
24
25
  Requires-Dist: google-generativeai >=0.3.2
25
26
  Requires-Dist: jinja2 >=3.1.2
26
27
  Requires-Dist: openai ==0.27.2
27
- Requires-Dist: pyglove >=0.4.5.dev20240314
28
+ Requires-Dist: pyglove >=0.4.5.dev20240423
28
29
  Requires-Dist: python-magic >=0.4.27
29
30
  Requires-Dist: requests >=2.31.0
30
31
  Requires-Dist: termcolor ==1.1.0
@@ -1,15 +1,15 @@
1
- langfun/__init__.py,sha256=PqX3u18BC0szYIMu00j-RKxvwkNPwXtAFZ-96oxrQ0M,1841
2
- langfun/core/__init__.py,sha256=sVcPl89lWYHQ1cUoaLaM8dErCovugJo5e2F3A_94Q3Y,4192
3
- langfun/core/component.py,sha256=VRPfDB_2jEnxcB3-HoiVjG4ID-SMenNPIsytb0uXMPg,9674
4
- langfun/core/component_test.py,sha256=VAPd6V_-odAe8rBvesW3ogYDd6OSqRq4FaPhfgOM4Zg,7949
1
+ langfun/__init__.py,sha256=zh-EYTCLxkUAIc2zMo3Lye46_CrMrhwO_GwBHZspUvE,1919
2
+ langfun/core/__init__.py,sha256=6QEuXOZ9BXxm6TjpaMXuLwUBTYO3pkFDqn9QVBXyyPQ,4248
3
+ langfun/core/component.py,sha256=oxesbC0BoE_TbtxwW5x-BAZWxZyyJbuPiX5S38RqCv0,9909
4
+ langfun/core/component_test.py,sha256=uR-_Sz_42Jxc5qzLIB-f5_pXmNwnC01Xlbv5NOQSeSU,8021
5
5
  langfun/core/concurrent.py,sha256=TRc49pJ3HQro2kb5FtcWkHjhBm8UcgE8RJybU5cU3-0,24537
6
6
  langfun/core/concurrent_test.py,sha256=mwFMZhDUdppnDr7vDSTwcbMHwrdsIoKJwRYNtl4ZWL4,15185
7
7
  langfun/core/console.py,sha256=bk5rNPNm9rMGW5YT2HixxU04p2umnoabn5SDz6Dqe88,2317
8
8
  langfun/core/console_test.py,sha256=5SYJdxpJGLgdSSQqqMPoA1X6jpsLD8rgcyk-EgI65oE,1077
9
- langfun/core/langfunc.py,sha256=WXdTc3QsmGD_n80KD9dFRr5MHpGZ9E_y_Rhtk4t9-3w,11852
10
- langfun/core/langfunc_test.py,sha256=dFNJoEXExIkrAJ9_PSWh_iRQoR4Gmp2VOZ_ve61DSHM,8339
11
- langfun/core/language_model.py,sha256=jPuFfjnRCnbT8po-CBPgmXoa09Yfk5_21snCXURqaKU,17011
12
- langfun/core/language_model_test.py,sha256=q7pNdirVWfkQXPA3taCGnyLB2NNs1KqX4JjjnoJvFOQ,11365
9
+ langfun/core/langfunc.py,sha256=bRujJfH4iTwKFtFxQf745uJkfltuFnPfOGLuP8ydcr4,11646
10
+ langfun/core/langfunc_test.py,sha256=sQaKuZpGGmG80GRifhbxkj7nfzQLJKj4Vuw5y1s1K3U,8378
11
+ langfun/core/language_model.py,sha256=dypSV3kr6BLC7hsvV1_QOiqrHUHWtOjQfyFqH79WZmU,20052
12
+ langfun/core/language_model_test.py,sha256=T-itu7Li2smv2dkru0C0neCs2W4VJXlNTYahXU6jF54,19548
13
13
  langfun/core/memory.py,sha256=f-asN1F7Vehgdn_fK84v73GrEUOxRtaW934keutTKjk,2416
14
14
  langfun/core/message.py,sha256=QhvV9t5qaryPcruyxxcXi3gm9QDInkSldwTtK6sVJ3c,15734
15
15
  langfun/core/message_test.py,sha256=Z23pUM5vPnDrYkIIibe2KL73D5HKur_awI0ut_EQFQA,9501
@@ -21,13 +21,13 @@ langfun/core/sampling.py,sha256=vygWvgC8MFw0_AKNSmz-ywMXJYWf8cl0tI8QycvAmyI,5795
21
21
  langfun/core/sampling_test.py,sha256=U7PANpMsl9E_pa4_Y4FzesSjcwg-u-LKHGCWSgv-8FY,3663
22
22
  langfun/core/subscription.py,sha256=euawEuSZP-BHydaT-AQpfYFL0m5pWPGcW0upFhrojqc,10930
23
23
  langfun/core/subscription_test.py,sha256=Y4ZdbZEwm83YNZBxHff0QR4QUa4rdaNXA3_jfIcArBo,8717
24
- langfun/core/template.py,sha256=zVD8dAsXFfgF25aKh2WqSuCEHVqriCC-4tLbQqTMa2w,17662
25
- langfun/core/template_test.py,sha256=1hDdYfvXJVoslTUudh3WhxU7VnDSiIz6MkxPfmuHKAY,13572
24
+ langfun/core/template.py,sha256=FZByYq6mhVDjT4HJ3yY-_TUZ13BiURzTJSKLw6QyLY4,21462
25
+ langfun/core/template_test.py,sha256=Mbv0dFjboGCVvbDkHD-HacZnlCi8Ku2Hpf2UjdwGSNo,15464
26
26
  langfun/core/text_formatting.py,sha256=ytjj7opnRJ6w-pkglL2CZUyfYDXLpNf65E42LBb31gc,5158
27
27
  langfun/core/text_formatting_test.py,sha256=nyKC6tn2L4hPJiqQHgxcbQsJJi4A4Nbj8FiO8iT6B80,1514
28
28
  langfun/core/coding/__init__.py,sha256=5utju_fwEsImaiftx4oXKl9FAM8p281k8-Esdh_-m1w,835
29
29
  langfun/core/coding/python/__init__.py,sha256=MJ-vubliz-ebrZH3OBRKBwMi0S9-FrhGCp8YQLR6_I4,1776
30
- langfun/core/coding/python/correction.py,sha256=uuQmZCrAl0EA9etIUmn2-FZ-ge8iNcjOAAlm-WgkYfo,6776
30
+ langfun/core/coding/python/correction.py,sha256=a2aFUt9ocbXTCR6Z6OGNjQZDI1LfU0PBkSe7hJB8dEM,6589
31
31
  langfun/core/coding/python/correction_test.py,sha256=yLqmQ9BPORsnREkrS10PnljEaLR3BoydTVeT3OGoqfU,3507
32
32
  langfun/core/coding/python/errors.py,sha256=fX3Du63uGm25YFXW9D-bV2gntTdTAX3hBFtAnRlmg14,3166
33
33
  langfun/core/coding/python/errors_test.py,sha256=_ZbWJCFIb-FkCK7K1zCuH8W3x_NFt-jNe3dfP8yqaD4,2323
@@ -39,26 +39,30 @@ langfun/core/coding/python/parsing.py,sha256=uyvI1c5OLZhMVK2Oltkl3oJxSLlG0wadlpQ
39
39
  langfun/core/coding/python/parsing_test.py,sha256=9vAWF484kWIm6JZq8NFiMgKUDhXV-deRl1QMmNERfAA,7386
40
40
  langfun/core/coding/python/permissions.py,sha256=1QWGHvzL8MM0Ok_auQ9tURqZHtdOfJaDpBzZ29GUE-c,2544
41
41
  langfun/core/coding/python/permissions_test.py,sha256=w5EDb8QxpxgJyZkojyzVWQvDfg366zn99-g__6TbPQ0,2699
42
- langfun/core/eval/__init__.py,sha256=iDA2OcJ3kR6ixZizXIY3N9LsjkaVrfTbSClTiSP8ekY,1291
43
- langfun/core/eval/base.py,sha256=tT_85jpLMCbXufKf64BMslid9FB1TNhe3AIkIpLULhA,53782
44
- langfun/core/eval/base_test.py,sha256=3AG-PN6yv0DMcHvpPas2nv2bJoY9JdAYSYwiPUnnolo,21177
45
- langfun/core/eval/matching.py,sha256=g2yuBb4FeOlAlB10hqdWvaIg4QVQlJbiViRDcD2Y8go,9567
46
- langfun/core/eval/matching_test.py,sha256=IfuMF_dEmy4VzK6tIldRzD2Nqlml7SSh4u-baFNcZrw,4912
47
- langfun/core/eval/scoring.py,sha256=mshqbV_WM0zcp15TSR32ACMBDymlsbf6YH06PPx1Tw0,6139
48
- langfun/core/eval/scoring_test.py,sha256=_L_B40VZkyI2_PJce-jVKYC4llrO4jGUR5j86Gu6AT0,4046
49
- langfun/core/llms/__init__.py,sha256=T4mgT091BLA4mHrOjAvEGhZPHf0tiYgqD88l_JTp1dQ,2386
50
- langfun/core/llms/fake.py,sha256=dVzOrW27RZ1p3DdQoRCRZs_vfoQcTcNrlWxia7oqmvw,2499
51
- langfun/core/llms/fake_test.py,sha256=Qk_Yoi4Z7P9o6f8Q_BZkaSlvxH89ZVsDxnVIbSBRBXk,3555
52
- langfun/core/llms/gemini.py,sha256=E7JGewkgjMzuDQxAn8CBbwWsDDZH4jcmNbzmO3OvdsY,5474
53
- langfun/core/llms/gemini_test.py,sha256=ybNNCn3JW3hYpMe0wT5ILGDrMPaYYU8PN2kSookM0jk,5433
54
- langfun/core/llms/llama_cpp.py,sha256=sJ9TOismqwGJ7QhgdYknWTEkqrbeZpWYc_nClOh36NU,2320
42
+ langfun/core/eval/__init__.py,sha256=NSmPe2lxdxFoY4h8VkNyONPAFtOTUpK9WhmZRaqUgiI,1335
43
+ langfun/core/eval/base.py,sha256=1svQoZ0C2DGCVLvr0Qt0TcrlJKtJptdoOBVAxkxnHoU,60264
44
+ langfun/core/eval/base_test.py,sha256=g3lRp2dcq411cLYHpn8spI4feyv2nOccs5PlFBwav3g,22512
45
+ langfun/core/eval/matching.py,sha256=Ks-L9vyMNDj4R8zFczzByT_4DK2wAFatyCZupdHzx_g,9932
46
+ langfun/core/eval/matching_test.py,sha256=5Qs9ETaLoyNcJ43f-_bK2Bfe--2Y3U79DnSA55-l6pc,4932
47
+ langfun/core/eval/scoring.py,sha256=A3y6HMcmpREQPqUD-WtImYOb2jG-23WpcUO2-WGhel0,6360
48
+ langfun/core/eval/scoring_test.py,sha256=vxJR-2rBghUDUOCLTIMd6M3i1F8xDhA-U45wuBHVfc0,4058
49
+ langfun/core/llms/__init__.py,sha256=1bPg1QI8duOZCYINm-jWi094x0JtLmsk4KX60qIC_gs,3245
50
+ langfun/core/llms/anthropic.py,sha256=7W9YdPN3SlAFhAIQlihMkrpo7tTY_4NvD0KIlCrqcsk,8505
51
+ langfun/core/llms/anthropic_test.py,sha256=TMM30myyEhwF99Le4RvJEXOn8RYl0q1FRkt9Q9nl1jk,5540
52
+ langfun/core/llms/fake.py,sha256=b-Xk5IPTbUt-elsyzd_i3n1tqzc_kgETXrEvgJruSMk,2824
53
+ langfun/core/llms/fake_test.py,sha256=ipKfdOcuqVcJ8lDXVpnBVb9HHG0hAVkFkMoHpWjC2cI,7212
54
+ langfun/core/llms/google_genai.py,sha256=n8zyJwh9UCTgb6-8LyvmjVNFGZQ4-zfzZ0ulkhHAnR8,8624
55
+ langfun/core/llms/google_genai_test.py,sha256=_UcGTfl16-aDUlEWFC2W2F8y9jPUs53RBYA6MOCpGXw,7525
56
+ langfun/core/llms/groq.py,sha256=NaGItVL_pkOpqPpI4bPGU27xLFRoaeizZ49v2s-4ERs,7844
57
+ langfun/core/llms/groq_test.py,sha256=M6GtlrsOvDun_j-sR8cPh4W_moHWZNSTiThu3kuwbbc,5281
58
+ langfun/core/llms/llama_cpp.py,sha256=Y_KkMUf3Xfac49koMUtUslKl3h-HWp3-ntq7Jaa3bdo,2385
55
59
  langfun/core/llms/llama_cpp_test.py,sha256=ZxC6defGd_HX9SFRU9U4cJiQnBKundbOrchbXuC1Z2M,1683
56
- langfun/core/llms/openai.py,sha256=BV8NWjB1b6A1X4Kff8Pub5AECodsngZnXqeBvRIHFM0,11331
57
- langfun/core/llms/openai_test.py,sha256=yfw7A-4Zo9u1cIkAMk39evE-tO7z6isNYTXiSnJXDQw,7599
60
+ langfun/core/llms/openai.py,sha256=06nPhmw0zIA5Zqv3eqsrZtYLHnKwW7N8yt3LlFUFVpI,13247
61
+ langfun/core/llms/openai_test.py,sha256=MiLqBaYliAkWVEwOBmX3HTj_eAuWLv77q8-I3VyVEBU,14841
58
62
  langfun/core/llms/cache/__init__.py,sha256=QAo3InUMDM_YpteNnVCSejI4zOsnjSMWKJKzkb3VY64,993
59
63
  langfun/core/llms/cache/base.py,sha256=cFfYvOIUae842pncqCAsRvqXCk2AnAsRYVx0mcIoAeY,3338
60
64
  langfun/core/llms/cache/in_memory.py,sha256=YfFyJEhLs73cUiB0ZfhMxYpdE8Iuxxw-dvMFwGHTSHw,4742
61
- langfun/core/llms/cache/in_memory_test.py,sha256=WYLg_SlUdkUxIdBYnbksMqwVLFuzcNLsPTEJSQavtr0,8459
65
+ langfun/core/llms/cache/in_memory_test.py,sha256=D-n26h__rVXQO51WRFhRfq5sw1oifRLx2SvCQWuNEm8,8747
62
66
  langfun/core/memories/__init__.py,sha256=HpghfZ-w1NQqzJXBx8Lz0daRhB2rcy2r9Xm491SBhC4,773
63
67
  langfun/core/memories/conversation_history.py,sha256=c9amD8hCxGFiZuVAzkP0dOMWSp8L90uvwkOejjuBqO0,1835
64
68
  langfun/core/memories/conversation_history_test.py,sha256=AaW8aNoFjxNusanwJDV0r3384Mg0eAweGmPx5DIkM0Y,2052
@@ -67,23 +71,25 @@ langfun/core/modalities/image.py,sha256=zNpLHwJi6PJMeeAcVQG6vn0oYIbilTuJq6xu-Tvr
67
71
  langfun/core/modalities/image_test.py,sha256=YxDRvC49Bjwyyndd_P7y6XjyS7dOft0Zewwxk-7q4kE,2301
68
72
  langfun/core/modalities/mime.py,sha256=wVfaYflhGz1W4v3m972rAplW3OGOFtjFpHDYIaUD5D0,2238
69
73
  langfun/core/modalities/mime_test.py,sha256=cVHxRvJ1QXC1SVhBmWkJdWGpL9Xl0UNfTQq6j0OGGL4,1881
70
- langfun/core/modalities/video.py,sha256=5-sIlzXb_ZY84RMFcpVD9ysP9GbcwbdKaZOEm3jECtc,1469
74
+ langfun/core/modalities/video.py,sha256=25M4XsNG5XEWRy57LYT_a6_aMURMPAgC41B3weEXFsY,1747
71
75
  langfun/core/modalities/video_test.py,sha256=jYuI2m8S8zDCAVBPEUbbpP205dXAht90A2_PHWo4-r8,2039
72
- langfun/core/structured/__init__.py,sha256=SpObW-HKpyKvkLlX8FV5ixz7CRm098j2aGfOguM3AUI,3462
76
+ langfun/core/structured/__init__.py,sha256=zO6mdApZgWy6d2i3s_FWrjHS_-7qWnase0VRq0KhKn0,3589
73
77
  langfun/core/structured/completion.py,sha256=skBxt6V_fv2TBUKnzFgnPMbVY8HSYn8sY04MLok2yvs,7299
74
- langfun/core/structured/completion_test.py,sha256=98UCgA4gzfp6H6HgP2s2kcKs25YH3k4Nxj1rgAvmVBw,19249
78
+ langfun/core/structured/completion_test.py,sha256=MYxEzeScC3gFVujvrMMboBF5nh-QiVLwGgqAV3oaFUQ,19273
75
79
  langfun/core/structured/description.py,sha256=SXW4MJvshFjbR-0gw6rE21o6WXq12UlRXawvDBXMZFA,5211
76
80
  langfun/core/structured/description_test.py,sha256=UtZGjSFUaQ6130t1E5tcL7ODu0xIefkapb53TbnqsK8,7362
77
- langfun/core/structured/mapping.py,sha256=tahkaAB-L6yKbYb7qjVI301-FfIARdw4w8nP3wqS2-k,10291
78
- langfun/core/structured/mapping_test.py,sha256=07DDCGbwytQHSMm7fCi5-Ly-JNgdV4ubHZq0wthX4A4,3338
79
- langfun/core/structured/parsing.py,sha256=yTKuezai5i-X9W-jU0DeEZzqHHbCFom0plj-D0bhp98,11436
80
- langfun/core/structured/parsing_test.py,sha256=2_Uf3LYNRON1-5ysEr75xiG_cAxR3ZiixSfvUQu6mOQ,20846
81
- langfun/core/structured/prompting.py,sha256=0xRPC0K_RaFRv-j52x8_-1n1eRFSomJEpdZApVXsCV0,6902
82
- langfun/core/structured/prompting_test.py,sha256=SwoYbPyKhUT1H2QbqHvl93biCiE9Ttn1aWixoHH-v9Y,19129
83
- langfun/core/structured/schema.py,sha256=60griJ-yC1SExX6g-aOcAOo8yFh53CdwMV4EVK3ivug,25207
84
- langfun/core/structured/schema_generation.py,sha256=Yv9flJ4GTtLw-bDB8S7A93G-z4gXsFMkMASkbiduT3E,5353
85
- langfun/core/structured/schema_generation_test.py,sha256=cfZyP0gHno2fXy_c9vsVdvHmqKQSfuyUsCtfO3JFmYQ,2945
86
- langfun/core/structured/schema_test.py,sha256=kMIgnAzm3f2O5ofn0pPKjT6H8hny4cWVaUVDOZuyjOQ,21987
81
+ langfun/core/structured/function_generation.py,sha256=pFgS3vcRAWiuFBol2x5Eeip3XqoudONsOpeJpWyjT3s,7479
82
+ langfun/core/structured/function_generation_test.py,sha256=ZJI-aaGgWWszn92u7h5IZ9Pl70N2DgAGGJrIxPzsvwg,10065
83
+ langfun/core/structured/mapping.py,sha256=Vq3bQZWi4iYjcVn8D2kvPXTAm9jrQ-_1ueHLbXtGRNQ,12112
84
+ langfun/core/structured/mapping_test.py,sha256=PiXklMeIa8L6KtMi3ju7J9Y39gZy0hIGz-Oeq4A_7XE,3835
85
+ langfun/core/structured/parsing.py,sha256=keoVqEfzAbdULh6GawWFsTQzU91MzJXYFZjXGXLaD8g,11492
86
+ langfun/core/structured/parsing_test.py,sha256=34wDrXaQ-EYhJLfDL8mX9K53oQMSzh5pVYdKjnESmK8,20895
87
+ langfun/core/structured/prompting.py,sha256=WICdX_figP2u98Hvg3BFSTF83nNKxM4x1STxkWe2_9Y,7925
88
+ langfun/core/structured/prompting_test.py,sha256=vslaCAUikfwOvqsKzqs_oyEacrefFsr2SWSqu6OHi3w,20813
89
+ langfun/core/structured/schema.py,sha256=mJXirgqx3N7SA9zBO_ISHrzcV-ZRshLhnMJyCcSjGjY,25057
90
+ langfun/core/structured/schema_generation.py,sha256=U3nRQsqmMZg_qIVDh2fiY3K4JLfsAL1LcKzIFP1iXFg,5316
91
+ langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
92
+ langfun/core/structured/schema_test.py,sha256=yw_Uo3xJC3JA9dBDjZdkQdBGPf04e7t1oT9SZTAiSdg,22360
87
93
  langfun/core/structured/scoring.py,sha256=a3vfGnqf-DOWjD07MF54GCZTO_R1RTxTDVPzerXnU0s,2325
88
94
  langfun/core/structured/scoring_test.py,sha256=TznLMl0x9QxzmhHz_3Vr44VOXuvFnUSeRQVhu33W5cA,1437
89
95
  langfun/core/templates/__init__.py,sha256=bO0eMsVJbi7sxEB2YlInKRQ2EVP-RyyKUwcD-8msuN4,927
@@ -94,9 +100,9 @@ langfun/core/templates/conversation_test.py,sha256=RryYyIhfc34dLWOs6GfPQ8HU8mXpK
94
100
  langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fikKhwhzwhpKI,1460
95
101
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
96
102
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
97
- langfun/core/templates/selfplay_test.py,sha256=IB5rWbjK_9CTkqEo1BclQPzFAKcIiusJckH8J19HFgI,2096
98
- langfun-0.0.2.dev20240319.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
99
- langfun-0.0.2.dev20240319.dist-info/METADATA,sha256=sDKuxrM_kBnxcU99DD5uyERL3OIJ4oeEN19QkqKOKuU,3405
100
- langfun-0.0.2.dev20240319.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
101
- langfun-0.0.2.dev20240319.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
102
- langfun-0.0.2.dev20240319.dist-info/RECORD,,
103
+ langfun/core/templates/selfplay_test.py,sha256=DYVrkk7uNKCqJGEHH31HssU2BPuMItU1vJLzfcXIlYg,2156
104
+ langfun-0.0.2.dev20240429.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
105
+ langfun-0.0.2.dev20240429.dist-info/METADATA,sha256=2ilR8AAbFugi7GfU5Szd9nOmkThPTNsTrOCOseGc7gQ,3436
106
+ langfun-0.0.2.dev20240429.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
107
+ langfun-0.0.2.dev20240429.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
108
+ langfun-0.0.2.dev20240429.dist-info/RECORD,,