langfun 0.1.2.dev202510230805__py3-none-any.whl → 0.1.2.dev202511160804__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/core/__init__.py +1 -0
- langfun/core/agentic/action.py +107 -12
- langfun/core/agentic/action_eval.py +9 -2
- langfun/core/agentic/action_test.py +25 -0
- langfun/core/async_support.py +32 -3
- langfun/core/coding/python/correction.py +19 -9
- langfun/core/coding/python/execution.py +14 -12
- langfun/core/coding/python/generation.py +21 -16
- langfun/core/coding/python/sandboxing.py +23 -3
- langfun/core/component.py +42 -3
- langfun/core/concurrent.py +70 -6
- langfun/core/concurrent_test.py +1 -0
- langfun/core/console.py +1 -1
- langfun/core/data/conversion/anthropic.py +12 -3
- langfun/core/data/conversion/anthropic_test.py +8 -6
- langfun/core/data/conversion/gemini.py +9 -2
- langfun/core/data/conversion/gemini_test.py +12 -9
- langfun/core/data/conversion/openai.py +145 -31
- langfun/core/data/conversion/openai_test.py +161 -17
- langfun/core/eval/base.py +47 -43
- langfun/core/eval/base_test.py +4 -4
- langfun/core/eval/matching.py +5 -2
- langfun/core/eval/patching.py +3 -3
- langfun/core/eval/scoring.py +4 -3
- langfun/core/eval/v2/__init__.py +1 -0
- langfun/core/eval/v2/checkpointing.py +39 -5
- langfun/core/eval/v2/checkpointing_test.py +1 -1
- langfun/core/eval/v2/eval_test_helper.py +96 -0
- langfun/core/eval/v2/evaluation.py +87 -15
- langfun/core/eval/v2/evaluation_test.py +9 -3
- langfun/core/eval/v2/example.py +45 -39
- langfun/core/eval/v2/example_test.py +3 -3
- langfun/core/eval/v2/experiment.py +51 -8
- langfun/core/eval/v2/metric_values.py +31 -3
- langfun/core/eval/v2/metric_values_test.py +32 -0
- langfun/core/eval/v2/metrics.py +157 -44
- langfun/core/eval/v2/metrics_test.py +39 -18
- langfun/core/eval/v2/progress.py +30 -1
- langfun/core/eval/v2/progress_test.py +27 -0
- langfun/core/eval/v2/progress_tracking_test.py +3 -0
- langfun/core/eval/v2/reporting.py +90 -71
- langfun/core/eval/v2/reporting_test.py +20 -6
- langfun/core/eval/v2/runners/__init__.py +26 -0
- langfun/core/eval/v2/{runners.py → runners/base.py} +22 -124
- langfun/core/eval/v2/runners/debug.py +40 -0
- langfun/core/eval/v2/runners/debug_test.py +79 -0
- langfun/core/eval/v2/runners/parallel.py +100 -0
- langfun/core/eval/v2/runners/parallel_test.py +98 -0
- langfun/core/eval/v2/runners/sequential.py +47 -0
- langfun/core/eval/v2/runners/sequential_test.py +175 -0
- langfun/core/langfunc.py +45 -130
- langfun/core/langfunc_test.py +6 -4
- langfun/core/language_model.py +103 -16
- langfun/core/language_model_test.py +9 -3
- langfun/core/llms/__init__.py +7 -1
- langfun/core/llms/anthropic.py +157 -2
- langfun/core/llms/azure_openai.py +29 -17
- langfun/core/llms/cache/base.py +25 -3
- langfun/core/llms/cache/in_memory.py +48 -7
- langfun/core/llms/cache/in_memory_test.py +14 -4
- langfun/core/llms/compositional.py +25 -1
- langfun/core/llms/deepseek.py +30 -2
- langfun/core/llms/fake.py +32 -1
- langfun/core/llms/gemini.py +14 -9
- langfun/core/llms/google_genai.py +29 -1
- langfun/core/llms/groq.py +28 -3
- langfun/core/llms/llama_cpp.py +23 -4
- langfun/core/llms/openai.py +36 -3
- langfun/core/llms/openai_compatible.py +148 -27
- langfun/core/llms/openai_compatible_test.py +207 -20
- langfun/core/llms/openai_test.py +0 -2
- langfun/core/llms/rest.py +12 -1
- langfun/core/llms/vertexai.py +51 -8
- langfun/core/logging.py +1 -1
- langfun/core/mcp/client.py +77 -22
- langfun/core/mcp/client_test.py +8 -35
- langfun/core/mcp/session.py +94 -29
- langfun/core/mcp/session_test.py +54 -0
- langfun/core/mcp/tool.py +151 -22
- langfun/core/mcp/tool_test.py +197 -0
- langfun/core/memory.py +1 -0
- langfun/core/message.py +160 -55
- langfun/core/message_test.py +65 -81
- langfun/core/modalities/__init__.py +8 -0
- langfun/core/modalities/audio.py +21 -1
- langfun/core/modalities/image.py +19 -1
- langfun/core/modalities/mime.py +62 -3
- langfun/core/modalities/pdf.py +19 -1
- langfun/core/modalities/video.py +21 -1
- langfun/core/modality.py +167 -29
- langfun/core/modality_test.py +42 -12
- langfun/core/natural_language.py +1 -1
- langfun/core/sampling.py +4 -4
- langfun/core/sampling_test.py +20 -4
- langfun/core/structured/__init__.py +2 -24
- langfun/core/structured/completion.py +34 -44
- langfun/core/structured/completion_test.py +23 -43
- langfun/core/structured/description.py +54 -50
- langfun/core/structured/function_generation.py +29 -12
- langfun/core/structured/mapping.py +81 -37
- langfun/core/structured/parsing.py +95 -79
- langfun/core/structured/parsing_test.py +0 -3
- langfun/core/structured/querying.py +215 -142
- langfun/core/structured/querying_test.py +65 -29
- langfun/core/structured/schema/__init__.py +48 -0
- langfun/core/structured/schema/base.py +664 -0
- langfun/core/structured/schema/base_test.py +531 -0
- langfun/core/structured/schema/json.py +174 -0
- langfun/core/structured/schema/json_test.py +121 -0
- langfun/core/structured/schema/python.py +316 -0
- langfun/core/structured/schema/python_test.py +410 -0
- langfun/core/structured/schema_generation.py +33 -14
- langfun/core/structured/scoring.py +47 -36
- langfun/core/structured/tokenization.py +26 -11
- langfun/core/subscription.py +2 -2
- langfun/core/template.py +174 -49
- langfun/core/template_test.py +123 -17
- langfun/env/__init__.py +8 -2
- langfun/env/base_environment.py +320 -128
- langfun/env/base_environment_test.py +473 -0
- langfun/env/base_feature.py +92 -15
- langfun/env/base_feature_test.py +228 -0
- langfun/env/base_sandbox.py +84 -361
- langfun/env/base_sandbox_test.py +1235 -0
- langfun/env/event_handlers/__init__.py +1 -1
- langfun/env/event_handlers/chain.py +233 -0
- langfun/env/event_handlers/chain_test.py +253 -0
- langfun/env/event_handlers/event_logger.py +95 -98
- langfun/env/event_handlers/event_logger_test.py +21 -21
- langfun/env/event_handlers/metric_writer.py +225 -140
- langfun/env/event_handlers/metric_writer_test.py +23 -6
- langfun/env/interface.py +854 -40
- langfun/env/interface_test.py +112 -2
- langfun/env/load_balancers_test.py +23 -2
- langfun/env/test_utils.py +126 -84
- {langfun-0.1.2.dev202510230805.dist-info → langfun-0.1.2.dev202511160804.dist-info}/METADATA +1 -1
- langfun-0.1.2.dev202511160804.dist-info/RECORD +211 -0
- langfun/core/eval/v2/runners_test.py +0 -343
- langfun/core/structured/schema.py +0 -987
- langfun/core/structured/schema_test.py +0 -982
- langfun/env/base_test.py +0 -1481
- langfun/env/event_handlers/base.py +0 -350
- langfun-0.1.2.dev202510230805.dist-info/RECORD +0 -195
- {langfun-0.1.2.dev202510230805.dist-info → langfun-0.1.2.dev202511160804.dist-info}/WHEEL +0 -0
- {langfun-0.1.2.dev202510230805.dist-info → langfun-0.1.2.dev202511160804.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202510230805.dist-info → langfun-0.1.2.dev202511160804.dist-info}/top_level.txt +0 -0
|
@@ -31,30 +31,32 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
31
31
|
pool_size=2,
|
|
32
32
|
outage_grace_period=0,
|
|
33
33
|
outage_retry_interval=0,
|
|
34
|
-
housekeep_interval=
|
|
34
|
+
housekeep_interval=10.0,
|
|
35
35
|
sandbox_keepalive_interval=1.0,
|
|
36
|
-
|
|
36
|
+
event_handler=writer,
|
|
37
37
|
)
|
|
38
38
|
with env:
|
|
39
|
-
with env.sandbox('session1') as sb:
|
|
39
|
+
with env.sandbox(session_id='session1') as sb:
|
|
40
40
|
self.assertEqual(sb.test_feature1.num_shell_calls(), 4)
|
|
41
41
|
|
|
42
42
|
with self.assertRaises(interface.SandboxStateError):
|
|
43
|
-
with env.sandbox('session2') as sb:
|
|
43
|
+
with env.sandbox(session_id='session2') as sb:
|
|
44
44
|
sb.shell('echo "bar"', raise_error=RuntimeError)
|
|
45
45
|
|
|
46
|
-
self.
|
|
46
|
+
self.assertIn(
|
|
47
47
|
writer._sandbox_start.value(
|
|
48
48
|
app='test_app',
|
|
49
49
|
environment_id='testing-env',
|
|
50
|
+
image_id='test_image',
|
|
50
51
|
error='Success'
|
|
51
52
|
),
|
|
52
|
-
2
|
|
53
|
+
(2, 3)
|
|
53
54
|
)
|
|
54
55
|
self.assertGreater(
|
|
55
56
|
writer._sandbox_housekeep.value(
|
|
56
57
|
app='test_app',
|
|
57
58
|
environment_id='testing-env',
|
|
59
|
+
image_id='test_image',
|
|
58
60
|
error='Success'
|
|
59
61
|
),
|
|
60
62
|
0,
|
|
@@ -63,6 +65,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
63
65
|
writer._sandbox_shutdown.value(
|
|
64
66
|
app='test_app',
|
|
65
67
|
environment_id='testing-env',
|
|
68
|
+
image_id='test_image',
|
|
66
69
|
error='Success'
|
|
67
70
|
),
|
|
68
71
|
2
|
|
@@ -71,6 +74,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
71
74
|
writer._sandbox_count.value(
|
|
72
75
|
app='test_app',
|
|
73
76
|
environment_id='testing-env',
|
|
77
|
+
image_id='test_image',
|
|
74
78
|
status='ready',
|
|
75
79
|
),
|
|
76
80
|
0
|
|
@@ -79,6 +83,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
79
83
|
writer._sandbox_count.value(
|
|
80
84
|
app='test_app',
|
|
81
85
|
environment_id='testing-env',
|
|
86
|
+
image_id='test_image',
|
|
82
87
|
status='offline',
|
|
83
88
|
),
|
|
84
89
|
0
|
|
@@ -87,6 +92,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
87
92
|
writer._feature_setup.value(
|
|
88
93
|
app='test_app',
|
|
89
94
|
environment_id='testing-env',
|
|
95
|
+
image_id='test_image',
|
|
90
96
|
feature_name='test_feature1',
|
|
91
97
|
error='Success'
|
|
92
98
|
),
|
|
@@ -96,6 +102,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
96
102
|
writer._feature_setup.value(
|
|
97
103
|
app='test_app',
|
|
98
104
|
environment_id='testing-env',
|
|
105
|
+
image_id='test_image',
|
|
99
106
|
feature_name='test_feature2',
|
|
100
107
|
error='Success'
|
|
101
108
|
),
|
|
@@ -105,6 +112,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
105
112
|
writer._feature_setup_session.value(
|
|
106
113
|
app='test_app',
|
|
107
114
|
environment_id='testing-env',
|
|
115
|
+
image_id='test_image',
|
|
108
116
|
feature_name='test_feature1',
|
|
109
117
|
error='Success'
|
|
110
118
|
),
|
|
@@ -114,6 +122,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
114
122
|
writer._feature_setup_session.value(
|
|
115
123
|
app='test_app',
|
|
116
124
|
environment_id='testing-env',
|
|
125
|
+
image_id='test_image',
|
|
117
126
|
feature_name='test_feature2',
|
|
118
127
|
error='Success'
|
|
119
128
|
),
|
|
@@ -123,6 +132,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
123
132
|
writer._feature_teardown_session.value(
|
|
124
133
|
app='test_app',
|
|
125
134
|
environment_id='testing-env',
|
|
135
|
+
image_id='test_image',
|
|
126
136
|
feature_name='test_feature1',
|
|
127
137
|
error='Success'
|
|
128
138
|
),
|
|
@@ -132,6 +142,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
132
142
|
writer._feature_teardown_session.value(
|
|
133
143
|
app='test_app',
|
|
134
144
|
environment_id='testing-env',
|
|
145
|
+
image_id='test_image',
|
|
135
146
|
feature_name='test_feature2',
|
|
136
147
|
error='Success'
|
|
137
148
|
),
|
|
@@ -141,6 +152,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
141
152
|
writer._feature_teardown.value(
|
|
142
153
|
app='test_app',
|
|
143
154
|
environment_id='testing-env',
|
|
155
|
+
image_id='test_image',
|
|
144
156
|
feature_name='test_feature1',
|
|
145
157
|
error='Success'
|
|
146
158
|
),
|
|
@@ -150,6 +162,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
150
162
|
writer._feature_teardown.value(
|
|
151
163
|
app='test_app',
|
|
152
164
|
environment_id='testing-env',
|
|
165
|
+
image_id='test_image',
|
|
153
166
|
feature_name='test_feature2',
|
|
154
167
|
error='Success'
|
|
155
168
|
),
|
|
@@ -159,6 +172,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
159
172
|
writer._feature_housekeep.value(
|
|
160
173
|
app='test_app',
|
|
161
174
|
environment_id='testing-env',
|
|
175
|
+
image_id='test_image',
|
|
162
176
|
feature_name='test_feature1',
|
|
163
177
|
error='Success'
|
|
164
178
|
),
|
|
@@ -168,6 +182,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
168
182
|
writer._feature_housekeep.value(
|
|
169
183
|
app='test_app',
|
|
170
184
|
environment_id='testing-env',
|
|
185
|
+
image_id='test_image',
|
|
171
186
|
feature_name='test_feature2',
|
|
172
187
|
error='Success'
|
|
173
188
|
),
|
|
@@ -177,6 +192,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
177
192
|
writer._sandbox_activity.value(
|
|
178
193
|
app='test_app',
|
|
179
194
|
environment_id='testing-env',
|
|
195
|
+
image_id='test_image',
|
|
180
196
|
activity='shell',
|
|
181
197
|
error='Success'
|
|
182
198
|
),
|
|
@@ -186,6 +202,7 @@ class MetricWriterTest(unittest.TestCase):
|
|
|
186
202
|
writer._sandbox_activity.value(
|
|
187
203
|
app='test_app',
|
|
188
204
|
environment_id='testing-env',
|
|
205
|
+
image_id='test_image',
|
|
189
206
|
activity='shell',
|
|
190
207
|
error='RuntimeError'
|
|
191
208
|
),
|