langfun 0.0.2.dev20240605__py3-none-any.whl → 0.0.2.dev20240613__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.

@@ -0,0 +1,51 @@
1
+ # Copyright 2024 The Langfun Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Tests for langfun.core.logging."""
15
+
16
+ import unittest
17
+
18
+ from langfun.core import logging
19
+
20
+
21
+ class LoggingTest(unittest.TestCase):
22
+
23
+ def test_use_log_level(self):
24
+ self.assertEqual(logging.get_log_level(), 'info')
25
+ with logging.use_log_level('debug'):
26
+ self.assertEqual(logging.get_log_level(), 'debug')
27
+ with logging.use_log_level(None):
28
+ self.assertIsNone(logging.get_log_level(), None)
29
+ self.assertEqual(logging.get_log_level(), 'debug')
30
+ self.assertEqual(logging.get_log_level(), 'info')
31
+
32
+ def test_log(self):
33
+ entry = logging.log('info', 'hi', indent=1, x=1, y=2)
34
+ self.assertEqual(entry.level, 'info')
35
+ self.assertEqual(entry.message, 'hi')
36
+ self.assertEqual(entry.indent, 1)
37
+ self.assertEqual(entry.metadata, {'x': 1, 'y': 2})
38
+
39
+ self.assertEqual(logging.debug('hi').level, 'debug')
40
+ self.assertEqual(logging.info('hi').level, 'info')
41
+ self.assertEqual(logging.warning('hi').level, 'warning')
42
+ self.assertEqual(logging.error('hi').level, 'error')
43
+ self.assertEqual(logging.fatal('hi').level, 'fatal')
44
+
45
+ def test_repr_html(self):
46
+ entry = logging.log('info', 'hi', indent=1, x=1, y=2)
47
+ self.assertIn('<div', entry._repr_html_())
48
+
49
+
50
+ if __name__ == '__main__':
51
+ unittest.main()
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The Langfun Authors
1
+ # Copyright 2024 The Langfun Authors
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -53,19 +53,21 @@ class Mime(lf.Modality):
53
53
 
54
54
  @functools.cached_property
55
55
  def is_text(self) -> bool:
56
- return self.mime_type.startswith(
57
- (
58
- 'text/',
59
- 'application/javascript',
60
- 'application/json',
61
- 'application/ld+json',
62
- 'application/plain',
63
- 'application/xhtml+xml',
64
- 'application/xml',
65
- 'application/x-tex',
66
- 'application/x-yaml',
67
- )
68
- )
56
+ return self.mime_type.startswith((
57
+ 'text/',
58
+ 'application/javascript',
59
+ 'application/json',
60
+ 'application/ld+json',
61
+ 'application/plain',
62
+ 'application/rtf',
63
+ 'application/xhtml+xml',
64
+ 'application/xml',
65
+ 'application/x-javascript',
66
+ 'application/x-python-code',
67
+ 'application/x-tex',
68
+ 'application/x-typescript',
69
+ 'application/x-yaml',
70
+ ))
69
71
 
70
72
  @property
71
73
  def is_binary(self) -> bool:
@@ -32,6 +32,14 @@ def mock_readfile(*args, **kwargs):
32
32
 
33
33
  class CustomMimeTest(unittest.TestCase):
34
34
 
35
+ def test_is_text(self):
36
+ self.assertTrue(mime.Custom('text/plain', b'foo').is_text)
37
+ self.assertTrue(mime.Custom('text/xml', b'foo').is_text)
38
+ self.assertTrue(mime.Custom('application/json', b'foo').is_text)
39
+ self.assertTrue(mime.Custom('application/x-python-code', b'foo').is_text)
40
+ self.assertFalse(mime.Custom('application/pdf', b'foo').is_text)
41
+ self.assertFalse(mime.Custom('application/octet-stream', b'foo').is_text)
42
+
35
43
  def test_from_byes(self):
36
44
  content = mime.Mime.from_bytes(b'hello')
37
45
  self.assertIs(content.__class__, mime.Mime)
@@ -0,0 +1,83 @@
1
+ # Copyright 2024 The Langfun Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Helpers for implementing _repr_xxx_ methods."""
15
+
16
+ import collections
17
+ import contextlib
18
+ import io
19
+ from typing import Iterator
20
+
21
+ from langfun.core import component
22
+
23
+
24
+ @contextlib.contextmanager
25
+ def share_parts() -> Iterator[dict[str, int]]:
26
+ """Context manager for defining the context (scope) of shared content.
27
+
28
+ Under the context manager, call to `lf.write_shared` with the same content
29
+ will be written only once. This is useful for writing shared content such as
30
+ shared style and script sections in the HTML.
31
+
32
+ Example:
33
+ ```
34
+ class Foo(pg.Object):
35
+ def _repr_html_(self) -> str:
36
+ s = io.StringIO()
37
+ lf.repr_utils.write_shared_part(s, '<style>..</style>')
38
+ lf.repr_utils.write_shared_part(s, '<script>..</script>')
39
+ return s.getvalue()
40
+
41
+ with lf.repr_utils.share_parts() as share_parts:
42
+ # The <style> and <script> section will be written only once.
43
+ lf.console.display(Foo())
44
+ lf.console.display(Foo())
45
+
46
+ # Assert that the shared content is attempted to be written twice.
47
+ assert share_parts['<style>..</style>'] == 2
48
+ ```
49
+
50
+ Yields:
51
+ A dictionary mapping the shared content to the number of times it is
52
+ attempted to be written.
53
+ """
54
+ context = component.context_value(
55
+ '__shared_parts__', collections.defaultdict(int)
56
+ )
57
+ with component.context(__shared_parts__=context):
58
+ try:
59
+ yield context
60
+ finally:
61
+ pass
62
+
63
+
64
+ def write_maybe_shared(s: io.StringIO, content: str) -> bool:
65
+ """Writes a maybe shared part to an string stream.
66
+
67
+ Args:
68
+ s: The string stream to write to.
69
+ content: A maybe shared content to write.
70
+
71
+ Returns:
72
+ True if the content is written to the string. False if the content is
73
+ already written under the same share context.
74
+ """
75
+ context = component.context_value('__shared_parts__', None)
76
+ if context is None:
77
+ s.write(content)
78
+ return True
79
+ written = content in context
80
+ if not written:
81
+ s.write(content)
82
+ context[content] += 1
83
+ return not written
@@ -0,0 +1,58 @@
1
+ # Copyright 2024 The Langfun Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Tests for langfun.core.repr_utils."""
15
+
16
+ import io
17
+ import unittest
18
+
19
+ from langfun.core import repr_utils
20
+
21
+
22
+ class SharingContentTest(unittest.TestCase):
23
+
24
+ def test_sharing(self):
25
+ s = io.StringIO()
26
+
27
+ self.assertTrue(repr_utils.write_maybe_shared(s, '<hr>'))
28
+ self.assertTrue(repr_utils.write_maybe_shared(s, '<hr>'))
29
+
30
+ with repr_utils.share_parts() as ctx1:
31
+ self.assertTrue(repr_utils.write_maybe_shared(s, '<style></style>'))
32
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style></style>'))
33
+
34
+ with repr_utils.share_parts() as ctx2:
35
+ self.assertIs(ctx2, ctx1)
36
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style></style>'))
37
+ self.assertTrue(repr_utils.write_maybe_shared(s, '<style>a</style>'))
38
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style>a</style>'))
39
+ self.assertTrue(repr_utils.write_maybe_shared(s, '<style>b</style>'))
40
+
41
+ with repr_utils.share_parts() as ctx3:
42
+ self.assertIs(ctx3, ctx1)
43
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style></style>'))
44
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style>a</style>'))
45
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style>a</style>'))
46
+ self.assertFalse(repr_utils.write_maybe_shared(s, '<style>b</style>'))
47
+
48
+ self.assertEqual(
49
+ s.getvalue(),
50
+ '<hr><hr><style></style><style>a</style><style>b</style>'
51
+ )
52
+ self.assertEqual(ctx1['<style></style>'], 4)
53
+ self.assertEqual(ctx1['<style>b</style>'], 2)
54
+ self.assertEqual(ctx1['<style>a</style>'], 4)
55
+
56
+
57
+ if __name__ == '__main__':
58
+ unittest.main()
@@ -30,7 +30,7 @@ class CompleteStructure(mapping.Mapping):
30
30
 
31
31
  mapping_template = lf.Template("""
32
32
  {{ input_title }}:
33
- {{ example.input_repr() | indent(2, True) }}
33
+ {{ example.input_repr(use_modality_ref=True) | indent(2, True) }}
34
34
 
35
35
  {%- if missing_type_dependencies(example.input) %}
36
36
 
@@ -45,13 +45,16 @@ class CompleteStructure(mapping.Mapping):
45
45
 
46
46
  {{ output_title }}:
47
47
  {%- if example.has_output %}
48
- {{ example.output_repr() | indent(2, True) }}
48
+ {{ example.output_repr(use_modality_ref=True) | indent(2, True) }}
49
49
  {% endif -%}
50
50
  """)
51
51
 
52
52
  input_title = 'INPUT_OBJECT'
53
53
  output_title = 'OUTPUT_OBJECT'
54
54
  schema_title = 'CLASS_DEFINITIONS'
55
+ modality_refs_title: Annotated[
56
+ str, 'The section title for modality refs.'
57
+ ] = 'MODALITY_REFERENCES'
55
58
 
56
59
  preamble = lf.LangFunc(
57
60
  """
@@ -148,6 +151,28 @@ class CompleteStructure(mapping.Mapping):
148
151
  pg.traverse(self.input, _visit)
149
152
  return context
150
153
 
154
+ #
155
+ # Helper methods for handling modalities.
156
+ #
157
+
158
+ def has_modality_refs(self, value: Any) -> bool:
159
+ """Returns true if the value has modalities."""
160
+ return not isinstance(value, lf.Modality) and pg.contains(
161
+ value, type=lf.Modality
162
+ )
163
+
164
+ def modalities(self, value: Any) -> dict[str, lf.Modality]:
165
+ return lf.Modality.from_value(value)
166
+
167
+ def modality_refs_repr(self, value: Any) -> str:
168
+ with lf.modality.format_modality_as_ref(True):
169
+ return pg.format(
170
+ self.modalities(value),
171
+ compact=False,
172
+ verbose=False,
173
+ python_format=True,
174
+ )
175
+
151
176
 
152
177
  def complete(
153
178
  input_value: pg.Symbolic,
@@ -107,7 +107,11 @@ class MappingExample(lf.NaturalLanguageFormattable, lf.Component):
107
107
 
108
108
  @classmethod
109
109
  def value_repr(
110
- cls, value: Any, protocol: schema_lib.SchemaProtocol = 'python', **kwargs
110
+ cls,
111
+ value: Any,
112
+ protocol: schema_lib.SchemaProtocol = 'python',
113
+ use_modality_ref: bool = False,
114
+ **kwargs
111
115
  ) -> str:
112
116
  if isinstance(value, str):
113
117
  return value
@@ -116,7 +120,7 @@ class MappingExample(lf.NaturalLanguageFormattable, lf.Component):
116
120
  return str(value)
117
121
 
118
122
  # Placehold modalities if they are present.
119
- if pg.contains(value, type=lf.Modality):
123
+ if use_modality_ref and pg.contains(value, type=lf.Modality):
120
124
  value = lf.ModalityRef.placehold(value)
121
125
  return schema_lib.value_repr(protocol).repr(value, **kwargs)
122
126
 
@@ -243,13 +247,7 @@ class Mapping(lf.LangFunc):
243
247
  {{ input_title }}:
244
248
  {{ example.input_repr(protocol, compact=False) | indent(2, True) }}
245
249
 
246
- {% if has_modality_refs(example.input) -%}
247
- {{ modality_refs_title }}:
248
- {{ modality_refs_repr(example.input) | indent(2, True) }}
249
-
250
- {% endif -%}
251
-
252
- {%- if example.schema -%}
250
+ {% if example.schema -%}
253
251
  {{ schema_title }}:
254
252
  {{ example.schema_repr(protocol) | indent(2, True) }}
255
253
 
@@ -270,10 +268,6 @@ class Mapping(lf.LangFunc):
270
268
 
271
269
  schema_title: Annotated[str, 'The section title for schema.'] = 'SCHEMA'
272
270
 
273
- modality_refs_title: Annotated[
274
- str, 'The section title for modality refs.'
275
- ] = 'MODALITY_REFERENCES'
276
-
277
271
  protocol: Annotated[
278
272
  schema_lib.SchemaProtocol,
279
273
  'The protocol for representing the schema and value.',
@@ -378,24 +372,3 @@ class Mapping(lf.LangFunc):
378
372
  """Gets additional symbol definitions besides schema as globals."""
379
373
  return {'ModalityRef': lf.modality.ModalityRef}
380
374
 
381
- #
382
- # Helper methods for handling modalities.
383
- #
384
-
385
- def has_modality_refs(self, value: Any) -> bool:
386
- """Returns true if the value has modalities."""
387
- return not isinstance(value, lf.Modality) and pg.contains(
388
- value, type=lf.Modality
389
- )
390
-
391
- def modalities(self, value: Any) -> dict[str, lf.Modality]:
392
- return lf.Modality.from_value(value)
393
-
394
- def modality_refs_repr(self, value: Any) -> str:
395
- with lf.modality.format_modality_as_ref(True):
396
- return pg.format(
397
- self.modalities(value),
398
- compact=False,
399
- verbose=False,
400
- python_format=True,
401
- )
@@ -41,13 +41,17 @@ class QueryTest(unittest.TestCase):
41
41
  self,
42
42
  prompt,
43
43
  schema,
44
+ examples: list[mapping.MappingExample] | None = None,
44
45
  *,
45
46
  expected_snippet: str,
46
47
  exact_match: bool = False,
47
48
  expected_modalities: int = 0,
48
49
  **kwargs,
49
50
  ):
50
- m = prompting.query(prompt, schema=schema, **kwargs, returns_message=True)
51
+ m = prompting.query(
52
+ prompt, schema=schema, examples=examples,
53
+ **kwargs, returns_message=True
54
+ )
51
55
  self.assertIsNotNone(m.lm_input)
52
56
  if exact_match:
53
57
  self.assertEqual(expected_snippet, m.lm_input.text)
@@ -265,24 +269,60 @@ class QueryTest(unittest.TestCase):
265
269
  INPUT_OBJECT:
266
270
  ```python
267
271
  [
268
- ModalityRef(
269
- name='input[0]'
270
- ),
271
- ModalityRef(
272
- name='input[1]'
273
- )
272
+ <<[[input[0]]]>>,
273
+ <<[[input[1]]]>>
274
274
  ]
275
275
  ```
276
-
277
- MODALITY_REFERENCES:
278
- {
279
- 'input[0]': <<[[input[0]]]>>,
280
- 'input[1]': <<[[input[1]]]>>
281
- }
282
276
  """),
283
277
  expected_modalities=2,
284
278
  )
285
279
 
280
+ def test_structure_with_modality_and_examples_to_structure_render(self):
281
+ lm = fake.StaticResponse('["cat", "mouse"]')
282
+ self.assert_render(
283
+ [
284
+ modalities.Image.from_bytes(b'cat_image'),
285
+ modalities.Image.from_bytes(b'mouse_image'),
286
+ ],
287
+ list[str],
288
+ examples=[
289
+ mapping.MappingExample(
290
+ input=[modalities.Image.from_bytes(b'dog_image')],
291
+ schema=list[str],
292
+ output=['dog'],
293
+ ),
294
+ ],
295
+ lm=lm,
296
+ expected_snippet=inspect.cleandoc("""
297
+ INPUT_OBJECT:
298
+ ```python
299
+ [
300
+ <<[[examples[0].input[0]]]>>
301
+ ]
302
+ ```
303
+
304
+ OUTPUT_TYPE:
305
+ list[str]
306
+
307
+ OUTPUT_OBJECT:
308
+ ```python
309
+ [
310
+ 'dog'
311
+ ]
312
+ ```
313
+
314
+
315
+ INPUT_OBJECT:
316
+ ```python
317
+ [
318
+ <<[[input[0]]]>>,
319
+ <<[[input[1]]]>>
320
+ ]
321
+ ```
322
+ """),
323
+ expected_modalities=3,
324
+ )
325
+
286
326
  def test_bad_protocol(self):
287
327
  with self.assertRaisesRegex(ValueError, 'Unknown protocol'):
288
328
  prompting.query('what is 1 + 1', int, protocol='text')
@@ -656,6 +656,8 @@ class ValuePythonRepr(ValueRepr):
656
656
  return object_code
657
657
  else:
658
658
  object_code = SchemaPythonRepr().result_definition(cls_schema)
659
+ elif isinstance(value, lf.Template):
660
+ return str(value)
659
661
  else:
660
662
  object_code = pg.format(
661
663
  value, compact=compact, verbose=verbose, python_format=True
@@ -18,6 +18,7 @@ import inspect
18
18
  import typing
19
19
  import unittest
20
20
 
21
+ import langfun.core as lf
21
22
  from langfun.core.llms import fake
22
23
  from langfun.core.structured import schema as schema_lib
23
24
  import pyglove as pg
@@ -694,6 +695,10 @@ class ValuePythonReprTest(unittest.TestCase):
694
695
  schema_lib.ValuePythonRepr().repr(1, schema_lib.Schema(int)),
695
696
  '```python\n1\n```'
696
697
  )
698
+ self.assertEqual(
699
+ schema_lib.ValuePythonRepr().repr(lf.Template('hi, {{a}}', a='foo')),
700
+ 'hi, foo'
701
+ )
697
702
  self.assertEqual(
698
703
  schema_lib.ValuePythonRepr().repr(
699
704
  A([Foo(1), Foo(2)], 'bar'), schema_lib.Schema(A), markdown=False,
@@ -57,7 +57,10 @@ class SelfPlayTest(unittest.TestCase):
57
57
 
58
58
  with lf.context(lm=NumberGuesser(guesses=[50, 20, 5, 10])):
59
59
  self.assertEqual(
60
- g(), lf.AIMessage('10', score=0.0, logprobs=None, usage=None)
60
+ g(),
61
+ lf.AIMessage(
62
+ '10', score=0.0, logprobs=None, usage=lf.UsageNotAvailable()
63
+ )
61
64
  )
62
65
 
63
66
  self.assertEqual(g.num_turns, 4)
@@ -67,7 +70,10 @@ class SelfPlayTest(unittest.TestCase):
67
70
 
68
71
  with lf.context(lm=NumberGuesser(guesses=[50, 20, 5, 2, 5, 4])):
69
72
  self.assertEqual(
70
- g(), lf.AIMessage('2', score=0.0, logprobs=None, usage=None)
73
+ g(),
74
+ lf.AIMessage(
75
+ '2', score=0.0, logprobs=None, usage=lf.UsageNotAvailable()
76
+ )
71
77
  )
72
78
 
73
79
  self.assertEqual(g.num_turns, 10)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.0.2.dev20240605
3
+ Version: 0.0.2.dev20240613
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -1,15 +1,17 @@
1
1
  langfun/__init__.py,sha256=P62MnqA6-f0h8iYfQ3MT6Yg7a4qRnQeb4GrIn6dcSnY,2274
2
- langfun/core/__init__.py,sha256=ZheiCpop_GAZbVpnSS-uPBJaEEM15Td5xFGGizSGqko,4514
3
- langfun/core/component.py,sha256=oxesbC0BoE_TbtxwW5x-BAZWxZyyJbuPiX5S38RqCv0,9909
4
- langfun/core/component_test.py,sha256=uR-_Sz_42Jxc5qzLIB-f5_pXmNwnC01Xlbv5NOQSeSU,8021
2
+ langfun/core/__init__.py,sha256=Mdp1a2YnXdSmfTfbUwuAnEWYbjA3rXXGtbxl5fljZyg,4812
3
+ langfun/core/component.py,sha256=Icyoj9ICoJoK2r2PHbrFXbxnseOr9QZZOvKWklLWNo8,10276
4
+ langfun/core/component_test.py,sha256=q15Xn51cVTu2RKxZ9U5VQgT3bm6RQ4638bKhWBtvW5o,8220
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
9
  langfun/core/langfunc.py,sha256=RvIcRjIq0jWYRu1xim-FYe4HSrt97r3GMBO_PuagUmw,11060
10
- langfun/core/langfunc_test.py,sha256=_mfARnakX3oji5HDigFSLMd6yQ2wma-2Mgbztwqn73g,8501
11
- langfun/core/language_model.py,sha256=PocBg1t3uB0a_bJntLW5aagHhNbZsVdp2iduSBEW6ro,21240
12
- langfun/core/language_model_test.py,sha256=NZaSUls6cZdtxiqkqumWbtkx9zgNiJlsviYZOWkuHig,20137
10
+ langfun/core/langfunc_test.py,sha256=lyt-UzkD8972cxZwzCkps0_RMLeSsOBrcUFIW-fB6us,8653
11
+ langfun/core/language_model.py,sha256=q41EGhbgoCe68eYWWTAzgt3r6SbdCpINRdXnNGstukQ,23775
12
+ langfun/core/language_model_test.py,sha256=HmA0GACK4-6tCH32TFkfYj9w4CxbrynKqXdKBgiqgwo,21255
13
+ langfun/core/logging.py,sha256=FyZRxUy2TTF6tWLhQCRpCvfH55WGUdNgQjUTK_SQLnY,5320
14
+ langfun/core/logging_test.py,sha256=qvm3RObYP3knO2PnXR9evBRl4gH621GnjnwywbGbRfg,1833
13
15
  langfun/core/memory.py,sha256=f-asN1F7Vehgdn_fK84v73GrEUOxRtaW934keutTKjk,2416
14
16
  langfun/core/message.py,sha256=Rw3yC9HyGRjMhfDgyNjGlSCALEyDDbJ0_o6qTXeeDiQ,15738
15
17
  langfun/core/message_test.py,sha256=b6DDRoQ5j3uK-dc0QPSLelNTKaXX10MxJrRiI61iGX4,9574
@@ -17,6 +19,8 @@ langfun/core/modality.py,sha256=Tla4t86DUYHpbZ2G7dy1r19fTj_Ga5XOvlYp6lbWa-Q,3512
17
19
  langfun/core/modality_test.py,sha256=HyZ5xONKQ0Fw18SzoWAq-Ob9njOXIIjBo1hNtw-rudw,2400
18
20
  langfun/core/natural_language.py,sha256=3ynSnaYQnjE60LIPK5fyMgdIjubnPYZwzGq4rWPeloE,1177
19
21
  langfun/core/natural_language_test.py,sha256=LHGU_1ytbkGuSZQFIFP7vP3dBlcY4-A12fT6dbjUA0E,1424
22
+ langfun/core/repr_utils.py,sha256=HrN7FoGUvpTlv5aL_XISouwZN84z9LmrB6_2jEn1ukc,2590
23
+ langfun/core/repr_utils_test.py,sha256=-XId1A72Vbzo289dYuxC6TegNXuZhI28WbNrm1ghiwc,2206
20
24
  langfun/core/sampling.py,sha256=vygWvgC8MFw0_AKNSmz-ywMXJYWf8cl0tI8QycvAmyI,5795
21
25
  langfun/core/sampling_test.py,sha256=U7PANpMsl9E_pa4_Y4FzesSjcwg-u-LKHGCWSgv-8FY,3663
22
26
  langfun/core/subscription.py,sha256=euawEuSZP-BHydaT-AQpfYFL0m5pWPGcW0upFhrojqc,10930
@@ -40,7 +44,7 @@ langfun/core/coding/python/parsing_test.py,sha256=9vAWF484kWIm6JZq8NFiMgKUDhXV-d
40
44
  langfun/core/coding/python/permissions.py,sha256=1QWGHvzL8MM0Ok_auQ9tURqZHtdOfJaDpBzZ29GUE-c,2544
41
45
  langfun/core/coding/python/permissions_test.py,sha256=w5EDb8QxpxgJyZkojyzVWQvDfg366zn99-g__6TbPQ0,2699
42
46
  langfun/core/eval/__init__.py,sha256=Evt-E4FEhZF2tXL6-byh_AyA7Cc_ZoGmvnN7vkAZedk,1898
43
- langfun/core/eval/base.py,sha256=zcMPBKmcll5O08waEEnvmkEoXgcINhOat9rRJk8X8b4,74268
47
+ langfun/core/eval/base.py,sha256=GM98Zo4gxZui2ORX6Q7Zr94PfiEViQC5X_qz-uj6b2k,74220
44
48
  langfun/core/eval/base_test.py,sha256=cHOTIWVW4Dp8gKKIKcZrAcJ-w84j2GIozTzJoiAX7p4,26743
45
49
  langfun/core/eval/matching.py,sha256=Y4vFoNTQEOwko6IA8l9OZ52-vt52e3VGmcTtvLA67wM,9782
46
50
  langfun/core/eval/matching_test.py,sha256=f7iVyXH5KGJBWt4Wp14Bt9J3X59A6Ayfog9MbuFvPew,5532
@@ -59,10 +63,10 @@ langfun/core/llms/groq.py,sha256=pqtyOZ_1_OJMOg8xATWT_B_SVbuT9nMRf4VkH9GzW8g,630
59
63
  langfun/core/llms/groq_test.py,sha256=GYF_Qtq5S1H1TrKH38t6_lkdroqT7v-joYLDKnmS9e0,5274
60
64
  langfun/core/llms/llama_cpp.py,sha256=9tXQntSCDtjTF3bnyJrAPCr4N6wycy5nXYvp9uduygE,2843
61
65
  langfun/core/llms/llama_cpp_test.py,sha256=MWO_qaOeKjRniGjcaWPDScd7HPaIJemqUZoslrt4FPs,1806
62
- langfun/core/llms/openai.py,sha256=IN46gIqfY6aEEfxCPNmyH1hrep3oWBhJDwVFilfqNkM,13657
63
- langfun/core/llms/openai_test.py,sha256=QWDzTgi8F2Z9u9ip6alK4rDEp_YraVTxWlDX5XOsKJk,14858
66
+ langfun/core/llms/openai.py,sha256=0z9qIH9FlWj9VWUnhOX321T6JHO-vjY2IozT7OVI4GY,13654
67
+ langfun/core/llms/openai_test.py,sha256=3muDTnW7UBOSHq694Fi2bofqhe8Pkj0Tl8IShoLCTOM,15525
64
68
  langfun/core/llms/rest.py,sha256=laopuq-zD8V-3Y6eFDngftHEbE66VlUkCD2-rvvRaLU,3388
65
- langfun/core/llms/rest_test.py,sha256=Zw08Xbl_O2OQuUglLXHsPsY5KW2VEcPGl1gR8PRHuFY,3449
69
+ langfun/core/llms/rest_test.py,sha256=NZ3Nf0XQVpT9kLP5cBVo_yBHLI7vWTYhWQxYEJVMGs4,3472
66
70
  langfun/core/llms/vertexai.py,sha256=wIpckH-rMHUBA1vhauQk4LVrSsPQEsVntz7kLDKwm9g,11359
67
71
  langfun/core/llms/vertexai_test.py,sha256=G18BG36h5KvmX2zutDTLjtYCRjTuP_nWIFm4FMnLnyY,7651
68
72
  langfun/core/llms/cache/__init__.py,sha256=QAo3InUMDM_YpteNnVCSejI4zOsnjSMWKJKzkb3VY64,993
@@ -77,8 +81,8 @@ langfun/core/modalities/audio.py,sha256=Qxo7bYjLKQ1gVJVomr9RqR2SvxY826QgXhTzzk43
77
81
  langfun/core/modalities/audio_test.py,sha256=gWCB9h3FyrdGqro3ajBXqkw0lU0W1sBjOOq6wZbl7Fg,2027
78
82
  langfun/core/modalities/image.py,sha256=qi7B9uYLxBoKvMzApdOQNpVcp_dKaRwLzeshg2nvo9k,926
79
83
  langfun/core/modalities/image_test.py,sha256=qU7G4ucUihIQ9ZB453FsUfcOipUYx5TnnuoMB1GIMfE,3034
80
- langfun/core/modalities/mime.py,sha256=yMpbBAhf7MmEPJm9qj7tTn7_XionZQ4XkgTT8StA7io,5836
81
- langfun/core/modalities/mime_test.py,sha256=ruEro7Joima2r-zOuQfO0NzBvmaweSQ6F6jsf-w4Bns,2468
84
+ langfun/core/modalities/mime.py,sha256=7oYvwYZHb3uhjiL2rF6kvQWsWufY0UXl72wfDXC59ys,5918
85
+ langfun/core/modalities/mime_test.py,sha256=kmRiPP-3Py02NnKPu0oPexSIJ-MXaaE2UYY82ga0TV8,2913
82
86
  langfun/core/modalities/ms_office.py,sha256=jOidMSdWCaV9RILpGz8VJkpTSpHJNoirD53jzQvcytM,3388
83
87
  langfun/core/modalities/ms_office_test.py,sha256=d_NZ0QU23NydenYZgNj6YxgO5ZYzjg-HCbglsVJGp04,87866
84
88
  langfun/core/modalities/pdf.py,sha256=mfaeCbUA4JslFVTARiJh8hW7imvL4tLVw9gUhO5bAZA,727
@@ -86,22 +90,22 @@ langfun/core/modalities/pdf_test.py,sha256=KE40zJD3Whe6ty2OULkp1J8jwLmB4ZjGXlGek
86
90
  langfun/core/modalities/video.py,sha256=sKcXxbx9S1ERjH8yEzkbtySpcRJD40QiPIQiIBy-U5I,955
87
91
  langfun/core/modalities/video_test.py,sha256=GbsoefSeO7y8kCYhTtp4s9E3ah_eYrb6Z-MXpS01RFc,2046
88
92
  langfun/core/structured/__init__.py,sha256=yp60yeDSVlyT0ElmLwbpBHnQtk_JX5udnjG1UGcsXKA,3776
89
- langfun/core/structured/completion.py,sha256=RzWdHyaqKj-tj6mGwpHXk0s8YbM0UEHSpyT2axmj-o8,7343
93
+ langfun/core/structured/completion.py,sha256=cS2PjG7sqzDu5x0xoTk8RmNcoeX55iVwH38NTefkMHg,8108
90
94
  langfun/core/structured/completion_test.py,sha256=2mUzDMKGF_WGfTtsnfmfMDx97dkJ-98y8leen__qWLA,19281
91
95
  langfun/core/structured/description.py,sha256=SXW4MJvshFjbR-0gw6rE21o6WXq12UlRXawvDBXMZFA,5211
92
96
  langfun/core/structured/description_test.py,sha256=UtZGjSFUaQ6130t1E5tcL7ODu0xIefkapb53TbnqsK8,7362
93
97
  langfun/core/structured/function_generation.py,sha256=pFgS3vcRAWiuFBol2x5Eeip3XqoudONsOpeJpWyjT3s,7479
94
98
  langfun/core/structured/function_generation_test.py,sha256=ZJI-aaGgWWszn92u7h5IZ9Pl70N2DgAGGJrIxPzsvwg,10065
95
- langfun/core/structured/mapping.py,sha256=Vq3bQZWi4iYjcVn8D2kvPXTAm9jrQ-_1ueHLbXtGRNQ,12112
99
+ langfun/core/structured/mapping.py,sha256=QKbSnvOgut-sx2mZPjHJcdlDLxR8b3ZC16ZLWociwog,11298
96
100
  langfun/core/structured/mapping_test.py,sha256=PiXklMeIa8L6KtMi3ju7J9Y39gZy0hIGz-Oeq4A_7XE,3835
97
101
  langfun/core/structured/parsing.py,sha256=keoVqEfzAbdULh6GawWFsTQzU91MzJXYFZjXGXLaD8g,11492
98
102
  langfun/core/structured/parsing_test.py,sha256=34wDrXaQ-EYhJLfDL8mX9K53oQMSzh5pVYdKjnESmK8,20895
99
103
  langfun/core/structured/prompting.py,sha256=vjmJn7GMFkqkrEB6qRrYvjB78WVx_OhsIyMN8PTb-7o,8641
100
- langfun/core/structured/prompting_test.py,sha256=8orqsTVDpDb_7oFZtGHtV_zRU_j_9RaOGH1QR8IurIU,21756
101
- langfun/core/structured/schema.py,sha256=7s6g9HSGogdWXnsX3_Pd8w8Cf1tKeFGtbNwxIG6l7lA,27664
104
+ langfun/core/structured/prompting_test.py,sha256=W1FmbOfMXhBV8uZ3WN1fBxKLtdYngvR9l1JYo46HqJQ,22723
105
+ langfun/core/structured/schema.py,sha256=oiT4P4Q9pG-QOnFzxETN2EQZqNln8nG4zAJHxcmeX9U,27729
102
106
  langfun/core/structured/schema_generation.py,sha256=U3nRQsqmMZg_qIVDh2fiY3K4JLfsAL1LcKzIFP1iXFg,5316
103
107
  langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
104
- langfun/core/structured/schema_test.py,sha256=P1Bm-khjbAebW6IDjop5dv1ddRD4pqL83FdK1VmfZPw,25108
108
+ langfun/core/structured/schema_test.py,sha256=RjYhwTgktQgyqAjzLvo967nTiIK9KWgP-aNGg4e7ihE,25258
105
109
  langfun/core/structured/scoring.py,sha256=QyT1S8FkLtKICfUbh4AXoKK3YJ_rgejyk6TI2OtOa68,2751
106
110
  langfun/core/structured/scoring_test.py,sha256=39_dw6p_FkoqeUccO67yIqos-MccAWezoozS21i8mi0,1732
107
111
  langfun/core/templates/__init__.py,sha256=bO0eMsVJbi7sxEB2YlInKRQ2EVP-RyyKUwcD-8msuN4,927
@@ -112,9 +116,9 @@ langfun/core/templates/conversation_test.py,sha256=RryYyIhfc34dLWOs6GfPQ8HU8mXpK
112
116
  langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fikKhwhzwhpKI,1460
113
117
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
114
118
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
115
- langfun/core/templates/selfplay_test.py,sha256=DYVrkk7uNKCqJGEHH31HssU2BPuMItU1vJLzfcXIlYg,2156
116
- langfun-0.0.2.dev20240605.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
117
- langfun-0.0.2.dev20240605.dist-info/METADATA,sha256=NMWv4oYMcRuZXl22coMTShqGC8hj_Y2PGfTk7n-Alt0,3550
118
- langfun-0.0.2.dev20240605.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
119
- langfun-0.0.2.dev20240605.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
120
- langfun-0.0.2.dev20240605.dist-info/RECORD,,
119
+ langfun/core/templates/selfplay_test.py,sha256=rBW2Qr8yi-aWYwoTwRR-n1peKyMX9QXPZXURjLgoiRs,2264
120
+ langfun-0.0.2.dev20240613.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
121
+ langfun-0.0.2.dev20240613.dist-info/METADATA,sha256=h3fWeJU8ejsvol_8wbw4DoS_D8L7ARomUo2hweGPF2A,3550
122
+ langfun-0.0.2.dev20240613.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
123
+ langfun-0.0.2.dev20240613.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
124
+ langfun-0.0.2.dev20240613.dist-info/RECORD,,