langfun 0.1.2.dev202504280818__py3-none-any.whl → 0.1.2.dev202504300804__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.
- langfun/__init__.py +3 -0
- langfun/core/agentic/action.py +253 -105
- langfun/core/agentic/action_eval.py +10 -3
- langfun/core/agentic/action_test.py +173 -47
- langfun/core/eval/base_test.py +4 -4
- langfun/core/eval/v2/evaluation.py +78 -12
- langfun/core/eval/v2/evaluation_test.py +2 -0
- langfun/core/structured/__init__.py +3 -0
- langfun/core/structured/mapping.py +5 -2
- langfun/core/structured/parsing_test.py +1 -1
- langfun/core/structured/querying.py +205 -18
- langfun/core/structured/querying_test.py +286 -47
- {langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/METADATA +29 -6
- {langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/RECORD +17 -17
- {langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/WHEEL +1 -1
- {langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/top_level.txt +0 -0
@@ -90,7 +90,7 @@ class QueryTest(unittest.TestCase):
|
|
90
90
|
score=1.0,
|
91
91
|
logprobs=None,
|
92
92
|
is_cached=False,
|
93
|
-
usage=lf.LMSamplingUsage(
|
93
|
+
usage=lf.LMSamplingUsage(364, 1, 365),
|
94
94
|
tags=['lm-response', 'lm-output', 'transformed'],
|
95
95
|
),
|
96
96
|
)
|
@@ -143,26 +143,26 @@ class QueryTest(unittest.TestCase):
|
|
143
143
|
y=2,
|
144
144
|
lm=lm.clone(),
|
145
145
|
expected_snippet=(
|
146
|
-
'Please respond to the last
|
147
|
-
'according to
|
148
|
-
'
|
149
|
-
'
|
146
|
+
'Please respond to the last REQUEST with OUTPUT PYTHON OBJECT '
|
147
|
+
'only according to OUTPUT PYTHON TYPE.\n\n'
|
148
|
+
'REQUEST:\n 1 + 1 =\n\n'
|
149
|
+
'OUTPUT PYTHON TYPE:\n'
|
150
150
|
' Answer\n\n'
|
151
151
|
' ```python\n'
|
152
152
|
' class Answer:\n'
|
153
153
|
' final_answer: int\n'
|
154
154
|
' ```\n\n'
|
155
|
-
'
|
155
|
+
'OUTPUT PYTHON OBJECT:\n'
|
156
156
|
' ```python\n'
|
157
|
-
' Answer(\n'
|
157
|
+
' output = Answer(\n'
|
158
158
|
' final_answer=2\n'
|
159
159
|
' )\n'
|
160
160
|
' ```\n\n'
|
161
|
-
'
|
161
|
+
'REQUEST:\n'
|
162
162
|
' What is 1 + 2?\n\n'
|
163
|
-
'
|
163
|
+
'OUTPUT PYTHON TYPE:\n'
|
164
164
|
' int\n\n'
|
165
|
-
'
|
165
|
+
'OUTPUT PYTHON OBJECT:'
|
166
166
|
),
|
167
167
|
)
|
168
168
|
|
@@ -176,26 +176,26 @@ class QueryTest(unittest.TestCase):
|
|
176
176
|
lm=lm.clone(),
|
177
177
|
template_str='!!{{ DEFAULT }}!!',
|
178
178
|
expected_snippet=(
|
179
|
-
'!!Please respond to the last
|
180
|
-
'according to
|
181
|
-
'
|
182
|
-
'
|
179
|
+
'!!Please respond to the last REQUEST with OUTPUT PYTHON OBJECT '
|
180
|
+
'only according to OUTPUT PYTHON TYPE.\n\n'
|
181
|
+
'REQUEST:\n 1 + 1 =\n\n'
|
182
|
+
'OUTPUT PYTHON TYPE:\n'
|
183
183
|
' Answer\n\n'
|
184
184
|
' ```python\n'
|
185
185
|
' class Answer:\n'
|
186
186
|
' final_answer: int\n'
|
187
187
|
' ```\n\n'
|
188
|
-
'
|
188
|
+
'OUTPUT PYTHON OBJECT:\n'
|
189
189
|
' ```python\n'
|
190
|
-
' Answer(\n'
|
190
|
+
' output = Answer(\n'
|
191
191
|
' final_answer=2\n'
|
192
192
|
' )\n'
|
193
193
|
' ```\n\n'
|
194
|
-
'
|
194
|
+
'REQUEST:\n'
|
195
195
|
' What is 1 + 2?\n\n'
|
196
|
-
'
|
196
|
+
'OUTPUT PYTHON TYPE:\n'
|
197
197
|
' int\n\n'
|
198
|
-
'
|
198
|
+
'OUTPUT PYTHON OBJECT:!!'
|
199
199
|
),
|
200
200
|
)
|
201
201
|
|
@@ -220,7 +220,7 @@ class QueryTest(unittest.TestCase):
|
|
220
220
|
y=2,
|
221
221
|
lm=lm.clone(),
|
222
222
|
expected_snippet=(
|
223
|
-
'\n\
|
223
|
+
'\n\nREQUEST:\n ```python\n [\n 1\n ]\n ```\n\n'
|
224
224
|
),
|
225
225
|
)
|
226
226
|
|
@@ -236,7 +236,7 @@ class QueryTest(unittest.TestCase):
|
|
236
236
|
modalities.Image.from_bytes(b'mock_image'),
|
237
237
|
int,
|
238
238
|
lm=lm,
|
239
|
-
expected_snippet='\n\
|
239
|
+
expected_snippet='\n\nREQUEST:\n <<[[input]]>>\n\n',
|
240
240
|
expected_modalities=1,
|
241
241
|
)
|
242
242
|
|
@@ -290,7 +290,7 @@ class QueryTest(unittest.TestCase):
|
|
290
290
|
list[str],
|
291
291
|
lm=lm,
|
292
292
|
expected_snippet=inspect.cleandoc("""
|
293
|
-
|
293
|
+
REQUEST:
|
294
294
|
```python
|
295
295
|
[
|
296
296
|
<<[[input[0]]]>>,
|
@@ -318,31 +318,36 @@ class QueryTest(unittest.TestCase):
|
|
318
318
|
],
|
319
319
|
lm=lm,
|
320
320
|
expected_snippet=inspect.cleandoc("""
|
321
|
-
|
321
|
+
REQUEST:
|
322
322
|
```python
|
323
323
|
[
|
324
324
|
<<[[examples[0].input[0]]]>>
|
325
325
|
]
|
326
326
|
```
|
327
327
|
|
328
|
-
|
328
|
+
OUTPUT PYTHON TYPE:
|
329
329
|
list[str]
|
330
330
|
|
331
|
-
|
331
|
+
OUTPUT PYTHON OBJECT:
|
332
332
|
```python
|
333
|
-
[
|
333
|
+
output = [
|
334
334
|
'dog'
|
335
335
|
]
|
336
336
|
```
|
337
337
|
|
338
338
|
|
339
|
-
|
339
|
+
REQUEST:
|
340
340
|
```python
|
341
341
|
[
|
342
342
|
<<[[input[0]]]>>,
|
343
343
|
<<[[input[1]]]>>
|
344
344
|
]
|
345
345
|
```
|
346
|
+
|
347
|
+
OUTPUT PYTHON TYPE:
|
348
|
+
list[str]
|
349
|
+
|
350
|
+
OUTPUT PYTHON OBJECT:
|
346
351
|
"""),
|
347
352
|
expected_modalities=3,
|
348
353
|
)
|
@@ -410,20 +415,69 @@ class QueryTest(unittest.TestCase):
|
|
410
415
|
self.assertEqual([r.text for r in results], ['1', 'abc'])
|
411
416
|
self.assertEqual([r.result for r in results], [1, 0])
|
412
417
|
|
413
|
-
def
|
414
|
-
|
415
|
-
|
418
|
+
def test_from_protocol(self):
|
419
|
+
self.assertIs(
|
420
|
+
querying.LfQuery.from_protocol('python'), querying._LfQueryPythonV2
|
421
|
+
)
|
422
|
+
self.assertIs(
|
423
|
+
querying.LfQuery.from_protocol('python:1.0'),
|
424
|
+
querying._LfQueryPythonV1
|
425
|
+
)
|
426
|
+
|
427
|
+
class MyLfQuery(querying.LfQuery):
|
428
|
+
protocol = 'yaml'
|
429
|
+
version = '1.0'
|
430
|
+
|
431
|
+
self.assertIs(
|
432
|
+
querying.LfQuery.from_protocol('yaml:1.0'),
|
433
|
+
MyLfQuery
|
434
|
+
)
|
435
|
+
self.assertIs(
|
436
|
+
querying.LfQuery.from_protocol('yaml'),
|
437
|
+
MyLfQuery
|
438
|
+
)
|
439
|
+
|
440
|
+
with self.assertRaisesRegex(
|
441
|
+
ValueError, 'Version .* is already registered'
|
442
|
+
):
|
443
|
+
class MyLfQuery2(querying.LfQuery): # pylint: disable=unused-variable
|
444
|
+
protocol = 'yaml'
|
445
|
+
version = '1.0'
|
446
|
+
|
447
|
+
with self.assertRaisesRegex(
|
448
|
+
ValueError, 'Version \'2.0\' is not supported for protocol \'yaml\''
|
449
|
+
):
|
450
|
+
querying.LfQuery.from_protocol('yaml:2.0')
|
451
|
+
|
452
|
+
class MyLfQuery3(querying.LfQuery): # pylint: disable=unused-variable
|
453
|
+
protocol = 'yaml'
|
454
|
+
version = '3.0'
|
455
|
+
|
456
|
+
with self.assertRaisesRegex(
|
457
|
+
ValueError, 'Multiple versions found for protocol \'yaml\''
|
458
|
+
):
|
459
|
+
querying.LfQuery.from_protocol('yaml')
|
460
|
+
|
461
|
+
with self.assertRaisesRegex(
|
462
|
+
ValueError, 'Protocol \'text\' is not supported'
|
463
|
+
):
|
464
|
+
querying.LfQuery.from_protocol('text')
|
465
|
+
|
466
|
+
with self.assertRaisesRegex(
|
467
|
+
ValueError, 'Protocol \'text\' is not supported'
|
468
|
+
):
|
469
|
+
querying.LfQuery.from_protocol('text:1.0')
|
416
470
|
|
417
471
|
def test_query_prompt(self):
|
418
472
|
self.assertEqual(
|
419
473
|
querying.query_prompt('what is this?', int),
|
420
474
|
inspect.cleandoc("""
|
421
|
-
Please respond to the last
|
475
|
+
Please respond to the last REQUEST with OUTPUT PYTHON OBJECT only according to OUTPUT PYTHON TYPE.
|
422
476
|
|
423
|
-
|
477
|
+
REQUEST:
|
424
478
|
1 + 1 =
|
425
479
|
|
426
|
-
|
480
|
+
OUTPUT PYTHON TYPE:
|
427
481
|
Answer
|
428
482
|
|
429
483
|
```python
|
@@ -431,20 +485,20 @@ class QueryTest(unittest.TestCase):
|
|
431
485
|
final_answer: int
|
432
486
|
```
|
433
487
|
|
434
|
-
|
488
|
+
OUTPUT PYTHON OBJECT:
|
435
489
|
```python
|
436
|
-
Answer(
|
490
|
+
output = Answer(
|
437
491
|
final_answer=2
|
438
492
|
)
|
439
493
|
```
|
440
494
|
|
441
|
-
|
495
|
+
REQUEST:
|
442
496
|
what is this?
|
443
497
|
|
444
|
-
|
498
|
+
OUTPUT PYTHON TYPE:
|
445
499
|
int
|
446
500
|
|
447
|
-
|
501
|
+
OUTPUT PYTHON OBJECT:
|
448
502
|
"""),
|
449
503
|
)
|
450
504
|
|
@@ -632,10 +686,10 @@ class QueryTest(unittest.TestCase):
|
|
632
686
|
)
|
633
687
|
|
634
688
|
|
635
|
-
class
|
689
|
+
class LfQueryPythonV1Test(unittest.TestCase):
|
636
690
|
|
637
691
|
def test_render_no_examples(self):
|
638
|
-
l = querying.
|
692
|
+
l = querying.LfQuery.from_protocol('python:1.0')(
|
639
693
|
input=lf.AIMessage('Compute 12 / 6 + 2.'), schema=int
|
640
694
|
)
|
641
695
|
self.assertEqual(
|
@@ -672,7 +726,7 @@ class QueryStructurePythonTest(unittest.TestCase):
|
|
672
726
|
)
|
673
727
|
|
674
728
|
def test_render(self):
|
675
|
-
l = querying.
|
729
|
+
l = querying.LfQuery.from_protocol('python:1.0')(
|
676
730
|
input=lf.AIMessage('Compute 12 / 6 + 2.'),
|
677
731
|
schema=int,
|
678
732
|
examples=[
|
@@ -782,7 +836,7 @@ class QueryStructurePythonTest(unittest.TestCase):
|
|
782
836
|
),
|
783
837
|
override_attrs=True,
|
784
838
|
):
|
785
|
-
l = querying.
|
839
|
+
l = querying.LfQuery.from_protocol('python:1.0')(
|
786
840
|
input=lm_input,
|
787
841
|
schema=[Itinerary],
|
788
842
|
examples=[
|
@@ -810,6 +864,115 @@ class QueryStructurePythonTest(unittest.TestCase):
|
|
810
864
|
self.assertEqual(len(r.result[0].activities), 3)
|
811
865
|
self.assertIsNone(r.result[0].hotel)
|
812
866
|
|
867
|
+
|
868
|
+
class LfQueryPythonV2Test(unittest.TestCase):
|
869
|
+
|
870
|
+
def test_render_no_examples(self):
|
871
|
+
l = querying.LfQuery.from_protocol('python:2.0')(
|
872
|
+
input=lf.AIMessage('Compute 12 / 6 + 2.'), schema=int
|
873
|
+
)
|
874
|
+
self.assertEqual(
|
875
|
+
l.render().text,
|
876
|
+
inspect.cleandoc("""
|
877
|
+
Please respond to the last REQUEST with OUTPUT PYTHON OBJECT only according to OUTPUT PYTHON TYPE.
|
878
|
+
|
879
|
+
REQUEST:
|
880
|
+
1 + 1 =
|
881
|
+
|
882
|
+
OUTPUT PYTHON TYPE:
|
883
|
+
Answer
|
884
|
+
|
885
|
+
```python
|
886
|
+
class Answer:
|
887
|
+
final_answer: int
|
888
|
+
```
|
889
|
+
|
890
|
+
OUTPUT PYTHON OBJECT:
|
891
|
+
```python
|
892
|
+
output = Answer(
|
893
|
+
final_answer=2
|
894
|
+
)
|
895
|
+
```
|
896
|
+
|
897
|
+
REQUEST:
|
898
|
+
Compute 12 / 6 + 2.
|
899
|
+
|
900
|
+
OUTPUT PYTHON TYPE:
|
901
|
+
int
|
902
|
+
|
903
|
+
OUTPUT PYTHON OBJECT:
|
904
|
+
"""),
|
905
|
+
)
|
906
|
+
|
907
|
+
def test_render_with_examples(self):
|
908
|
+
l = querying.LfQuery.from_protocol('python:2.0')(
|
909
|
+
input=lf.AIMessage('Compute 12 / 6 + 2.'),
|
910
|
+
schema=int,
|
911
|
+
examples=[
|
912
|
+
mapping.MappingExample(
|
913
|
+
input='What is the answer of 1 plus 1?', output=2
|
914
|
+
),
|
915
|
+
mapping.MappingExample(
|
916
|
+
input='Compute the value of 3 + (2 * 6).', output=15
|
917
|
+
),
|
918
|
+
],
|
919
|
+
)
|
920
|
+
self.assertEqual(
|
921
|
+
l.render().text,
|
922
|
+
inspect.cleandoc("""
|
923
|
+
Please respond to the last REQUEST with OUTPUT PYTHON OBJECT only according to OUTPUT PYTHON TYPE.
|
924
|
+
|
925
|
+
REQUEST:
|
926
|
+
1 + 1 =
|
927
|
+
|
928
|
+
OUTPUT PYTHON TYPE:
|
929
|
+
Answer
|
930
|
+
|
931
|
+
```python
|
932
|
+
class Answer:
|
933
|
+
final_answer: int
|
934
|
+
```
|
935
|
+
|
936
|
+
OUTPUT PYTHON OBJECT:
|
937
|
+
```python
|
938
|
+
output = Answer(
|
939
|
+
final_answer=2
|
940
|
+
)
|
941
|
+
```
|
942
|
+
|
943
|
+
REQUEST:
|
944
|
+
What is the answer of 1 plus 1?
|
945
|
+
|
946
|
+
OUTPUT PYTHON TYPE:
|
947
|
+
int
|
948
|
+
|
949
|
+
OUTPUT PYTHON OBJECT:
|
950
|
+
```python
|
951
|
+
output = 2
|
952
|
+
```
|
953
|
+
|
954
|
+
REQUEST:
|
955
|
+
Compute the value of 3 + (2 * 6).
|
956
|
+
|
957
|
+
OUTPUT PYTHON TYPE:
|
958
|
+
int
|
959
|
+
|
960
|
+
OUTPUT PYTHON OBJECT:
|
961
|
+
```python
|
962
|
+
output = 15
|
963
|
+
```
|
964
|
+
|
965
|
+
|
966
|
+
REQUEST:
|
967
|
+
Compute 12 / 6 + 2.
|
968
|
+
|
969
|
+
OUTPUT PYTHON TYPE:
|
970
|
+
int
|
971
|
+
|
972
|
+
OUTPUT PYTHON OBJECT:
|
973
|
+
"""),
|
974
|
+
)
|
975
|
+
|
813
976
|
def test_bad_response(self):
|
814
977
|
with lf.context(
|
815
978
|
lm=fake.StaticSequence(['a2']),
|
@@ -849,11 +1012,80 @@ class QueryStructurePythonTest(unittest.TestCase):
|
|
849
1012
|
3
|
850
1013
|
)
|
851
1014
|
|
1015
|
+
def test_render(self):
|
1016
|
+
l = querying.LfQuery.from_protocol('python:2.0')(
|
1017
|
+
input=lf.AIMessage('Compute 12 / 6 + 2.'),
|
1018
|
+
schema=int,
|
1019
|
+
examples=[
|
1020
|
+
mapping.MappingExample(
|
1021
|
+
input='What is the answer of 1 plus 1?', output=2
|
1022
|
+
),
|
1023
|
+
mapping.MappingExample(
|
1024
|
+
input='Compute the value of 3 + (2 * 6).', output=15
|
1025
|
+
),
|
1026
|
+
],
|
1027
|
+
)
|
1028
|
+
self.assertEqual(
|
1029
|
+
l.render().text,
|
1030
|
+
inspect.cleandoc("""
|
1031
|
+
Please respond to the last REQUEST with OUTPUT PYTHON OBJECT only according to OUTPUT PYTHON TYPE.
|
1032
|
+
|
1033
|
+
REQUEST:
|
1034
|
+
1 + 1 =
|
1035
|
+
|
1036
|
+
OUTPUT PYTHON TYPE:
|
1037
|
+
Answer
|
1038
|
+
|
1039
|
+
```python
|
1040
|
+
class Answer:
|
1041
|
+
final_answer: int
|
1042
|
+
```
|
1043
|
+
|
1044
|
+
OUTPUT PYTHON OBJECT:
|
1045
|
+
```python
|
1046
|
+
output = Answer(
|
1047
|
+
final_answer=2
|
1048
|
+
)
|
1049
|
+
```
|
1050
|
+
|
1051
|
+
REQUEST:
|
1052
|
+
What is the answer of 1 plus 1?
|
1053
|
+
|
1054
|
+
OUTPUT PYTHON TYPE:
|
1055
|
+
int
|
1056
|
+
|
1057
|
+
OUTPUT PYTHON OBJECT:
|
1058
|
+
```python
|
1059
|
+
output = 2
|
1060
|
+
```
|
1061
|
+
|
1062
|
+
REQUEST:
|
1063
|
+
Compute the value of 3 + (2 * 6).
|
1064
|
+
|
1065
|
+
OUTPUT PYTHON TYPE:
|
1066
|
+
int
|
1067
|
+
|
1068
|
+
OUTPUT PYTHON OBJECT:
|
1069
|
+
```python
|
1070
|
+
output = 15
|
1071
|
+
```
|
1072
|
+
|
1073
|
+
|
1074
|
+
REQUEST:
|
1075
|
+
Compute 12 / 6 + 2.
|
1076
|
+
|
1077
|
+
OUTPUT PYTHON TYPE:
|
1078
|
+
int
|
1079
|
+
|
1080
|
+
OUTPUT PYTHON OBJECT:
|
1081
|
+
"""),
|
1082
|
+
)
|
852
1083
|
|
853
|
-
|
1084
|
+
|
1085
|
+
class LfQueryJsonV1Test(unittest.TestCase):
|
854
1086
|
|
855
1087
|
def test_render_no_examples(self):
|
856
|
-
l = querying.
|
1088
|
+
l = querying.LfQuery.from_protocol('json:1.0')(
|
857
1089
|
input=lf.AIMessage('Compute 12 / 6 + 2.'), schema=int
|
858
1090
|
)
|
859
1091
|
self.assertEqual(
|
@@ -885,7 +1117,7 @@ class QueryStructureJsonTest(unittest.TestCase):
|
|
885
1117
|
)
|
886
1118
|
|
887
1119
|
def test_render(self):
|
888
|
-
l = querying.
|
1120
|
+
l = querying.LfQuery.from_protocol('json:1.0')(
|
889
1121
|
input=lf.AIMessage('Compute 12 / 6 + 2.'),
|
890
1122
|
schema=int,
|
891
1123
|
examples=[
|
@@ -1020,7 +1252,7 @@ class QueryStructureJsonTest(unittest.TestCase):
|
|
1020
1252
|
),
|
1021
1253
|
override_attrs=True,
|
1022
1254
|
):
|
1023
|
-
l = querying.
|
1255
|
+
l = querying.LfQuery.from_protocol('json:1.0')(
|
1024
1256
|
input=lm_input,
|
1025
1257
|
schema=[Itinerary],
|
1026
1258
|
examples=[
|
@@ -1063,10 +1295,17 @@ class QueryStructureJsonTest(unittest.TestCase):
|
|
1063
1295
|
self.assertEqual(len(cache), 0)
|
1064
1296
|
|
1065
1297
|
def test_query(self):
|
1066
|
-
lm = fake.
|
1298
|
+
lm = fake.StaticResponse('{"result": 1}')
|
1067
1299
|
self.assertEqual(
|
1068
1300
|
querying.query('what is 1 + 0', int, lm=lm, protocol='json'), 1
|
1069
1301
|
)
|
1302
|
+
self.assertEqual(
|
1303
|
+
querying.query('what is 1 + 0', int, lm=lm, protocol='json:1.0'), 1
|
1304
|
+
)
|
1305
|
+
with querying.query_protocol('json'):
|
1306
|
+
self.assertEqual(
|
1307
|
+
querying.query('what is 1 + 0', int, lm=lm), 1
|
1308
|
+
)
|
1070
1309
|
|
1071
1310
|
|
1072
1311
|
class QueryInvocationTest(unittest.TestCase):
|
{langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: langfun
|
3
|
-
Version: 0.1.2.
|
3
|
+
Version: 0.1.2.dev202504300804
|
4
4
|
Summary: Langfun: Language as Functions.
|
5
5
|
Home-page: https://github.com/google/langfun
|
6
6
|
Author: Langfun Authors
|
@@ -193,7 +193,9 @@ To install a nightly build, include the `--pre` flag, like this:
|
|
193
193
|
pip install langfun[all] --pre
|
194
194
|
```
|
195
195
|
|
196
|
-
If you want to customize your installation, you can select specific features
|
196
|
+
If you want to customize your installation, you can select specific features
|
197
|
+
using package names like `langfun[X1, X2, ..., Xn]`, where `Xi` corresponds to
|
198
|
+
a tag from the list below:
|
197
199
|
|
198
200
|
| Tag | Description |
|
199
201
|
| ------------------- | ---------------------------------------- |
|
@@ -201,15 +203,36 @@ If you want to customize your installation, you can select specific features usi
|
|
201
203
|
| vertexai | VertexAI access. |
|
202
204
|
| mime | All MIME supports. |
|
203
205
|
| mime-auto | Automatic MIME type detection. |
|
204
|
-
| mime-docx | DocX format support. |
|
205
206
|
| mime-pil | Image support for PIL. |
|
206
|
-
| mime-xlsx | XlsX format support. |
|
207
207
|
| ui | UI enhancements |
|
208
208
|
|
209
|
-
|
210
|
-
|
209
|
+
For example, to install a nightly build that includes VertexAI access, full
|
210
|
+
modality support, and UI enhancements, use:
|
211
211
|
```
|
212
212
|
pip install langfun[vertexai,mime,ui] --pre
|
213
213
|
```
|
214
214
|
|
215
|
+
### Solving import issue with `libmagic`
|
216
|
+
|
217
|
+
Langfun utilizes `libmagic` for automatic MIME type detection to support
|
218
|
+
multi-modal functionalities. However, `pip install libmagic` may not work
|
219
|
+
out-of-the-box on all operation systems, sometimes leading to an
|
220
|
+
`'ImportError: failed to find libmagic.'` error after Langfun installation.
|
221
|
+
|
222
|
+
If you encounter this error, you will need to follow the recommendations below
|
223
|
+
to fix the installation of `libmagic` library.
|
224
|
+
|
225
|
+
#### OSX
|
226
|
+
|
227
|
+
```
|
228
|
+
conda install conda-forge::libmagic
|
229
|
+
```
|
230
|
+
|
231
|
+
#### Windows:
|
232
|
+
```
|
233
|
+
pip install python-magic
|
234
|
+
pip uninstall python-magic-bin
|
235
|
+
pip install python-magic-bin
|
236
|
+
```
|
237
|
+
|
215
238
|
*Disclaimer: this is not an officially supported Google product.*
|
@@ -1,4 +1,4 @@
|
|
1
|
-
langfun/__init__.py,sha256=
|
1
|
+
langfun/__init__.py,sha256=krEJ1lyDkNARsacY6nBQpD3bQrFi4fifD-FwpwPbFPM,2635
|
2
2
|
langfun/core/__init__.py,sha256=pW4prpiyWNkRbtWBGYF1thn7_0F_TgDVfAIZPvGn6HA,4758
|
3
3
|
langfun/core/component.py,sha256=g1kQM0bryYYYWVDrSMnHfc74wIBbpfe5_B3s-UIP5GE,3028
|
4
4
|
langfun/core/component_test.py,sha256=0CxTgjAud3aj8wBauFhG2FHDqrxCTl4OI4gzQTad-40,9254
|
@@ -26,10 +26,10 @@ langfun/core/subscription_test.py,sha256=Y4ZdbZEwm83YNZBxHff0QR4QUa4rdaNXA3_jfIc
|
|
26
26
|
langfun/core/template.py,sha256=jNhYSrbLIn9kZOa03w5QZbyjgfnzJzE_ZrrMvvWY4t4,24929
|
27
27
|
langfun/core/template_test.py,sha256=AQv_m9qE93WxhEhSlm1xaBgB4hu0UVtA53dljngkUW0,17090
|
28
28
|
langfun/core/agentic/__init__.py,sha256=qR3jlfUO4rhIoYdRDLz-d22YZf3FvU4FW88vsjiGDQQ,1224
|
29
|
-
langfun/core/agentic/action.py,sha256=
|
30
|
-
langfun/core/agentic/action_eval.py,sha256
|
29
|
+
langfun/core/agentic/action.py,sha256=9P7xDiZVUV9MvJDfuAfLx-xa7qvS5F0EOGWDQnjAZBw,38931
|
30
|
+
langfun/core/agentic/action_eval.py,sha256=NwjQ5hR-7YT6mo2q0mbDOgmNCKzTMpEzslYtR3fjXJY,4862
|
31
31
|
langfun/core/agentic/action_eval_test.py,sha256=tRUkWmOE9p0rpNOq19xAY2oDEnYsEEykjg6sUpAwJk0,2832
|
32
|
-
langfun/core/agentic/action_test.py,sha256=
|
32
|
+
langfun/core/agentic/action_test.py,sha256=9EZKgLaBrqTErSRoxtrSlzmCz_cbnwWu0ZqpwKLst-s,10224
|
33
33
|
langfun/core/coding/__init__.py,sha256=5utju_fwEsImaiftx4oXKl9FAM8p281k8-Esdh_-m1w,835
|
34
34
|
langfun/core/coding/python/__init__.py,sha256=4ByknuoNU-mOIHwHKnTtmo6oD64oMFtlqPlYWmA5Wic,1736
|
35
35
|
langfun/core/coding/python/correction.py,sha256=7zBedlhQKMPA4cfchUMxAOFl6Zl5RqCyllRHGWys40s,7092
|
@@ -52,7 +52,7 @@ langfun/core/data/conversion/openai.py,sha256=sSpkDSxMJWJ3I1dNICBCzvLsJv4iiLg8FP
|
|
52
52
|
langfun/core/data/conversion/openai_test.py,sha256=38WV_3ofFZiUF10bTKnZp4VyuDP5-81aR3h3Q0HlBm0,5283
|
53
53
|
langfun/core/eval/__init__.py,sha256=OEXr1ZRuvLuhJJfuQ1ZWQ-SvYzjyrtiAAEogYaB7E6o,1933
|
54
54
|
langfun/core/eval/base.py,sha256=qIJnrO1jX5pzY8yoQTtcTn5lGdD9adz5U6C_jla1BV4,75806
|
55
|
-
langfun/core/eval/base_test.py,sha256=
|
55
|
+
langfun/core/eval/base_test.py,sha256=q4wEd2KDUxzUkeELwof0HXBKe9TMQYUq84ddA043VPg,27191
|
56
56
|
langfun/core/eval/matching.py,sha256=AVKkGoc-BaHEzgSBamaAk3194TgqckDe_dinpS6LrXI,9323
|
57
57
|
langfun/core/eval/matching_test.py,sha256=2xtwsTi-UzLTt0QnXl3u_eAG3fFjCG2tsae7YkcQTB0,5312
|
58
58
|
langfun/core/eval/patching.py,sha256=R0s2eAd1m97exQt06dmUL0V_MBG0W2Hxg7fhNB7cXW0,3866
|
@@ -63,8 +63,8 @@ langfun/core/eval/v2/__init__.py,sha256=9lNKJwbvl0lcFblAXYT_OHI8fOubJsTOdSkxEqsP
|
|
63
63
|
langfun/core/eval/v2/checkpointing.py,sha256=t47rBfzGZYgIqWW1N1Ak9yQnNtHd-IRbEO0cZjG2VRo,11755
|
64
64
|
langfun/core/eval/v2/checkpointing_test.py,sha256=NggOSJ_6XSa4cNP6nGIu9wLsK59dUwe8SPWDiXtGGDE,9197
|
65
65
|
langfun/core/eval/v2/eval_test_helper.py,sha256=sKFi_wPYCNmr96WyTduuXY0KnxjFxcJyEhXey-_nGX8,3962
|
66
|
-
langfun/core/eval/v2/evaluation.py,sha256=
|
67
|
-
langfun/core/eval/v2/evaluation_test.py,sha256=
|
66
|
+
langfun/core/eval/v2/evaluation.py,sha256=4Kcpve_dlti3FWxd7KtZaapsva_C7sOGjyJ69xsXLY4,26992
|
67
|
+
langfun/core/eval/v2/evaluation_test.py,sha256=QNp_HEvRTupvNuLEeYTvylykh1Ut2jpMqHQ-gCUZQ10,6919
|
68
68
|
langfun/core/eval/v2/example.py,sha256=Jegt-viQSNYzPVkOZE_M19GON2TYGTct4Cp9HnJ7DGo,10861
|
69
69
|
langfun/core/eval/v2/example_test.py,sha256=1DNm6EuyZOq827DKvf3oTRVFkMNM_qTnLUpvOjpgz5I,3419
|
70
70
|
langfun/core/eval/v2/experiment.py,sha256=xlQvx-AgPCgHNaBoW1HxddA9wby-odADF0VJ3rQjw_M,32978
|
@@ -126,19 +126,19 @@ langfun/core/modalities/pdf.py,sha256=mfaeCbUA4JslFVTARiJh8hW7imvL4tLVw9gUhO5bAZ
|
|
126
126
|
langfun/core/modalities/pdf_test.py,sha256=ulZ0FbnlsU0wkrdckJ4ONZPTYRyMPO9Aob1UO6FXygk,1950
|
127
127
|
langfun/core/modalities/video.py,sha256=vI9apcHIHGyp90i34Srg7S3G6IBDtDCk8qiXhwRQmkw,967
|
128
128
|
langfun/core/modalities/video_test.py,sha256=7OXZoohKMYjt7vrJUdPb553HLyl1oBOKRgzBePFv68Q,2042
|
129
|
-
langfun/core/structured/__init__.py,sha256=
|
129
|
+
langfun/core/structured/__init__.py,sha256=xWO1RO-gy12REgiPn4oWWALZxJhHtBOOdDsawKN_SfY,3334
|
130
130
|
langfun/core/structured/completion.py,sha256=yW95Yd4wbt964I5wIyPUtIVeeqeZbA6HidLgN0ZpWm0,8110
|
131
131
|
langfun/core/structured/completion_test.py,sha256=VtYfI3ciVSSWbi8x3l1WwpWK-Ofn2DMHYEEqm2uTzhw,19314
|
132
132
|
langfun/core/structured/description.py,sha256=6BztYOiucPkF4CrTQtPLPJo1gN2dwnKmaJW83GBf4H0,5213
|
133
133
|
langfun/core/structured/description_test.py,sha256=UxaXnKKP7TnyPDPUyf3U-zPE0TvLlIP6DGr8thjcePw,7365
|
134
134
|
langfun/core/structured/function_generation.py,sha256=g7AOR_e8HxFU6n6Df750aGkgMgV1KExLZMAz0yd5Agg,8555
|
135
135
|
langfun/core/structured/function_generation_test.py,sha256=LaXYDXf9GlqUrR6v_gtmK_H4kxzonmU7SYbn7XXMgjU,12128
|
136
|
-
langfun/core/structured/mapping.py,sha256=
|
136
|
+
langfun/core/structured/mapping.py,sha256=gxdcYQP9yqbDRtiJQ1RRAOrKHiCr0h6xBYLCRKE4I3c,13723
|
137
137
|
langfun/core/structured/mapping_test.py,sha256=OntYvfDitAf0tAnzQty3YS90vyEn6FY1Mi93r_ViEk8,9594
|
138
138
|
langfun/core/structured/parsing.py,sha256=MGvI7ypXlwfzr5XB8_TFU9Ei0_5reYqkWkv64eAy0EA,12015
|
139
|
-
langfun/core/structured/parsing_test.py,sha256=
|
140
|
-
langfun/core/structured/querying.py,sha256=
|
141
|
-
langfun/core/structured/querying_test.py,sha256=
|
139
|
+
langfun/core/structured/parsing_test.py,sha256=V8Cj1tJK4Lxv_b0YQj6-2hzXZgnYNBa2JR7rOLRBKoQ,22346
|
140
|
+
langfun/core/structured/querying.py,sha256=NA5LL97ny9aIml3wz4GPzFsvAH2XafZIGoZbIhuV8nA,30456
|
141
|
+
langfun/core/structured/querying_test.py,sha256=_npZ3ztaZc6VerP7nU_QTJscWGgBqiwTE02z_S3Ahd4,40197
|
142
142
|
langfun/core/structured/schema.py,sha256=pGiAjez-ON2nKLUSeAls27gJsMto5aJnCXLVwH3pUKM,28296
|
143
143
|
langfun/core/structured/schema_generation.py,sha256=3AcuKvv3VOtKY5zMVqODrxfOuDxzoZtGeBxHlOWDOWw,5308
|
144
144
|
langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
|
@@ -156,8 +156,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
|
|
156
156
|
langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
|
157
157
|
langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
|
158
158
|
langfun/core/templates/selfplay_test.py,sha256=Ot__1P1M8oJfoTp-M9-PQ6HUXqZKyMwvZ5f7yQ3yfyM,2326
|
159
|
-
langfun-0.1.2.
|
160
|
-
langfun-0.1.2.
|
161
|
-
langfun-0.1.2.
|
162
|
-
langfun-0.1.2.
|
163
|
-
langfun-0.1.2.
|
159
|
+
langfun-0.1.2.dev202504300804.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
160
|
+
langfun-0.1.2.dev202504300804.dist-info/METADATA,sha256=rlaBu8x--oQz7DAbnG3snNBBk7ltVc1RFvtOcE9cW3Q,8178
|
161
|
+
langfun-0.1.2.dev202504300804.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
162
|
+
langfun-0.1.2.dev202504300804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
|
163
|
+
langfun-0.1.2.dev202504300804.dist-info/RECORD,,
|
{langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{langfun-0.1.2.dev202504280818.dist-info → langfun-0.1.2.dev202504300804.dist-info}/top_level.txt
RENAMED
File without changes
|