langfun 0.0.2.dev20240520__py3-none-any.whl → 0.0.2.dev20240524__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/llms/__init__.py +2 -0
- langfun/core/llms/google_genai.py +8 -0
- langfun/core/llms/vertexai.py +25 -5
- langfun/core/llms/vertexai_test.py +1 -1
- langfun/core/modalities/__init__.py +1 -1
- langfun/core/modalities/image.py +8 -16
- langfun/core/modalities/image_test.py +1 -1
- langfun/core/modalities/mime.py +28 -13
- langfun/core/modalities/mime_test.py +2 -2
- langfun/core/modalities/pdf.py +22 -0
- langfun/core/modalities/pdf_test.py +57 -0
- langfun/core/modalities/video.py +8 -23
- langfun/core/modalities/video_test.py +1 -1
- langfun/core/structured/schema.py +4 -1
- langfun/core/structured/schema_test.py +15 -3
- {langfun-0.0.2.dev20240520.dist-info → langfun-0.0.2.dev20240524.dist-info}/METADATA +1 -1
- {langfun-0.0.2.dev20240520.dist-info → langfun-0.0.2.dev20240524.dist-info}/RECORD +20 -18
- {langfun-0.0.2.dev20240520.dist-info → langfun-0.0.2.dev20240524.dist-info}/LICENSE +0 -0
- {langfun-0.0.2.dev20240520.dist-info → langfun-0.0.2.dev20240524.dist-info}/WHEEL +0 -0
- {langfun-0.0.2.dev20240520.dist-info → langfun-0.0.2.dev20240524.dist-info}/top_level.txt +0 -0
langfun/core/llms/__init__.py
CHANGED
@@ -90,6 +90,8 @@ from langfun.core.llms.groq import GroqGemma7B_IT
|
|
90
90
|
|
91
91
|
from langfun.core.llms.vertexai import VertexAI
|
92
92
|
from langfun.core.llms.vertexai import VertexAIGeminiPro1_5
|
93
|
+
from langfun.core.llms.vertexai import VertexAIGeminiPro1_5_0409
|
94
|
+
from langfun.core.llms.vertexai import VertexAIGeminiFlash1_5
|
93
95
|
from langfun.core.llms.vertexai import VertexAIGeminiPro1
|
94
96
|
from langfun.core.llms.vertexai import VertexAIGeminiPro1Vision
|
95
97
|
from langfun.core.llms.vertexai import VertexAIPalm2
|
@@ -35,6 +35,7 @@ class GenAI(lf.LanguageModel):
|
|
35
35
|
'text-bison-001',
|
36
36
|
'chat-bison-001',
|
37
37
|
'gemini-1.5-pro-latest',
|
38
|
+
'gemini-1.5-flash-latest'
|
38
39
|
],
|
39
40
|
'Model name.',
|
40
41
|
]
|
@@ -270,6 +271,13 @@ class GeminiPro1_5(GenAI): # pylint: disable=invalid-name
|
|
270
271
|
multimodal = True
|
271
272
|
|
272
273
|
|
274
|
+
class GeminiFlash1_5(GenAI): # pylint: disable=invalid-name
|
275
|
+
"""Gemini Flash latest model."""
|
276
|
+
|
277
|
+
model = 'gemini-1.5-flash-latest'
|
278
|
+
multimodal = True
|
279
|
+
|
280
|
+
|
273
281
|
class GeminiPro(GenAI):
|
274
282
|
"""Gemini Pro model."""
|
275
283
|
|
langfun/core/llms/vertexai.py
CHANGED
@@ -24,7 +24,9 @@ import pyglove as pg
|
|
24
24
|
|
25
25
|
|
26
26
|
SUPPORTED_MODELS_AND_SETTINGS = {
|
27
|
+
'gemini-1.5-pro-preview-0514': pg.Dict(api='gemini', rpm=5),
|
27
28
|
'gemini-1.5-pro-preview-0409': pg.Dict(api='gemini', rpm=5),
|
29
|
+
'gemini-1.5-flash-preview-0514': pg.Dict(api='gemini', rpm=5),
|
28
30
|
'gemini-1.0-pro': pg.Dict(api='gemini', rpm=300),
|
29
31
|
'gemini-1.0-pro-vision': pg.Dict(api='gemini', rpm=100),
|
30
32
|
# PaLM APIs.
|
@@ -143,8 +145,10 @@ class VertexAI(lf.LanguageModel):
|
|
143
145
|
for lf_chunk in prompt.chunk():
|
144
146
|
if isinstance(lf_chunk, str):
|
145
147
|
chunk = lf_chunk
|
146
|
-
elif self.multimodal and isinstance(lf_chunk, lf_modalities.
|
147
|
-
chunk = generative_models.
|
148
|
+
elif self.multimodal and isinstance(lf_chunk, lf_modalities.MimeType):
|
149
|
+
chunk = generative_models.Part.from_data(
|
150
|
+
lf_chunk.to_bytes(), lf_chunk.mime_type
|
151
|
+
)
|
148
152
|
else:
|
149
153
|
raise ValueError(f'Unsupported modality: {lf_chunk!r}')
|
150
154
|
chunks.append(chunk)
|
@@ -159,14 +163,16 @@ class VertexAI(lf.LanguageModel):
|
|
159
163
|
|
160
164
|
def _sample(self, prompts: list[lf.Message]) -> list[lf.LMSamplingResult]:
|
161
165
|
assert self._api_initialized, 'Vertex AI API is not initialized.'
|
166
|
+
# TODO(yifenglu): It seems this exception is due to the instability of the
|
167
|
+
# API. We should revisit this later.
|
168
|
+
retry_on_errors = [(Exception, 'InternalServerError')]
|
169
|
+
|
162
170
|
return lf.concurrent_execute(
|
163
171
|
self._sample_single,
|
164
172
|
prompts,
|
165
173
|
executor=self.resource_id,
|
166
174
|
max_workers=self.max_concurrency,
|
167
|
-
|
168
|
-
# with rate limit, so we do not retry on errors.
|
169
|
-
retry_on_errors=None,
|
175
|
+
retry_on_errors=retry_on_errors,
|
170
176
|
)
|
171
177
|
|
172
178
|
def _sample_single(self, prompt: lf.Message) -> lf.LMSamplingResult:
|
@@ -262,10 +268,24 @@ _VERTEXAI_MODEL_HUB = _ModelHub()
|
|
262
268
|
class VertexAIGeminiPro1_5(VertexAI): # pylint: disable=invalid-name
|
263
269
|
"""Vertex AI Gemini 1.5 Pro model."""
|
264
270
|
|
271
|
+
model = 'gemini-1.5-pro-preview-0514'
|
272
|
+
multimodal = True
|
273
|
+
|
274
|
+
|
275
|
+
class VertexAIGeminiPro1_5_0409(VertexAI): # pylint: disable=invalid-name
|
276
|
+
"""Vertex AI Gemini 1.5 Pro model."""
|
277
|
+
|
265
278
|
model = 'gemini-1.5-pro-preview-0409'
|
266
279
|
multimodal = True
|
267
280
|
|
268
281
|
|
282
|
+
class VertexAIGeminiFlash1_5(VertexAI): # pylint: disable=invalid-name
|
283
|
+
"""Vertex AI Gemini 1.5 Flash model."""
|
284
|
+
|
285
|
+
model = 'gemini-1.5-flash-preview-0514'
|
286
|
+
multimodal = True
|
287
|
+
|
288
|
+
|
269
289
|
class VertexAIGeminiPro1(VertexAI): # pylint: disable=invalid-name
|
270
290
|
"""Vertex AI Gemini 1.0 Pro model."""
|
271
291
|
|
@@ -86,7 +86,7 @@ class VertexAITest(unittest.TestCase):
|
|
86
86
|
chunks = model._content_from_message(message)
|
87
87
|
self.maxDiff = None
|
88
88
|
self.assertEqual([chunks[0], chunks[2]], ['This is an', ', what is it?'])
|
89
|
-
self.assertIsInstance(chunks[1], generative_models.
|
89
|
+
self.assertIsInstance(chunks[1], generative_models.Part)
|
90
90
|
|
91
91
|
def test_generation_response_to_message_text_only(self):
|
92
92
|
response = generative_models.GenerationResponse.from_dict({
|
@@ -19,8 +19,8 @@
|
|
19
19
|
|
20
20
|
from langfun.core.modalities.mime import MimeType
|
21
21
|
from langfun.core.modalities.mime import Custom
|
22
|
-
from langfun.core.modalities.mime import PDF
|
23
22
|
from langfun.core.modalities.image import Image
|
23
|
+
from langfun.core.modalities.pdf import PDF
|
24
24
|
from langfun.core.modalities.video import Video
|
25
25
|
|
26
26
|
# pylint: enable=g-import-not-at-top
|
langfun/core/modalities/image.py
CHANGED
@@ -13,26 +13,18 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
"""Image modality."""
|
15
15
|
|
16
|
-
import
|
17
|
-
from typing import cast
|
16
|
+
import functools
|
18
17
|
from langfun.core.modalities import mime
|
19
18
|
|
20
19
|
|
21
20
|
class Image(mime.MimeType):
|
22
|
-
"""
|
21
|
+
"""Image."""
|
23
22
|
|
24
|
-
|
25
|
-
def image_format(self) -> str:
|
26
|
-
iformat = imghdr.what(None, self.to_bytes())
|
27
|
-
if iformat not in ['png', 'jpeg']:
|
28
|
-
raise ValueError(f'Unsupported image format: {iformat!r}.')
|
29
|
-
return cast(str, iformat)
|
23
|
+
MIME_PREFIX = 'image'
|
30
24
|
|
31
|
-
@
|
32
|
-
def
|
33
|
-
return
|
25
|
+
@functools.cached_property
|
26
|
+
def image_format(self) -> str:
|
27
|
+
return self.mime_type.removeprefix(self.MIME_PREFIX + '/')
|
34
28
|
|
35
|
-
def
|
36
|
-
|
37
|
-
return f'<img src="{self.uri}">'
|
38
|
-
return f'<img src="{self.content_uri}">'
|
29
|
+
def _html(self, uri: str) -> str:
|
30
|
+
return f'<img src="{uri}">'
|
@@ -46,7 +46,7 @@ class ImageContentTest(unittest.TestCase):
|
|
46
46
|
|
47
47
|
def test_bad_image(self):
|
48
48
|
image = image_lib.Image.from_bytes(b'bad')
|
49
|
-
with self.assertRaisesRegex(ValueError, '
|
49
|
+
with self.assertRaisesRegex(ValueError, 'Expected MIME type'):
|
50
50
|
_ = image.image_format
|
51
51
|
|
52
52
|
|
langfun/core/modalities/mime.py
CHANGED
@@ -13,10 +13,11 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
"""MIME type data."""
|
15
15
|
|
16
|
-
import abc
|
17
16
|
import base64
|
17
|
+
import functools
|
18
18
|
from typing import Annotated, Union
|
19
19
|
import langfun.core as lf
|
20
|
+
import magic
|
20
21
|
import pyglove as pg
|
21
22
|
import requests
|
22
23
|
|
@@ -24,10 +25,9 @@ import requests
|
|
24
25
|
class MimeType(lf.Modality):
|
25
26
|
"""Base for MIME type data."""
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"""Returns the MIME type."""
|
28
|
+
# The regular expression that describes the MIME type str.
|
29
|
+
# If None, the MIME type is dynamic. Subclass could override.
|
30
|
+
MIME_PREFIX = None
|
31
31
|
|
32
32
|
uri: Annotated[str | None, 'The URI for locating the MIME data. '] = None
|
33
33
|
|
@@ -35,6 +35,16 @@ class MimeType(lf.Modality):
|
|
35
35
|
Union[str, bytes, None], 'The raw content of the MIME type.'
|
36
36
|
] = None
|
37
37
|
|
38
|
+
@functools.cached_property
|
39
|
+
def mime_type(self) -> str:
|
40
|
+
"""Returns the MIME type."""
|
41
|
+
mime = magic.from_buffer((self.to_bytes()), mime=True)
|
42
|
+
if self.MIME_PREFIX and not mime.lower().startswith(self.MIME_PREFIX):
|
43
|
+
raise ValueError(
|
44
|
+
f'Expected MIME type: {self.MIME_PREFIX}, Encountered: {mime}'
|
45
|
+
)
|
46
|
+
return mime
|
47
|
+
|
38
48
|
def _on_bound(self):
|
39
49
|
super()._on_bound()
|
40
50
|
if self.uri is None and self.content is None:
|
@@ -68,20 +78,25 @@ class MimeType(lf.Modality):
|
|
68
78
|
def from_bytes(cls, content: bytes | str, **kwargs) -> 'MimeType':
|
69
79
|
return cls(content=content, **kwargs)
|
70
80
|
|
81
|
+
def _repr_html_(self) -> str:
|
82
|
+
if self.uri and self.uri.lower().startswith(('http:', 'https:', 'ftp:')):
|
83
|
+
uri = self.uri
|
84
|
+
else:
|
85
|
+
uri = self.content_uri
|
86
|
+
return self._html(uri)
|
87
|
+
|
88
|
+
def _html(self, uri) -> str:
|
89
|
+
return f'<embed type="{self.mime_type}" src="{uri}"/>'
|
90
|
+
|
71
91
|
|
72
|
-
@pg.use_init_args(['
|
92
|
+
@pg.use_init_args(['mime', 'content', 'uri'])
|
73
93
|
class Custom(MimeType):
|
74
94
|
"""Custom MIME data."""
|
75
95
|
|
76
|
-
|
96
|
+
mime: Annotated[
|
77
97
|
str, 'The MIME type of the data. E.g. text/plain, or image/png. '
|
78
98
|
]
|
79
99
|
|
80
100
|
@property
|
81
101
|
def mime_type(self) -> str:
|
82
|
-
return self.
|
83
|
-
|
84
|
-
|
85
|
-
class PDF(Custom):
|
86
|
-
"""PDF document."""
|
87
|
-
type = 'application/pdf'
|
102
|
+
return self.mime
|
@@ -42,13 +42,13 @@ class CustomMimeTest(unittest.TestCase):
|
|
42
42
|
mime.Custom('text/plain')
|
43
43
|
|
44
44
|
def test_from_uri(self):
|
45
|
-
content = mime.Custom.from_uri('http://mock/web/a.txt',
|
45
|
+
content = mime.Custom.from_uri('http://mock/web/a.txt', mime='text/plain')
|
46
46
|
with mock.patch('requests.get') as mock_requests_stub:
|
47
47
|
mock_requests_stub.side_effect = mock_request
|
48
48
|
self.assertEqual(content.to_bytes(), 'foo')
|
49
49
|
self.assertEqual(content.mime_type, 'text/plain')
|
50
50
|
|
51
|
-
content = mime.Custom.from_uri('a.txt',
|
51
|
+
content = mime.Custom.from_uri('a.txt', mime='text/plain')
|
52
52
|
with mock.patch('pyglove.io.readfile') as mock_readfile_stub:
|
53
53
|
mock_readfile_stub.side_effect = mock_readfile
|
54
54
|
self.assertEqual(content.to_bytes(), 'bar')
|
@@ -0,0 +1,22 @@
|
|
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
|
+
"""PDF modality."""
|
15
|
+
|
16
|
+
from langfun.core.modalities import mime
|
17
|
+
|
18
|
+
|
19
|
+
class PDF(mime.MimeType):
|
20
|
+
"""PDF document."""
|
21
|
+
|
22
|
+
MIME_PREFIX = 'application/pdf'
|
@@ -0,0 +1,57 @@
|
|
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
|
+
"""PDF tests."""
|
15
|
+
|
16
|
+
import unittest
|
17
|
+
from langfun.core.modalities import pdf as pdf_lib
|
18
|
+
|
19
|
+
|
20
|
+
pdf_bytes = (
|
21
|
+
b'%PDF-1.1\n%\xc2\xa5\xc2\xb1\xc3\xab\n\n1 0 obj\n'
|
22
|
+
b'<< /Type /Catalog\n /Pages 2 0 R\n >>\nendobj\n\n2 0 obj\n '
|
23
|
+
b'<< /Type /Pages\n /Kids [3 0 R]\n '
|
24
|
+
b'/Count 1\n /MediaBox [0 0 300 144]\n '
|
25
|
+
b'>>\nendobj\n\n3 0 obj\n '
|
26
|
+
b'<< /Type /Page\n /Parent 2 0 R\n /Resources\n '
|
27
|
+
b'<< /Font\n'
|
28
|
+
b'<< /F1\n'
|
29
|
+
b'<< /Type /Font\n'
|
30
|
+
b'/Subtype /Type1\n'
|
31
|
+
b'/BaseFont /Times-Roman\n'
|
32
|
+
b'>>\n>>\n>>\n '
|
33
|
+
b'/Contents 4 0 R\n >>\nendobj\n\n4 0 obj\n '
|
34
|
+
b'<< /Length 55 >>\nstream\n BT\n /F1 18 Tf\n 0 0 Td\n '
|
35
|
+
b'(Hello World) Tj\n ET\nendstream\nendobj\n\nxref\n0 5\n0000000000 '
|
36
|
+
b'65535 f \n0000000018 00000 n \n0000000077 00000 n \n0000000178 00000 n '
|
37
|
+
b'\n0000000457 00000 n \ntrailer\n << /Root 1 0 R\n /Size 5\n '
|
38
|
+
b'>>\nstartxref\n565\n%%EOF\n'
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
class PdfTest(unittest.TestCase):
|
43
|
+
|
44
|
+
def test_pdf(self):
|
45
|
+
pdf = pdf_lib.PDF.from_bytes(pdf_bytes)
|
46
|
+
self.assertEqual(pdf.mime_type, 'application/pdf')
|
47
|
+
|
48
|
+
def test_repr_html(self):
|
49
|
+
pdf = pdf_lib.PDF.from_bytes(pdf_bytes)
|
50
|
+
self.assertIn(
|
51
|
+
'<embed type="application/pdf" src="data:application/pdf;base64,',
|
52
|
+
pdf._repr_html_()
|
53
|
+
)
|
54
|
+
|
55
|
+
|
56
|
+
if __name__ == '__main__':
|
57
|
+
unittest.main()
|
langfun/core/modalities/video.py
CHANGED
@@ -13,33 +13,18 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
"""Video modality."""
|
15
15
|
|
16
|
-
|
16
|
+
import functools
|
17
17
|
from langfun.core.modalities import mime
|
18
18
|
|
19
19
|
|
20
20
|
class Video(mime.MimeType):
|
21
|
-
"""
|
21
|
+
"""Video."""
|
22
22
|
|
23
|
-
|
24
|
-
def video_format(self) -> str:
|
25
|
-
return cast(str, self.mime_type.lstrip('video/'))
|
26
|
-
|
27
|
-
@property
|
28
|
-
def mime_type(self) -> str:
|
29
|
-
# TODO(daiyip): after cl/619658455, LaunchPad binaries cannot import `magic`
|
30
|
-
# correctly. This is to mitigate the issue for major Langfun users who do
|
31
|
-
# not use Video. We shall move this import out once the issue is fixed.
|
32
|
-
import magic # pylint: disable=g-import-not-at-top
|
23
|
+
MIME_PREFIX = 'video'
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return video_mime_type
|
25
|
+
@functools.cached_property
|
26
|
+
def video_format(self) -> str:
|
27
|
+
return self.mime_type.removeprefix(self.MIME_PREFIX + '/')
|
38
28
|
|
39
|
-
def
|
40
|
-
|
41
|
-
return f'<video controls> <source src="{self.uri}"> </video>'
|
42
|
-
return (
|
43
|
-
'<video controls> <source'
|
44
|
-
f' src="data:video/{self.content_uri}"> </video>'
|
45
|
-
)
|
29
|
+
def _html(self, uri: str) -> str:
|
30
|
+
return f'<video controls> <source src="{uri}"> </video>'
|
@@ -43,7 +43,7 @@ class VideoContentTest(unittest.TestCase):
|
|
43
43
|
|
44
44
|
def test_bad_video(self):
|
45
45
|
video = video_lib.Video.from_bytes(b'bad')
|
46
|
-
with self.assertRaisesRegex(ValueError, '
|
46
|
+
with self.assertRaisesRegex(ValueError, 'Expected MIME type'):
|
47
47
|
_ = video.video_format
|
48
48
|
|
49
49
|
|
@@ -262,7 +262,7 @@ def class_dependencies(
|
|
262
262
|
_fill_dependencies(elem.value, include_subclasses)
|
263
263
|
elif isinstance(vs, pg.typing.Dict) and vs.schema:
|
264
264
|
for v in vs.schema.values():
|
265
|
-
_fill_dependencies(v, include_subclasses)
|
265
|
+
_fill_dependencies(v.value, include_subclasses)
|
266
266
|
elif isinstance(vs, pg.typing.Union):
|
267
267
|
for v in vs.candidates:
|
268
268
|
_fill_dependencies(v, include_subclasses)
|
@@ -508,6 +508,9 @@ def annotation(
|
|
508
508
|
x = '{' + kv_str + '}'
|
509
509
|
if strict:
|
510
510
|
x = f'pg.typing.Dict({x})'
|
511
|
+
elif vs.schema and vs.schema.dynamic_field:
|
512
|
+
v = annotation(vs.schema.dynamic_field.value, strict=strict)
|
513
|
+
x = f'dict[str, {v}]'
|
511
514
|
else:
|
512
515
|
x = 'dict[str, Any]'
|
513
516
|
|
@@ -260,15 +260,18 @@ class ClassDependenciesTest(unittest.TestCase):
|
|
260
260
|
class A(pg.Object):
|
261
261
|
foo: tuple[Foo, int]
|
262
262
|
|
263
|
+
class B(pg.Object):
|
264
|
+
pass
|
265
|
+
|
263
266
|
class X(pg.Object):
|
264
|
-
k:
|
267
|
+
k: dict[str, B]
|
265
268
|
|
266
|
-
class
|
269
|
+
class C(A):
|
267
270
|
bar: Bar
|
268
271
|
foo2: Foo | X
|
269
272
|
|
270
273
|
a = A(foo=(Foo(1), 0))
|
271
|
-
self.assertEqual(schema_lib.class_dependencies(a), [Foo, A, Bar, X,
|
274
|
+
self.assertEqual(schema_lib.class_dependencies(a), [Foo, A, Bar, B, X, C])
|
272
275
|
|
273
276
|
self.assertEqual(schema_lib.class_dependencies(1), [])
|
274
277
|
|
@@ -395,6 +398,15 @@ class SchemaPythonReprTest(unittest.TestCase):
|
|
395
398
|
'dict[str, Any]',
|
396
399
|
strict=False,
|
397
400
|
)
|
401
|
+
|
402
|
+
class DictValue(pg.Object):
|
403
|
+
pass
|
404
|
+
|
405
|
+
self.assert_annotation(
|
406
|
+
pg.typing.Dict([(pg.typing.StrKey(), DictValue)]),
|
407
|
+
'dict[str, DictValue]',
|
408
|
+
strict=False,
|
409
|
+
)
|
398
410
|
self.assert_annotation(
|
399
411
|
pg.typing.Dict(),
|
400
412
|
'dict[str, Any]',
|
@@ -48,12 +48,12 @@ langfun/core/eval/patching.py,sha256=R0s2eAd1m97exQt06dmUL0V_MBG0W2Hxg7fhNB7cXW0
|
|
48
48
|
langfun/core/eval/patching_test.py,sha256=8kCd54Egjju22FMgtJuxEsrXkW8ifs-UUBHtrCG1L6w,4775
|
49
49
|
langfun/core/eval/scoring.py,sha256=1J7IATo-8FXUR0SBqk9icztHiM0lWkBFcWUo-vUURgQ,6376
|
50
50
|
langfun/core/eval/scoring_test.py,sha256=O8olHbrUEg60gMxwOkWzKBJZpZoUlmVnBANX5Se2SXM,4546
|
51
|
-
langfun/core/llms/__init__.py,sha256=
|
51
|
+
langfun/core/llms/__init__.py,sha256=XHK_ZpfEppCF-ixfpIvmrOvH2P6XgkjMhS7zBa8yYk4,4302
|
52
52
|
langfun/core/llms/anthropic.py,sha256=7W9YdPN3SlAFhAIQlihMkrpo7tTY_4NvD0KIlCrqcsk,8505
|
53
53
|
langfun/core/llms/anthropic_test.py,sha256=TMM30myyEhwF99Le4RvJEXOn8RYl0q1FRkt9Q9nl1jk,5540
|
54
54
|
langfun/core/llms/fake.py,sha256=Dd7-6ka9pFf3fcWZyczamjOqQ91MOI-m7We3Oc9Ffmo,2927
|
55
55
|
langfun/core/llms/fake_test.py,sha256=ipKfdOcuqVcJ8lDXVpnBVb9HHG0hAVkFkMoHpWjC2cI,7212
|
56
|
-
langfun/core/llms/google_genai.py,sha256=
|
56
|
+
langfun/core/llms/google_genai.py,sha256=H1GdarpoMb9RjQz7a4BqVF6loQf3S_mMv8G8TFYrCvw,8999
|
57
57
|
langfun/core/llms/google_genai_test.py,sha256=_UcGTfl16-aDUlEWFC2W2F8y9jPUs53RBYA6MOCpGXw,7525
|
58
58
|
langfun/core/llms/groq.py,sha256=NaGItVL_pkOpqPpI4bPGU27xLFRoaeizZ49v2s-4ERs,7844
|
59
59
|
langfun/core/llms/groq_test.py,sha256=M6GtlrsOvDun_j-sR8cPh4W_moHWZNSTiThu3kuwbbc,5281
|
@@ -61,8 +61,8 @@ langfun/core/llms/llama_cpp.py,sha256=Y_KkMUf3Xfac49koMUtUslKl3h-HWp3-ntq7Jaa3bd
|
|
61
61
|
langfun/core/llms/llama_cpp_test.py,sha256=ZxC6defGd_HX9SFRU9U4cJiQnBKundbOrchbXuC1Z2M,1683
|
62
62
|
langfun/core/llms/openai.py,sha256=IN46gIqfY6aEEfxCPNmyH1hrep3oWBhJDwVFilfqNkM,13657
|
63
63
|
langfun/core/llms/openai_test.py,sha256=asSA1sVy_7hnXioD_2HTxtSDpVTKBUO_EjZuyHpwbn0,14854
|
64
|
-
langfun/core/llms/vertexai.py,sha256=
|
65
|
-
langfun/core/llms/vertexai_test.py,sha256=
|
64
|
+
langfun/core/llms/vertexai.py,sha256=rrwHRtox-gayVBjrkR_lnko98b0iFIyxsRUPgB_09T8,9921
|
65
|
+
langfun/core/llms/vertexai_test.py,sha256=fInoOf3d2fKqF0qmb3u_9d5sZz-LK2At8M64pmpHR7s,7641
|
66
66
|
langfun/core/llms/cache/__init__.py,sha256=QAo3InUMDM_YpteNnVCSejI4zOsnjSMWKJKzkb3VY64,993
|
67
67
|
langfun/core/llms/cache/base.py,sha256=cFfYvOIUae842pncqCAsRvqXCk2AnAsRYVx0mcIoAeY,3338
|
68
68
|
langfun/core/llms/cache/in_memory.py,sha256=YfFyJEhLs73cUiB0ZfhMxYpdE8Iuxxw-dvMFwGHTSHw,4742
|
@@ -70,13 +70,15 @@ langfun/core/llms/cache/in_memory_test.py,sha256=D-n26h__rVXQO51WRFhRfq5sw1oifRL
|
|
70
70
|
langfun/core/memories/__init__.py,sha256=HpghfZ-w1NQqzJXBx8Lz0daRhB2rcy2r9Xm491SBhC4,773
|
71
71
|
langfun/core/memories/conversation_history.py,sha256=c9amD8hCxGFiZuVAzkP0dOMWSp8L90uvwkOejjuBqO0,1835
|
72
72
|
langfun/core/memories/conversation_history_test.py,sha256=AaW8aNoFjxNusanwJDV0r3384Mg0eAweGmPx5DIkM0Y,2052
|
73
|
-
langfun/core/modalities/__init__.py,sha256=
|
74
|
-
langfun/core/modalities/image.py,sha256=
|
75
|
-
langfun/core/modalities/image_test.py,sha256=
|
76
|
-
langfun/core/modalities/mime.py,sha256=
|
77
|
-
langfun/core/modalities/mime_test.py,sha256=
|
78
|
-
langfun/core/modalities/
|
79
|
-
langfun/core/modalities/
|
73
|
+
langfun/core/modalities/__init__.py,sha256=ye5Aw-2d1LLO7a37gjJ3KAgrMINdXRqigCGIX04yQgM,1072
|
74
|
+
langfun/core/modalities/image.py,sha256=hRapD4jTdzzQ23zz44K1HMaDpzXVEhrDNKgTXs7cy7k,930
|
75
|
+
langfun/core/modalities/image_test.py,sha256=zyx1eyAdcWK3iwk4q4zgPPmkvKOH-1Los3orgQE9aqk,2295
|
76
|
+
langfun/core/modalities/mime.py,sha256=W-rsMyCNeVdurEmnX2aogRrlsM4aCZ6hlXK1kTCoGQE,3056
|
77
|
+
langfun/core/modalities/mime_test.py,sha256=pN6EHCf9qKMTZaVtQS7M8HWJcH68B3htiWvbq_tLh5I,1881
|
78
|
+
langfun/core/modalities/pdf.py,sha256=A-lVHiXdELpbciedSVyhIgQVi1kI1QlE-YBjJFFh3oU,731
|
79
|
+
langfun/core/modalities/pdf_test.py,sha256=KE40zJD3Whe6ty2OULkp1J8jwLmB4ZjGXlGekluTP48,1952
|
80
|
+
langfun/core/modalities/video.py,sha256=6qADCwwv-pEtzxMs_1YvhWgX6NqTsjviQv6IZxQPDTY,959
|
81
|
+
langfun/core/modalities/video_test.py,sha256=GbsoefSeO7y8kCYhTtp4s9E3ah_eYrb6Z-MXpS01RFc,2046
|
80
82
|
langfun/core/structured/__init__.py,sha256=Qg1ocwsb60od8fJky3F3JAOhwjwT9WA7IX3C2j2s3zA,3707
|
81
83
|
langfun/core/structured/completion.py,sha256=skBxt6V_fv2TBUKnzFgnPMbVY8HSYn8sY04MLok2yvs,7299
|
82
84
|
langfun/core/structured/completion_test.py,sha256=MYxEzeScC3gFVujvrMMboBF5nh-QiVLwGgqAV3oaFUQ,19273
|
@@ -90,10 +92,10 @@ langfun/core/structured/parsing.py,sha256=keoVqEfzAbdULh6GawWFsTQzU91MzJXYFZjXGX
|
|
90
92
|
langfun/core/structured/parsing_test.py,sha256=34wDrXaQ-EYhJLfDL8mX9K53oQMSzh5pVYdKjnESmK8,20895
|
91
93
|
langfun/core/structured/prompting.py,sha256=cswl9c93edsYnXsZQmMzPpmqOuKnBzbgebTYBbSxwzo,8815
|
92
94
|
langfun/core/structured/prompting_test.py,sha256=rddf5qHN8Gm_JaNMmytwiVEBm-eZVJFLQO4GljUgR44,21700
|
93
|
-
langfun/core/structured/schema.py,sha256=
|
95
|
+
langfun/core/structured/schema.py,sha256=HDb6N7zB4z83kUYW4-ic84QgIHKpR4LZCivMeALDBVo,25967
|
94
96
|
langfun/core/structured/schema_generation.py,sha256=U3nRQsqmMZg_qIVDh2fiY3K4JLfsAL1LcKzIFP1iXFg,5316
|
95
97
|
langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
|
96
|
-
langfun/core/structured/schema_test.py,sha256=
|
98
|
+
langfun/core/structured/schema_test.py,sha256=S32-fo8HblYAiGoy7zsmQrbO_P-dypaYVsH7RNPLOog,23318
|
97
99
|
langfun/core/structured/scoring.py,sha256=QyT1S8FkLtKICfUbh4AXoKK3YJ_rgejyk6TI2OtOa68,2751
|
98
100
|
langfun/core/structured/scoring_test.py,sha256=39_dw6p_FkoqeUccO67yIqos-MccAWezoozS21i8mi0,1732
|
99
101
|
langfun/core/templates/__init__.py,sha256=bO0eMsVJbi7sxEB2YlInKRQ2EVP-RyyKUwcD-8msuN4,927
|
@@ -105,8 +107,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
|
|
105
107
|
langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
|
106
108
|
langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
|
107
109
|
langfun/core/templates/selfplay_test.py,sha256=DYVrkk7uNKCqJGEHH31HssU2BPuMItU1vJLzfcXIlYg,2156
|
108
|
-
langfun-0.0.2.
|
109
|
-
langfun-0.0.2.
|
110
|
-
langfun-0.0.2.
|
111
|
-
langfun-0.0.2.
|
112
|
-
langfun-0.0.2.
|
110
|
+
langfun-0.0.2.dev20240524.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
111
|
+
langfun-0.0.2.dev20240524.dist-info/METADATA,sha256=xwXkgmeZLe6kV5deS-2cLOwpo_pwn0JyABXLdBEvDV8,3452
|
112
|
+
langfun-0.0.2.dev20240524.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
113
|
+
langfun-0.0.2.dev20240524.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
|
114
|
+
langfun-0.0.2.dev20240524.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|