langfun 0.1.2.dev202501080804__py3-none-any.whl → 0.1.2.dev202501240804__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/core/__init__.py +1 -6
- langfun/core/coding/python/__init__.py +5 -11
- langfun/core/coding/python/correction.py +4 -7
- langfun/core/coding/python/correction_test.py +2 -3
- langfun/core/coding/python/execution.py +22 -211
- langfun/core/coding/python/execution_test.py +11 -90
- langfun/core/coding/python/generation.py +3 -2
- langfun/core/coding/python/generation_test.py +2 -2
- langfun/core/coding/python/parsing.py +108 -194
- langfun/core/coding/python/parsing_test.py +2 -105
- langfun/core/component.py +11 -273
- langfun/core/component_test.py +2 -29
- langfun/core/concurrent.py +187 -82
- langfun/core/concurrent_test.py +28 -19
- langfun/core/console.py +7 -3
- langfun/core/eval/base.py +2 -3
- langfun/core/eval/v2/evaluation.py +3 -1
- langfun/core/eval/v2/reporting.py +8 -4
- langfun/core/language_model.py +84 -8
- langfun/core/language_model_test.py +84 -29
- langfun/core/llms/__init__.py +46 -11
- langfun/core/llms/anthropic.py +1 -123
- langfun/core/llms/anthropic_test.py +0 -48
- langfun/core/llms/deepseek.py +117 -0
- langfun/core/llms/deepseek_test.py +61 -0
- langfun/core/llms/gemini.py +1 -1
- langfun/core/llms/groq.py +12 -99
- langfun/core/llms/groq_test.py +31 -137
- langfun/core/llms/llama_cpp.py +17 -54
- langfun/core/llms/llama_cpp_test.py +2 -34
- langfun/core/llms/openai.py +9 -147
- langfun/core/llms/openai_compatible.py +179 -0
- langfun/core/llms/openai_compatible_test.py +495 -0
- langfun/core/llms/openai_test.py +13 -423
- langfun/core/llms/rest_test.py +1 -1
- langfun/core/llms/vertexai.py +387 -18
- langfun/core/llms/vertexai_test.py +52 -0
- langfun/core/message_test.py +3 -3
- langfun/core/modalities/mime.py +8 -0
- langfun/core/modalities/mime_test.py +19 -4
- langfun/core/modality_test.py +0 -1
- langfun/core/structured/mapping.py +13 -13
- langfun/core/structured/mapping_test.py +2 -2
- langfun/core/structured/schema.py +16 -8
- langfun/core/structured/schema_generation.py +1 -1
- {langfun-0.1.2.dev202501080804.dist-info → langfun-0.1.2.dev202501240804.dist-info}/METADATA +13 -2
- {langfun-0.1.2.dev202501080804.dist-info → langfun-0.1.2.dev202501240804.dist-info}/RECORD +50 -52
- {langfun-0.1.2.dev202501080804.dist-info → langfun-0.1.2.dev202501240804.dist-info}/WHEEL +1 -1
- langfun/core/coding/python/errors.py +0 -108
- langfun/core/coding/python/errors_test.py +0 -99
- langfun/core/coding/python/permissions.py +0 -90
- langfun/core/coding/python/permissions_test.py +0 -86
- langfun/core/text_formatting.py +0 -168
- langfun/core/text_formatting_test.py +0 -65
- {langfun-0.1.2.dev202501080804.dist-info → langfun-0.1.2.dev202501240804.dist-info}/LICENSE +0 -0
- {langfun-0.1.2.dev202501080804.dist-info → langfun-0.1.2.dev202501240804.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,495 @@
|
|
1
|
+
# Copyright 2023 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 OpenAI models."""
|
15
|
+
|
16
|
+
from typing import Any
|
17
|
+
import unittest
|
18
|
+
from unittest import mock
|
19
|
+
|
20
|
+
import langfun.core as lf
|
21
|
+
from langfun.core import modalities as lf_modalities
|
22
|
+
from langfun.core.llms import openai_compatible
|
23
|
+
import pyglove as pg
|
24
|
+
import requests
|
25
|
+
|
26
|
+
|
27
|
+
def mock_chat_completion_request(url: str, json: dict[str, Any], **kwargs):
|
28
|
+
del url, kwargs
|
29
|
+
messages = json['messages']
|
30
|
+
if len(messages) > 1:
|
31
|
+
system_message = f' system={messages[0]["content"]}'
|
32
|
+
else:
|
33
|
+
system_message = ''
|
34
|
+
|
35
|
+
if 'response_format' in json:
|
36
|
+
response_format = f' format={json["response_format"]["type"]}'
|
37
|
+
else:
|
38
|
+
response_format = ''
|
39
|
+
|
40
|
+
choices = []
|
41
|
+
for k in range(json['n']):
|
42
|
+
if json.get('logprobs'):
|
43
|
+
logprobs = dict(
|
44
|
+
content=[
|
45
|
+
dict(
|
46
|
+
token='chosen_token',
|
47
|
+
logprob=0.5,
|
48
|
+
top_logprobs=[
|
49
|
+
dict(
|
50
|
+
token=f'alternative_token_{i + 1}',
|
51
|
+
logprob=0.1
|
52
|
+
) for i in range(3)
|
53
|
+
]
|
54
|
+
)
|
55
|
+
]
|
56
|
+
)
|
57
|
+
else:
|
58
|
+
logprobs = None
|
59
|
+
|
60
|
+
choices.append(dict(
|
61
|
+
message=dict(
|
62
|
+
content=(
|
63
|
+
f'Sample {k} for message.{system_message}{response_format}'
|
64
|
+
)
|
65
|
+
),
|
66
|
+
logprobs=logprobs,
|
67
|
+
))
|
68
|
+
response = requests.Response()
|
69
|
+
response.status_code = 200
|
70
|
+
response._content = pg.to_json_str(
|
71
|
+
dict(
|
72
|
+
choices=choices,
|
73
|
+
usage=lf.LMSamplingUsage(
|
74
|
+
prompt_tokens=100,
|
75
|
+
completion_tokens=100,
|
76
|
+
total_tokens=200,
|
77
|
+
),
|
78
|
+
)
|
79
|
+
).encode()
|
80
|
+
return response
|
81
|
+
|
82
|
+
|
83
|
+
def mock_chat_completion_request_vision(
|
84
|
+
url: str, json: dict[str, Any], **kwargs
|
85
|
+
):
|
86
|
+
del url, kwargs
|
87
|
+
choices = []
|
88
|
+
urls = [
|
89
|
+
c['image_url']['url']
|
90
|
+
for c in json['messages'][0]['content'] if c['type'] == 'image_url'
|
91
|
+
]
|
92
|
+
for k in range(json['n']):
|
93
|
+
choices.append(pg.Dict(
|
94
|
+
message=pg.Dict(
|
95
|
+
content=f'Sample {k} for message: {"".join(urls)}'
|
96
|
+
),
|
97
|
+
logprobs=None,
|
98
|
+
))
|
99
|
+
response = requests.Response()
|
100
|
+
response.status_code = 200
|
101
|
+
response._content = pg.to_json_str(
|
102
|
+
dict(
|
103
|
+
choices=choices,
|
104
|
+
usage=lf.LMSamplingUsage(
|
105
|
+
prompt_tokens=100,
|
106
|
+
completion_tokens=100,
|
107
|
+
total_tokens=200,
|
108
|
+
),
|
109
|
+
)
|
110
|
+
).encode()
|
111
|
+
return response
|
112
|
+
|
113
|
+
|
114
|
+
class OpenAIComptibleTest(unittest.TestCase):
|
115
|
+
"""Tests for OpenAI compatible language model."""
|
116
|
+
|
117
|
+
def test_request_args(self):
|
118
|
+
self.assertEqual(
|
119
|
+
openai_compatible.OpenAICompatible(
|
120
|
+
api_endpoint='https://test-server',
|
121
|
+
model='test-model'
|
122
|
+
)._request_args(
|
123
|
+
lf.LMSamplingOptions(
|
124
|
+
temperature=1.0, stop=['\n'], n=1, random_seed=123
|
125
|
+
)
|
126
|
+
),
|
127
|
+
dict(
|
128
|
+
model='test-model',
|
129
|
+
top_logprobs=None,
|
130
|
+
n=1,
|
131
|
+
temperature=1.0,
|
132
|
+
stop=['\n'],
|
133
|
+
seed=123,
|
134
|
+
),
|
135
|
+
)
|
136
|
+
|
137
|
+
def test_call_chat_completion(self):
|
138
|
+
with mock.patch('requests.Session.post') as mock_request:
|
139
|
+
mock_request.side_effect = mock_chat_completion_request
|
140
|
+
lm = openai_compatible.OpenAICompatible(
|
141
|
+
api_endpoint='https://test-server', model='test-model',
|
142
|
+
)
|
143
|
+
self.assertEqual(
|
144
|
+
lm('hello', sampling_options=lf.LMSamplingOptions(n=2)),
|
145
|
+
'Sample 0 for message.',
|
146
|
+
)
|
147
|
+
|
148
|
+
def test_call_chat_completion_with_logprobs(self):
|
149
|
+
with mock.patch('requests.Session.post') as mock_request:
|
150
|
+
mock_request.side_effect = mock_chat_completion_request
|
151
|
+
lm = openai_compatible.OpenAICompatible(
|
152
|
+
api_endpoint='https://test-server', model='test-model',
|
153
|
+
)
|
154
|
+
results = lm.sample(['hello'], logprobs=True)
|
155
|
+
for result in results:
|
156
|
+
result.rebind(
|
157
|
+
{path: 0 for path in pg.query(result, '.*total_call_interval')},
|
158
|
+
skip_notification=True,
|
159
|
+
)
|
160
|
+
self.assertEqual(len(results), 1)
|
161
|
+
self.assertEqual(
|
162
|
+
results[0],
|
163
|
+
lf.LMSamplingResult(
|
164
|
+
[
|
165
|
+
lf.LMSample(
|
166
|
+
response=lf.AIMessage(
|
167
|
+
text='Sample 0 for message.',
|
168
|
+
metadata={
|
169
|
+
'score': 0.0,
|
170
|
+
'logprobs': [(
|
171
|
+
'chosen_token',
|
172
|
+
0.5,
|
173
|
+
[
|
174
|
+
('alternative_token_1', 0.1),
|
175
|
+
('alternative_token_2', 0.1),
|
176
|
+
('alternative_token_3', 0.1),
|
177
|
+
],
|
178
|
+
)],
|
179
|
+
'is_cached': False,
|
180
|
+
'usage': lf.LMSamplingUsage(
|
181
|
+
prompt_tokens=100,
|
182
|
+
completion_tokens=100,
|
183
|
+
total_tokens=200,
|
184
|
+
estimated_cost=None,
|
185
|
+
),
|
186
|
+
},
|
187
|
+
tags=['lm-response'],
|
188
|
+
),
|
189
|
+
logprobs=[(
|
190
|
+
'chosen_token',
|
191
|
+
0.5,
|
192
|
+
[
|
193
|
+
('alternative_token_1', 0.1),
|
194
|
+
('alternative_token_2', 0.1),
|
195
|
+
('alternative_token_3', 0.1),
|
196
|
+
],
|
197
|
+
)],
|
198
|
+
)
|
199
|
+
],
|
200
|
+
usage=lf.LMSamplingUsage(
|
201
|
+
prompt_tokens=100,
|
202
|
+
completion_tokens=100,
|
203
|
+
total_tokens=200,
|
204
|
+
estimated_cost=None,
|
205
|
+
),
|
206
|
+
),
|
207
|
+
)
|
208
|
+
|
209
|
+
def test_call_chat_completion_vision(self):
|
210
|
+
with mock.patch('requests.Session.post') as mock_request:
|
211
|
+
mock_request.side_effect = mock_chat_completion_request_vision
|
212
|
+
lm_1 = openai_compatible.OpenAICompatible(
|
213
|
+
api_endpoint='https://test-server',
|
214
|
+
model='test-model1',
|
215
|
+
multimodal=True
|
216
|
+
)
|
217
|
+
lm_2 = openai_compatible.OpenAICompatible(
|
218
|
+
api_endpoint='https://test-server',
|
219
|
+
model='test-model2',
|
220
|
+
multimodal=True
|
221
|
+
)
|
222
|
+
for lm in (lm_1, lm_2):
|
223
|
+
self.assertEqual(
|
224
|
+
lm(
|
225
|
+
lf.UserMessage(
|
226
|
+
'hello <<[[image]]>>',
|
227
|
+
image=lf_modalities.Image.from_uri('https://fake/image')
|
228
|
+
),
|
229
|
+
sampling_options=lf.LMSamplingOptions(n=2)
|
230
|
+
),
|
231
|
+
'Sample 0 for message: https://fake/image',
|
232
|
+
)
|
233
|
+
lm_3 = openai_compatible.OpenAICompatible(
|
234
|
+
api_endpoint='https://test-server', model='test-model3'
|
235
|
+
)
|
236
|
+
with self.assertRaisesRegex(ValueError, 'Unsupported modality'):
|
237
|
+
lm_3(
|
238
|
+
lf.UserMessage(
|
239
|
+
'hello <<[[image]]>>',
|
240
|
+
image=lf_modalities.Image.from_uri('https://fake/image')
|
241
|
+
),
|
242
|
+
)
|
243
|
+
|
244
|
+
def test_sample_chat_completion(self):
|
245
|
+
with mock.patch('requests.Session.post') as mock_request:
|
246
|
+
mock_request.side_effect = mock_chat_completion_request
|
247
|
+
lm = openai_compatible.OpenAICompatible(
|
248
|
+
api_endpoint='https://test-server', model='test-model'
|
249
|
+
)
|
250
|
+
results = lm.sample(
|
251
|
+
['hello', 'bye'], sampling_options=lf.LMSamplingOptions(n=3)
|
252
|
+
)
|
253
|
+
for result in results:
|
254
|
+
result.rebind(
|
255
|
+
{path: 0 for path in pg.query(result, '.*total_call_interval')},
|
256
|
+
skip_notification=True,
|
257
|
+
)
|
258
|
+
|
259
|
+
self.assertEqual(len(results), 2)
|
260
|
+
self.assertEqual(
|
261
|
+
results[0],
|
262
|
+
lf.LMSamplingResult(
|
263
|
+
[
|
264
|
+
lf.LMSample(
|
265
|
+
lf.AIMessage(
|
266
|
+
'Sample 0 for message.',
|
267
|
+
score=0.0,
|
268
|
+
logprobs=None,
|
269
|
+
is_cached=False,
|
270
|
+
usage=lf.LMSamplingUsage(
|
271
|
+
prompt_tokens=33,
|
272
|
+
completion_tokens=33,
|
273
|
+
total_tokens=66,
|
274
|
+
estimated_cost=None,
|
275
|
+
),
|
276
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
277
|
+
),
|
278
|
+
score=0.0,
|
279
|
+
logprobs=None,
|
280
|
+
),
|
281
|
+
lf.LMSample(
|
282
|
+
lf.AIMessage(
|
283
|
+
'Sample 1 for message.',
|
284
|
+
score=0.0,
|
285
|
+
logprobs=None,
|
286
|
+
is_cached=False,
|
287
|
+
usage=lf.LMSamplingUsage(
|
288
|
+
prompt_tokens=33,
|
289
|
+
completion_tokens=33,
|
290
|
+
total_tokens=66,
|
291
|
+
estimated_cost=None,
|
292
|
+
),
|
293
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
294
|
+
),
|
295
|
+
score=0.0,
|
296
|
+
logprobs=None,
|
297
|
+
),
|
298
|
+
lf.LMSample(
|
299
|
+
lf.AIMessage(
|
300
|
+
'Sample 2 for message.',
|
301
|
+
score=0.0,
|
302
|
+
logprobs=None,
|
303
|
+
is_cached=False,
|
304
|
+
usage=lf.LMSamplingUsage(
|
305
|
+
prompt_tokens=33,
|
306
|
+
completion_tokens=33,
|
307
|
+
total_tokens=66,
|
308
|
+
estimated_cost=None,
|
309
|
+
),
|
310
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
311
|
+
),
|
312
|
+
score=0.0,
|
313
|
+
logprobs=None,
|
314
|
+
),
|
315
|
+
],
|
316
|
+
usage=lf.LMSamplingUsage(
|
317
|
+
prompt_tokens=100, completion_tokens=100, total_tokens=200,
|
318
|
+
estimated_cost=None,
|
319
|
+
),
|
320
|
+
),
|
321
|
+
)
|
322
|
+
self.assertEqual(
|
323
|
+
results[1],
|
324
|
+
lf.LMSamplingResult(
|
325
|
+
[
|
326
|
+
lf.LMSample(
|
327
|
+
lf.AIMessage(
|
328
|
+
'Sample 0 for message.',
|
329
|
+
score=0.0,
|
330
|
+
logprobs=None,
|
331
|
+
is_cached=False,
|
332
|
+
usage=lf.LMSamplingUsage(
|
333
|
+
prompt_tokens=33,
|
334
|
+
completion_tokens=33,
|
335
|
+
total_tokens=66,
|
336
|
+
estimated_cost=None,
|
337
|
+
),
|
338
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
339
|
+
),
|
340
|
+
score=0.0,
|
341
|
+
logprobs=None,
|
342
|
+
),
|
343
|
+
lf.LMSample(
|
344
|
+
lf.AIMessage(
|
345
|
+
'Sample 1 for message.',
|
346
|
+
score=0.0,
|
347
|
+
logprobs=None,
|
348
|
+
is_cached=False,
|
349
|
+
usage=lf.LMSamplingUsage(
|
350
|
+
prompt_tokens=33,
|
351
|
+
completion_tokens=33,
|
352
|
+
total_tokens=66,
|
353
|
+
estimated_cost=None,
|
354
|
+
),
|
355
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
356
|
+
),
|
357
|
+
score=0.0,
|
358
|
+
logprobs=None,
|
359
|
+
),
|
360
|
+
lf.LMSample(
|
361
|
+
lf.AIMessage(
|
362
|
+
'Sample 2 for message.',
|
363
|
+
score=0.0,
|
364
|
+
logprobs=None,
|
365
|
+
is_cached=False,
|
366
|
+
usage=lf.LMSamplingUsage(
|
367
|
+
prompt_tokens=33,
|
368
|
+
completion_tokens=33,
|
369
|
+
total_tokens=66,
|
370
|
+
estimated_cost=None,
|
371
|
+
),
|
372
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
373
|
+
),
|
374
|
+
score=0.0,
|
375
|
+
logprobs=None,
|
376
|
+
),
|
377
|
+
],
|
378
|
+
usage=lf.LMSamplingUsage(
|
379
|
+
prompt_tokens=100, completion_tokens=100, total_tokens=200,
|
380
|
+
estimated_cost=None,
|
381
|
+
),
|
382
|
+
),
|
383
|
+
)
|
384
|
+
|
385
|
+
def test_sample_with_contextual_options(self):
|
386
|
+
with mock.patch('requests.Session.post') as mock_request:
|
387
|
+
mock_request.side_effect = mock_chat_completion_request
|
388
|
+
lm = openai_compatible.OpenAICompatible(
|
389
|
+
api_endpoint='https://test-server', model='test-model'
|
390
|
+
)
|
391
|
+
with lf.use_settings(sampling_options=lf.LMSamplingOptions(n=2)):
|
392
|
+
results = lm.sample(['hello'])
|
393
|
+
for result in results:
|
394
|
+
result.rebind(
|
395
|
+
{path: 0 for path in pg.query(result, '.*total_call_interval')},
|
396
|
+
skip_notification=True,
|
397
|
+
)
|
398
|
+
|
399
|
+
self.assertEqual(len(results), 1)
|
400
|
+
self.assertEqual(
|
401
|
+
results[0],
|
402
|
+
lf.LMSamplingResult(
|
403
|
+
[
|
404
|
+
lf.LMSample(
|
405
|
+
lf.AIMessage(
|
406
|
+
'Sample 0 for message.',
|
407
|
+
score=0.0,
|
408
|
+
logprobs=None,
|
409
|
+
is_cached=False,
|
410
|
+
usage=lf.LMSamplingUsage(
|
411
|
+
prompt_tokens=50,
|
412
|
+
completion_tokens=50,
|
413
|
+
total_tokens=100,
|
414
|
+
),
|
415
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
416
|
+
),
|
417
|
+
score=0.0,
|
418
|
+
logprobs=None,
|
419
|
+
),
|
420
|
+
lf.LMSample(
|
421
|
+
lf.AIMessage(
|
422
|
+
'Sample 1 for message.',
|
423
|
+
score=0.0,
|
424
|
+
logprobs=None,
|
425
|
+
is_cached=False,
|
426
|
+
usage=lf.LMSamplingUsage(
|
427
|
+
prompt_tokens=50,
|
428
|
+
completion_tokens=50,
|
429
|
+
total_tokens=100,
|
430
|
+
),
|
431
|
+
tags=[lf.Message.TAG_LM_RESPONSE],
|
432
|
+
),
|
433
|
+
score=0.0,
|
434
|
+
logprobs=None,
|
435
|
+
),
|
436
|
+
],
|
437
|
+
usage=lf.LMSamplingUsage(
|
438
|
+
prompt_tokens=100, completion_tokens=100, total_tokens=200
|
439
|
+
),
|
440
|
+
)
|
441
|
+
)
|
442
|
+
|
443
|
+
def test_call_with_system_message(self):
|
444
|
+
with mock.patch('requests.Session.post') as mock_request:
|
445
|
+
mock_request.side_effect = mock_chat_completion_request
|
446
|
+
lm = openai_compatible.OpenAICompatible(
|
447
|
+
api_endpoint='https://test-server', model='test-model'
|
448
|
+
)
|
449
|
+
self.assertEqual(
|
450
|
+
lm(
|
451
|
+
lf.UserMessage(
|
452
|
+
'hello',
|
453
|
+
system_message='hi',
|
454
|
+
),
|
455
|
+
sampling_options=lf.LMSamplingOptions(n=2)
|
456
|
+
),
|
457
|
+
'''Sample 0 for message. system=[{'type': 'text', 'text': 'hi'}]''',
|
458
|
+
)
|
459
|
+
|
460
|
+
def test_call_with_json_schema(self):
|
461
|
+
with mock.patch('requests.Session.post') as mock_request:
|
462
|
+
mock_request.side_effect = mock_chat_completion_request
|
463
|
+
lm = openai_compatible.OpenAICompatible(
|
464
|
+
api_endpoint='https://test-server', model='test-model'
|
465
|
+
)
|
466
|
+
self.assertEqual(
|
467
|
+
lm(
|
468
|
+
lf.UserMessage(
|
469
|
+
'hello',
|
470
|
+
json_schema={
|
471
|
+
'type': 'object',
|
472
|
+
'properties': {
|
473
|
+
'name': {'type': 'string'},
|
474
|
+
},
|
475
|
+
'required': ['name'],
|
476
|
+
'title': 'Person',
|
477
|
+
}
|
478
|
+
),
|
479
|
+
sampling_options=lf.LMSamplingOptions(n=2)
|
480
|
+
),
|
481
|
+
'Sample 0 for message. format=json_schema',
|
482
|
+
)
|
483
|
+
|
484
|
+
# Test bad json schema.
|
485
|
+
with self.assertRaisesRegex(ValueError, '`json_schema` must be a dict'):
|
486
|
+
lm(lf.UserMessage('hello', json_schema='foo'))
|
487
|
+
|
488
|
+
with self.assertRaisesRegex(
|
489
|
+
ValueError, 'The root of `json_schema` must have a `title` field'
|
490
|
+
):
|
491
|
+
lm(lf.UserMessage('hello', json_schema={}))
|
492
|
+
|
493
|
+
|
494
|
+
if __name__ == '__main__':
|
495
|
+
unittest.main()
|