langfun 0.0.2.dev20240506__py3-none-any.whl → 0.0.2.dev20240508__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.
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
 
langfun/core/eval/base.py CHANGED
@@ -1179,7 +1179,7 @@ class Evaluation(Evaluable):
1179
1179
 
1180
1180
  def process(self, example: Any, **kwargs) -> lf.Message:
1181
1181
  """Process an example and returns its output."""
1182
- prompt = self.prompt.render(example=example).text
1182
+ prompt = lf.Template.from_value(self.prompt, example=example)
1183
1183
  if self.method == 'call':
1184
1184
  return lf_structured.call(
1185
1185
  prompt,
@@ -1207,7 +1207,9 @@ class Evaluation(Evaluable):
1207
1207
  else:
1208
1208
  assert self.method == 'complete', self.method
1209
1209
  assert isinstance(self.schema.spec, pg.typing.Object), self.schema
1210
- input_value = self.schema.spec.cls.partial(prompt)
1210
+ # TODO(daiyip): Currently multi-modal inputs within the prompt for
1211
+ # completion is not supported.
1212
+ input_value = self.schema.spec.cls.partial(prompt.render().text)
1211
1213
  return lf_structured.complete(
1212
1214
  input_value,
1213
1215
  lm=self.lm,
langfun/core/langfunc.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """LangFunc: Language-based functions."""
15
15
 
16
16
  import dataclasses
17
- from typing import Annotated, Type, Union
17
+ from typing import Annotated, Type
18
18
 
19
19
  from langfun.core import component
20
20
  from langfun.core import language_model
@@ -328,22 +328,6 @@ class LangFunc(
328
328
  """Transforms the output message before returning from __call__."""
329
329
  return lm_output
330
330
 
331
- @classmethod
332
- def from_value(
333
- cls, value: Union[str, template_lib.Template], **kwargs
334
- ) -> 'LangFunc':
335
- """Create a LangFunc object from a string or template."""
336
- if isinstance(value, LangFunc):
337
- return value
338
- if isinstance(value, template_lib.Template):
339
- lfun = LangFunc(value.template_str, **kwargs)
340
- # So lfun could acccess all attributes from value.
341
- lfun.sym_setparent(value)
342
- return lfun
343
- if isinstance(value, str):
344
- return LangFunc(template_str=value, **kwargs)
345
- return LangFunc('{{input}}', input=value, **kwargs)
346
-
347
331
 
348
332
  # Register converter from str to LangFunc, therefore we can always
349
333
  # pass strs to attributes that accept LangFunc.
@@ -57,6 +57,10 @@ class BasicTest(unittest.TestCase):
57
57
  l2 = LangFunc.from_value(l1)
58
58
  self.assertIs(l2, l1)
59
59
 
60
+ l3 = LangFunc.from_value(l1, x=1)
61
+ self.assertIsNot(l3, l1)
62
+ self.assertTrue(pg.eq(l3, LangFunc('Hello', x=1)))
63
+
60
64
  c = template_lib.Template(
61
65
  '{{x}} + {{l}}',
62
66
  x=1,
langfun/core/llms/fake.py CHANGED
@@ -57,12 +57,12 @@ class StaticResponse(Fake):
57
57
  """Language model that always gives the same canned response."""
58
58
 
59
59
  response: Annotated[
60
- str,
60
+ str | lf.Message,
61
61
  'A canned response that will be returned regardless of the prompt.'
62
62
  ]
63
63
 
64
64
  def _response_from(self, prompt: lf.Message) -> lf.Message:
65
- return lf.AIMessage(self.response)
65
+ return lf.AIMessage.from_value(self.response)
66
66
 
67
67
 
68
68
  @lf.use_init_args(['mapping'])
@@ -70,12 +70,12 @@ class StaticMapping(Fake):
70
70
  """A static mapping from prompt to response."""
71
71
 
72
72
  mapping: Annotated[
73
- dict[str, str],
73
+ dict[str, str | lf.Message],
74
74
  'A mapping from prompt to response.'
75
75
  ]
76
76
 
77
77
  def _response_from(self, prompt: lf.Message) -> lf.Message:
78
- return lf.AIMessage(self.mapping[prompt])
78
+ return lf.AIMessage.from_value(self.mapping[prompt])
79
79
 
80
80
 
81
81
  @lf.use_init_args(['sequence'])
@@ -83,7 +83,7 @@ class StaticSequence(Fake):
83
83
  """A static sequence of responses to use."""
84
84
 
85
85
  sequence: Annotated[
86
- list[str],
86
+ list[str | lf.Message],
87
87
  'A sequence of strings as the response.'
88
88
  ]
89
89
 
@@ -92,6 +92,6 @@ class StaticSequence(Fake):
92
92
  self._pos = 0
93
93
 
94
94
  def _response_from(self, prompt: lf.Message) -> lf.Message:
95
- r = lf.AIMessage(self.sequence[self._pos])
95
+ r = lf.AIMessage.from_value(self.sequence[self._pos])
96
96
  self._pos += 1
97
97
  return r
@@ -64,6 +64,8 @@ from langfun.core.structured.prompting import QueryStructure
64
64
  from langfun.core.structured.prompting import QueryStructureJson
65
65
  from langfun.core.structured.prompting import QueryStructurePython
66
66
  from langfun.core.structured.prompting import query
67
+ from langfun.core.structured.prompting import query_prompt
68
+ from langfun.core.structured.prompting import query_output
67
69
 
68
70
  from langfun.core.structured.description import DescribeStructure
69
71
  from langfun.core.structured.description import describe
@@ -251,7 +251,7 @@ class Mapping(lf.LangFunc):
251
251
 
252
252
  {%- if example.schema -%}
253
253
  {{ schema_title }}:
254
- {{ example.schema_repr(protocol) | indent(2, True) }}
254
+ {{ example.schema_repr(protocol, include_methods=include_methods) | indent(2, True) }}
255
255
 
256
256
  {% endif -%}
257
257
 
@@ -279,6 +279,10 @@ class Mapping(lf.LangFunc):
279
279
  'The protocol for representing the schema and value.',
280
280
  ] = 'python'
281
281
 
282
+ include_methods: Annotated[
283
+ bool, 'If True, include method definitions in the schema.'
284
+ ] = False
285
+
282
286
  #
283
287
  # Other user-provided flags.
284
288
  #
@@ -16,6 +16,7 @@
16
16
  from typing import Any, Callable, Type, Union
17
17
 
18
18
  import langfun.core as lf
19
+ from langfun.core.llms import fake
19
20
  from langfun.core.structured import mapping
20
21
  from langfun.core.structured import schema as schema_lib
21
22
  import pyglove as pg
@@ -113,6 +114,7 @@ def query(
113
114
  autofix: int = 0,
114
115
  autofix_lm: lf.LanguageModel | None = None,
115
116
  protocol: schema_lib.SchemaProtocol = 'python',
117
+ include_methods: bool = False,
116
118
  returns_message: bool = False,
117
119
  skip_lm: bool = False,
118
120
  **kwargs,
@@ -160,11 +162,11 @@ def query(
160
162
  examples: An optional list of fewshot examples for helping parsing. If None,
161
163
  the default one-shot example will be added.
162
164
  cache_seed: Seed for computing cache key. The cache key is determined by a
163
- tuple of (lm, prompt, cache seed). If None, cache will be disabled for
164
- the query even cache is configured by the LM.
165
+ tuple of (lm, prompt, cache seed). If None, cache will be disabled for the
166
+ query even cache is configured by the LM.
165
167
  response_postprocess: An optional callable object to process the raw LM
166
- response before parsing it into the final output object. If None, the
167
- raw LM response will not be processed.
168
+ response before parsing it into the final output object. If None, the raw
169
+ LM response will not be processed.
168
170
  autofix: Number of attempts to auto fix the generated code. If 0, autofix is
169
171
  disabled. Auto-fix is not supported for 'json' protocol.
170
172
  autofix_lm: The language model to use for autofix. If not specified, the
@@ -172,6 +174,8 @@ def query(
172
174
  will use `lm`.
173
175
  protocol: The protocol for schema/value representation. Applicable values
174
176
  are 'json' and 'python'. By default `python` will be used.
177
+ include_methods: If True, include method definitions in the output type
178
+ during prompting.
175
179
  returns_message: If True, returns `lf.Message` as the output, instead of
176
180
  returning the structured `message.result`.
177
181
  skip_lm: If True, returns the rendered prompt as a UserMessage object.
@@ -211,13 +215,8 @@ def query(
211
215
  # prompt rendering.
212
216
  prompt_kwargs.pop('template_str', None)
213
217
 
214
- if isinstance(prompt, str):
215
- prompt = lf.Template(prompt, **prompt_kwargs)
216
- elif isinstance(prompt, lf.Template):
217
- prompt = prompt.rebind(**prompt_kwargs, raise_on_no_change=False)
218
-
219
- if isinstance(prompt, lf.Template):
220
- prompt = prompt.render(lm=lm)
218
+ if isinstance(prompt, (str, lf.Message, lf.Template)):
219
+ prompt = lf.Template.from_value(prompt, **prompt_kwargs).render(lm=lm)
221
220
  else:
222
221
  prompt = schema_lib.mark_missing(prompt)
223
222
 
@@ -226,6 +225,7 @@ def query(
226
225
  schema=schema,
227
226
  default=default,
228
227
  examples=examples,
228
+ include_methods=include_methods,
229
229
  response_postprocess=response_postprocess,
230
230
  autofix=autofix if protocol == 'python' else 0,
231
231
  **kwargs,
@@ -236,3 +236,31 @@ def query(
236
236
  skip_lm=skip_lm,
237
237
  )
238
238
  return output if returns_message else output.result
239
+
240
+
241
+ def query_prompt(
242
+ prompt: Union[str, pg.Symbolic],
243
+ schema: Union[
244
+ schema_lib.Schema, Type[Any], list[Type[Any]], dict[str, Any], None
245
+ ] = None,
246
+ **kwargs,
247
+ ) -> lf.Message:
248
+ """Returns the final prompt sent to LLM for `lf.query`."""
249
+ kwargs.pop('returns_message', None)
250
+ kwargs.pop('skip_lm', None)
251
+ return query(prompt, schema, skip_lm=True, returns_message=True, **kwargs)
252
+
253
+
254
+ def query_output(
255
+ response: Union[str, lf.Message],
256
+ schema: Union[
257
+ schema_lib.Schema, Type[Any], list[Type[Any]], dict[str, Any], None
258
+ ],
259
+ **kwargs,
260
+ ) -> Any:
261
+ """Returns the final output of `lf.query` from a provided LLM response."""
262
+ kwargs.pop('prompt', None)
263
+ kwargs.pop('lm', None)
264
+ return query(
265
+ 'Unused prompt', schema, lm=fake.StaticResponse(response), **kwargs
266
+ )
@@ -285,6 +285,49 @@ class QueryTest(unittest.TestCase):
285
285
  with self.assertRaisesRegex(ValueError, 'Unknown protocol'):
286
286
  prompting.query('what is 1 + 1', int, protocol='text')
287
287
 
288
+ def test_query_prompt(self):
289
+ self.assertEqual(
290
+ prompting.query_prompt('what is this?', int),
291
+ inspect.cleandoc("""
292
+ Please respond to the last INPUT_OBJECT with OUTPUT_OBJECT according to OUTPUT_TYPE.
293
+
294
+ INPUT_OBJECT:
295
+ 1 + 1 =
296
+
297
+ OUTPUT_TYPE:
298
+ Answer
299
+
300
+ ```python
301
+ class Answer:
302
+ final_answer: int
303
+ ```
304
+
305
+ OUTPUT_OBJECT:
306
+ ```python
307
+ Answer(
308
+ final_answer=2
309
+ )
310
+ ```
311
+
312
+ INPUT_OBJECT:
313
+ what is this?
314
+
315
+ OUTPUT_TYPE:
316
+ int
317
+
318
+ OUTPUT_OBJECT:
319
+ """),
320
+ )
321
+
322
+ def test_query_output(self):
323
+ self.assertEqual(
324
+ prompting.query_output(
325
+ lf.AIMessage('1'),
326
+ int,
327
+ ),
328
+ 1,
329
+ )
330
+
288
331
 
289
332
  class QueryStructurePythonTest(unittest.TestCase):
290
333
 
@@ -301,6 +301,7 @@ class SchemaPythonRepr(SchemaRepr):
301
301
  schema: Schema,
302
302
  *,
303
303
  include_result_definition: bool = True,
304
+ include_methods: bool = False,
304
305
  markdown: bool = True,
305
306
  **kwargs,
306
307
  ) -> str:
@@ -308,7 +309,7 @@ class SchemaPythonRepr(SchemaRepr):
308
309
  if include_result_definition:
309
310
  ret += self.result_definition(schema)
310
311
  class_definition_str = self.class_definitions(
311
- schema, markdown=markdown, **kwargs
312
+ schema, markdown=markdown, include_methods=include_methods, **kwargs
312
313
  )
313
314
  if class_definition_str:
314
315
  ret += f'\n\n{class_definition_str}'
@@ -331,6 +332,7 @@ def class_definitions(
331
332
  classes: Sequence[Type[Any]],
332
333
  *,
333
334
  include_pg_object_as_base: bool = False,
335
+ include_methods: bool = False,
334
336
  strict: bool = False,
335
337
  markdown: bool = False,
336
338
  ) -> str | None:
@@ -346,6 +348,7 @@ def class_definitions(
346
348
  cls,
347
349
  strict=strict,
348
350
  include_pg_object_as_base=include_pg_object_as_base,
351
+ include_methods=include_methods,
349
352
  )
350
353
  )
351
354
  ret = def_str.getvalue()
@@ -355,7 +358,10 @@ def class_definitions(
355
358
 
356
359
 
357
360
  def class_definition(
358
- cls, strict: bool = False, include_pg_object_as_base: bool = False
361
+ cls,
362
+ strict: bool = False,
363
+ include_pg_object_as_base: bool = False,
364
+ include_methods: bool = False,
359
365
  ) -> str:
360
366
  """Returns the Python class definition."""
361
367
  out = io.StringIO()
@@ -383,6 +389,7 @@ def class_definition(
383
389
  out.write('\n')
384
390
  out.write(' """\n')
385
391
 
392
+ empty_class = True
386
393
  if schema.fields:
387
394
  for key, field in schema.items():
388
395
  if not isinstance(key, pg.typing.ConstStrKey):
@@ -401,11 +408,33 @@ def class_definition(
401
408
  out.write('\n')
402
409
  out.write(f' {field.key}: {annotation(field.value, strict=strict)}')
403
410
  out.write('\n')
404
- else:
411
+ empty_class = False
412
+
413
+ if include_methods:
414
+ for method in _iter_newly_defined_methods(cls):
415
+ out.write('\n')
416
+ out.write(
417
+ textwrap.indent(
418
+ inspect.cleandoc('\n' + inspect.getsource(method)), ' ' * 2)
419
+ )
420
+ out.write('\n')
421
+ empty_class = False
422
+
423
+ if empty_class:
405
424
  out.write(' pass\n')
406
425
  return out.getvalue()
407
426
 
408
427
 
428
+ def _iter_newly_defined_methods(cls):
429
+ names = set(dir(cls))
430
+ for base in cls.__bases__:
431
+ names -= set(dir(base))
432
+ for name in names:
433
+ attr = getattr(cls, name)
434
+ if callable(attr):
435
+ yield attr
436
+
437
+
409
438
  def annotation(
410
439
  vs: pg.typing.ValueSpec,
411
440
  annotate_optional: bool = True,
@@ -493,7 +522,8 @@ def annotation(
493
522
  class SchemaJsonRepr(SchemaRepr):
494
523
  """JSON-representation for a schema."""
495
524
 
496
- def repr(self, schema: Schema) -> str:
525
+ def repr(self, schema: Schema, **kwargs) -> str:
526
+ del kwargs
497
527
  out = io.StringIO()
498
528
  def _visit(node: Any) -> None:
499
529
  if isinstance(node, str):
@@ -461,6 +461,23 @@ class SchemaPythonReprTest(unittest.TestCase):
461
461
 
462
462
  self.assertEqual(schema_lib.class_definition(C), 'class C:\n x: str\n')
463
463
 
464
+ class D(pg.Object):
465
+ x: str
466
+ def __call__(self, y: int) -> int:
467
+ return len(self.x) + y
468
+
469
+ self.assertEqual(
470
+ schema_lib.class_definition(D, include_methods=True),
471
+ inspect.cleandoc(
472
+ """
473
+ class D:
474
+ x: str
475
+
476
+ def __call__(self, y: int) -> int:
477
+ return len(self.x) + y
478
+ """) + '\n'
479
+ )
480
+
464
481
  def test_repr(self):
465
482
  class Foo(pg.Object):
466
483
  x: int
@@ -477,13 +494,21 @@ class SchemaPythonReprTest(unittest.TestCase):
477
494
  class A(pg.Object):
478
495
  foo: Foo
479
496
 
497
+ def foo_value(self) -> int:
498
+ return self.foo.x
499
+
480
500
  class B(A):
481
501
  bar: Bar
482
502
  foo2: Foo
483
503
 
504
+ def bar_value(self) -> str:
505
+ return self.bar.y
506
+
484
507
  schema = schema_lib.Schema([B])
485
508
  self.assertEqual(
486
- schema_lib.SchemaPythonRepr().class_definitions(schema),
509
+ schema_lib.SchemaPythonRepr().class_definitions(
510
+ schema, include_methods=True
511
+ ),
487
512
  inspect.cleandoc('''
488
513
  class Foo:
489
514
  x: int
@@ -491,6 +516,9 @@ class SchemaPythonReprTest(unittest.TestCase):
491
516
  class A:
492
517
  foo: Foo
493
518
 
519
+ def foo_value(self) -> int:
520
+ return self.foo.x
521
+
494
522
  class Bar:
495
523
  """Class Bar."""
496
524
  y: str
@@ -503,6 +531,9 @@ class SchemaPythonReprTest(unittest.TestCase):
503
531
  foo: Foo
504
532
  bar: Bar
505
533
  foo2: Foo
534
+
535
+ def bar_value(self) -> str:
536
+ return self.bar.y
506
537
  ''') + '\n',
507
538
  )
508
539
 
langfun/core/template.py CHANGED
@@ -17,7 +17,7 @@ import contextlib
17
17
  import dataclasses
18
18
  import functools
19
19
  import inspect
20
- from typing import Annotated, Any, Callable, Iterator, Set, Tuple, Type
20
+ from typing import Annotated, Any, Callable, Iterator, Set, Tuple, Type, Union
21
21
 
22
22
  import jinja2
23
23
  from jinja2 import meta as jinja2_meta
@@ -495,6 +495,27 @@ class Template(
495
495
  t.sym_setparent(self)
496
496
  return t
497
497
 
498
+ @classmethod
499
+ def from_value(
500
+ cls,
501
+ value: Union[str, message_lib.Message, 'Template'],
502
+ **kwargs
503
+ ) -> 'Template':
504
+ """Create a template object from a string or template."""
505
+ if isinstance(value, cls):
506
+ return value.clone(override=kwargs) if kwargs else value # pylint: disable=no-value-for-parameter
507
+ if isinstance(value, str):
508
+ return cls(template_str=value, **kwargs)
509
+ if isinstance(value, message_lib.Message):
510
+ kwargs.update(value.metadata)
511
+ return cls(template_str=value.text, **kwargs)
512
+ if isinstance(value, Template):
513
+ lfun = cls(template_str=value.template_str, **kwargs)
514
+ # So lfun could acccess all attributes from value.
515
+ lfun.sym_setparent(value)
516
+ return lfun
517
+ return cls(template_str='{{input}}', input=value, **kwargs)
518
+
498
519
 
499
520
  # Register converter from str to LangFunc, therefore we can always
500
521
  # pass strs to attributes that accept LangFunc.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.0.2.dev20240506
3
+ Version: 0.0.2.dev20240508
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -1,4 +1,4 @@
1
- langfun/__init__.py,sha256=zh-EYTCLxkUAIc2zMo3Lye46_CrMrhwO_GwBHZspUvE,1919
1
+ langfun/__init__.py,sha256=YAbi2FfTfKT41KJAx1tSNoiole_YRJmcEk3oOoqFqOs,2128
2
2
  langfun/core/__init__.py,sha256=6QEuXOZ9BXxm6TjpaMXuLwUBTYO3pkFDqn9QVBXyyPQ,4248
3
3
  langfun/core/component.py,sha256=oxesbC0BoE_TbtxwW5x-BAZWxZyyJbuPiX5S38RqCv0,9909
4
4
  langfun/core/component_test.py,sha256=uR-_Sz_42Jxc5qzLIB-f5_pXmNwnC01Xlbv5NOQSeSU,8021
@@ -6,8 +6,8 @@ langfun/core/concurrent.py,sha256=TRc49pJ3HQro2kb5FtcWkHjhBm8UcgE8RJybU5cU3-0,24
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=bRujJfH4iTwKFtFxQf745uJkfltuFnPfOGLuP8ydcr4,11646
10
- langfun/core/langfunc_test.py,sha256=sQaKuZpGGmG80GRifhbxkj7nfzQLJKj4Vuw5y1s1K3U,8378
9
+ langfun/core/langfunc.py,sha256=RvIcRjIq0jWYRu1xim-FYe4HSrt97r3GMBO_PuagUmw,11060
10
+ langfun/core/langfunc_test.py,sha256=_mfARnakX3oji5HDigFSLMd6yQ2wma-2Mgbztwqn73g,8501
11
11
  langfun/core/language_model.py,sha256=6wtY8RGbOymfo1PYzcYCfOlWuKQcSVFs5R1sFB4-QMQ,20202
12
12
  langfun/core/language_model_test.py,sha256=T-itu7Li2smv2dkru0C0neCs2W4VJXlNTYahXU6jF54,19548
13
13
  langfun/core/memory.py,sha256=f-asN1F7Vehgdn_fK84v73GrEUOxRtaW934keutTKjk,2416
@@ -21,7 +21,7 @@ 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=FZByYq6mhVDjT4HJ3yY-_TUZ13BiURzTJSKLw6QyLY4,21462
24
+ langfun/core/template.py,sha256=UhNNGUDJ4StUhPBKzHmjym36khxHOGWGr9MDxBwgxQA,22284
25
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
@@ -40,7 +40,7 @@ langfun/core/coding/python/parsing_test.py,sha256=9vAWF484kWIm6JZq8NFiMgKUDhXV-d
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
42
  langfun/core/eval/__init__.py,sha256=Evt-E4FEhZF2tXL6-byh_AyA7Cc_ZoGmvnN7vkAZedk,1898
43
- langfun/core/eval/base.py,sha256=ZUx-rBjdWyJ5augNIUgRF77-FE-YdFum2uqe0h7-baM,74132
43
+ langfun/core/eval/base.py,sha256=zcMPBKmcll5O08waEEnvmkEoXgcINhOat9rRJk8X8b4,74268
44
44
  langfun/core/eval/base_test.py,sha256=cHOTIWVW4Dp8gKKIKcZrAcJ-w84j2GIozTzJoiAX7p4,26743
45
45
  langfun/core/eval/matching.py,sha256=Y4vFoNTQEOwko6IA8l9OZ52-vt52e3VGmcTtvLA67wM,9782
46
46
  langfun/core/eval/matching_test.py,sha256=f7iVyXH5KGJBWt4Wp14Bt9J3X59A6Ayfog9MbuFvPew,5532
@@ -51,7 +51,7 @@ langfun/core/eval/scoring_test.py,sha256=O8olHbrUEg60gMxwOkWzKBJZpZoUlmVnBANX5Se
51
51
  langfun/core/llms/__init__.py,sha256=1bPg1QI8duOZCYINm-jWi094x0JtLmsk4KX60qIC_gs,3245
52
52
  langfun/core/llms/anthropic.py,sha256=7W9YdPN3SlAFhAIQlihMkrpo7tTY_4NvD0KIlCrqcsk,8505
53
53
  langfun/core/llms/anthropic_test.py,sha256=TMM30myyEhwF99Le4RvJEXOn8RYl0q1FRkt9Q9nl1jk,5540
54
- langfun/core/llms/fake.py,sha256=b-Xk5IPTbUt-elsyzd_i3n1tqzc_kgETXrEvgJruSMk,2824
54
+ langfun/core/llms/fake.py,sha256=_smsN_CsYbeWrtjpegEPwdAPV9mwaIuH_4oZGeXQwQI,2896
55
55
  langfun/core/llms/fake_test.py,sha256=ipKfdOcuqVcJ8lDXVpnBVb9HHG0hAVkFkMoHpWjC2cI,7212
56
56
  langfun/core/llms/google_genai.py,sha256=n8zyJwh9UCTgb6-8LyvmjVNFGZQ4-zfzZ0ulkhHAnR8,8624
57
57
  langfun/core/llms/google_genai_test.py,sha256=_UcGTfl16-aDUlEWFC2W2F8y9jPUs53RBYA6MOCpGXw,7525
@@ -75,23 +75,23 @@ langfun/core/modalities/mime.py,sha256=wVfaYflhGz1W4v3m972rAplW3OGOFtjFpHDYIaUD5
75
75
  langfun/core/modalities/mime_test.py,sha256=cVHxRvJ1QXC1SVhBmWkJdWGpL9Xl0UNfTQq6j0OGGL4,1881
76
76
  langfun/core/modalities/video.py,sha256=25M4XsNG5XEWRy57LYT_a6_aMURMPAgC41B3weEXFsY,1747
77
77
  langfun/core/modalities/video_test.py,sha256=jYuI2m8S8zDCAVBPEUbbpP205dXAht90A2_PHWo4-r8,2039
78
- langfun/core/structured/__init__.py,sha256=zO6mdApZgWy6d2i3s_FWrjHS_-7qWnase0VRq0KhKn0,3589
78
+ langfun/core/structured/__init__.py,sha256=Qg1ocwsb60od8fJky3F3JAOhwjwT9WA7IX3C2j2s3zA,3707
79
79
  langfun/core/structured/completion.py,sha256=skBxt6V_fv2TBUKnzFgnPMbVY8HSYn8sY04MLok2yvs,7299
80
80
  langfun/core/structured/completion_test.py,sha256=MYxEzeScC3gFVujvrMMboBF5nh-QiVLwGgqAV3oaFUQ,19273
81
81
  langfun/core/structured/description.py,sha256=SXW4MJvshFjbR-0gw6rE21o6WXq12UlRXawvDBXMZFA,5211
82
82
  langfun/core/structured/description_test.py,sha256=UtZGjSFUaQ6130t1E5tcL7ODu0xIefkapb53TbnqsK8,7362
83
83
  langfun/core/structured/function_generation.py,sha256=pFgS3vcRAWiuFBol2x5Eeip3XqoudONsOpeJpWyjT3s,7479
84
84
  langfun/core/structured/function_generation_test.py,sha256=ZJI-aaGgWWszn92u7h5IZ9Pl70N2DgAGGJrIxPzsvwg,10065
85
- langfun/core/structured/mapping.py,sha256=Vq3bQZWi4iYjcVn8D2kvPXTAm9jrQ-_1ueHLbXtGRNQ,12112
85
+ langfun/core/structured/mapping.py,sha256=V2EI53KwhXxqcoH2ouhuei8aYWny0ml_FwMTiS7Zr9M,12253
86
86
  langfun/core/structured/mapping_test.py,sha256=PiXklMeIa8L6KtMi3ju7J9Y39gZy0hIGz-Oeq4A_7XE,3835
87
87
  langfun/core/structured/parsing.py,sha256=keoVqEfzAbdULh6GawWFsTQzU91MzJXYFZjXGXLaD8g,11492
88
88
  langfun/core/structured/parsing_test.py,sha256=34wDrXaQ-EYhJLfDL8mX9K53oQMSzh5pVYdKjnESmK8,20895
89
- langfun/core/structured/prompting.py,sha256=WICdX_figP2u98Hvg3BFSTF83nNKxM4x1STxkWe2_9Y,7925
90
- langfun/core/structured/prompting_test.py,sha256=vslaCAUikfwOvqsKzqs_oyEacrefFsr2SWSqu6OHi3w,20813
91
- langfun/core/structured/schema.py,sha256=mJXirgqx3N7SA9zBO_ISHrzcV-ZRshLhnMJyCcSjGjY,25057
89
+ langfun/core/structured/prompting.py,sha256=cswl9c93edsYnXsZQmMzPpmqOuKnBzbgebTYBbSxwzo,8815
90
+ langfun/core/structured/prompting_test.py,sha256=rddf5qHN8Gm_JaNMmytwiVEBm-eZVJFLQO4GljUgR44,21700
91
+ langfun/core/structured/schema.py,sha256=Zy9y6Vq9DrFwcuP5o5VL_PvMCmzavF-nuDqyviBnaxk,25818
92
92
  langfun/core/structured/schema_generation.py,sha256=U3nRQsqmMZg_qIVDh2fiY3K4JLfsAL1LcKzIFP1iXFg,5316
93
93
  langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
94
- langfun/core/structured/schema_test.py,sha256=yw_Uo3xJC3JA9dBDjZdkQdBGPf04e7t1oT9SZTAiSdg,22360
94
+ langfun/core/structured/schema_test.py,sha256=NgQK1zGSliZVx_Af6gDBTqQxXRHvmAvGARv4dUs8IbI,23078
95
95
  langfun/core/structured/scoring.py,sha256=5DsMNrWKf98ZYCEkxA4-HvA62nMSNBs9DC5m8dYL7Cs,2442
96
96
  langfun/core/structured/scoring_test.py,sha256=39_dw6p_FkoqeUccO67yIqos-MccAWezoozS21i8mi0,1732
97
97
  langfun/core/templates/__init__.py,sha256=bO0eMsVJbi7sxEB2YlInKRQ2EVP-RyyKUwcD-8msuN4,927
@@ -103,8 +103,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
103
103
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
104
104
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
105
105
  langfun/core/templates/selfplay_test.py,sha256=DYVrkk7uNKCqJGEHH31HssU2BPuMItU1vJLzfcXIlYg,2156
106
- langfun-0.0.2.dev20240506.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
107
- langfun-0.0.2.dev20240506.dist-info/METADATA,sha256=lzwASgqmdYxjw1o3ivVL4au5jvKsvY6dQXdfBxLqcec,3405
108
- langfun-0.0.2.dev20240506.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
109
- langfun-0.0.2.dev20240506.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
110
- langfun-0.0.2.dev20240506.dist-info/RECORD,,
106
+ langfun-0.0.2.dev20240508.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
107
+ langfun-0.0.2.dev20240508.dist-info/METADATA,sha256=-kG5pyZ6wAFJRP0hINq-JUhoEnKJsXrn2YCZbZuAFhY,3405
108
+ langfun-0.0.2.dev20240508.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
109
+ langfun-0.0.2.dev20240508.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
110
+ langfun-0.0.2.dev20240508.dist-info/RECORD,,