langfun 0.1.1.dev20240730__py3-none-any.whl → 0.1.1.dev20240731__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/eval/base.py CHANGED
@@ -542,6 +542,8 @@ class Evaluable(lf.Component):
542
542
  'padding: 10px; border: 1px solid; margin-top: 10px">'
543
543
  )
544
544
  s.write(html.escape(m.get('formatted_text', m.text)))
545
+
546
+ # Write output.
545
547
  if m.result is not None:
546
548
  s.write(
547
549
  '<div style="color: magenta; white-space: pre-wrap;'
@@ -549,6 +551,23 @@ class Evaluable(lf.Component):
549
551
  )
550
552
  s.write(html.escape(pg.format(m.result)))
551
553
  s.write('</div>')
554
+
555
+ # Write modality information.
556
+ if 'lm-input' in m.tags or 'lm-response' in m.tags:
557
+ modalities = m.referred_modalities()
558
+ if modalities:
559
+ s.write(f'<div style="color: {text_color}; white-space: pre-wrap;'
560
+ 'padding: 10px; border: 1px solid; margin-top: 10px"><table>')
561
+ for name, modality in modalities.items():
562
+ s.write(f'<tr><td>{name}</td><td>')
563
+ if hasattr(modality, '_repr_html_'):
564
+ s.write(modality._repr_html_()) # pylint: disable=protected-access
565
+ else:
566
+ s.write(html.escape(pg.format(modality, max_bytes_len=32)))
567
+ s.write('</td></tr>')
568
+ s.write('</table></div>')
569
+
570
+ # Write usage information.
552
571
  if m.metadata.get('usage', None):
553
572
  s.write(
554
573
  '<div style="background-color: #EEEEEE; color: black; '
@@ -271,9 +271,9 @@ class Matching(base.Evaluation):
271
271
  for i, (example, output, message) in enumerate(self.matches):
272
272
  bgcolor = 'white' if i % 2 == 0 else '#DDDDDD'
273
273
  s.write(f'<tr style="background-color: {bgcolor}"><td>{i + 1}</td>')
274
- input_str = pg.format(example, verbose=False)
274
+ input_str = pg.format(example, verbose=False, max_bytes_len=32)
275
275
  s.write(f'<td style="color:green;white-space:pre-wrap">{input_str}</td>')
276
- output_str = pg.format(output, verbose=False)
276
+ output_str = pg.format(output, verbose=False, max_bytes_len=32)
277
277
  s.write(f'<td style="color:blue;white-space:pre-wrap">{output_str}</td>')
278
278
  s.write('<td>')
279
279
  self._render_message(message, s)
@@ -296,9 +296,9 @@ class Matching(base.Evaluation):
296
296
  for i, (example, output, message) in enumerate(self.mismatches):
297
297
  bgcolor = 'white' if i % 2 == 0 else '#DDDDDD'
298
298
  s.write(f'<tr style="background-color: {bgcolor}"><td>{i + 1}</td>')
299
- input_str = pg.format(example, verbose=False)
299
+ input_str = pg.format(example, verbose=False, max_bytes_len=32)
300
300
  s.write(f'<td style="color:green;white-space:pre-wrap">{input_str}</td>')
301
- output_str = pg.format(output, verbose=False)
301
+ output_str = pg.format(output, verbose=False, max_bytes_len=32)
302
302
  s.write(
303
303
  f'<td style="color:magenta;white-space:pre-wrap">{output_str}</td>'
304
304
  )
@@ -196,9 +196,9 @@ class Scoring(base.Evaluation):
196
196
  for i, (example, output, score, message) in enumerate(self.scored):
197
197
  bgcolor = 'white' if i % 2 == 0 else '#DDDDDD'
198
198
  s.write(f'<tr style="background-color: {bgcolor}"><td>{i + 1}</td>')
199
- input_str = pg.format(example, verbose=False)
199
+ input_str = pg.format(example, verbose=False, max_bytes_len=32)
200
200
  s.write(f'<td style="color:green;white-space:pre-wrap">{input_str}</td>')
201
- output_str = pg.format(output, verbose=False)
201
+ output_str = pg.format(output, verbose=False, max_bytes_len=32)
202
202
  s.write(f'<td style="color:blue;white-space:pre-wrap">{output_str}</td>')
203
203
  s.write(f'<td style="color:magenta;white-space:pre-wrap">{score}</td>')
204
204
  s.write('<td>')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.1.1.dev20240730
3
+ Version: 0.1.1.dev20240731
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -44,13 +44,13 @@ langfun/core/coding/python/parsing_test.py,sha256=9vAWF484kWIm6JZq8NFiMgKUDhXV-d
44
44
  langfun/core/coding/python/permissions.py,sha256=1QWGHvzL8MM0Ok_auQ9tURqZHtdOfJaDpBzZ29GUE-c,2544
45
45
  langfun/core/coding/python/permissions_test.py,sha256=w5EDb8QxpxgJyZkojyzVWQvDfg366zn99-g__6TbPQ0,2699
46
46
  langfun/core/eval/__init__.py,sha256=Evt-E4FEhZF2tXL6-byh_AyA7Cc_ZoGmvnN7vkAZedk,1898
47
- langfun/core/eval/base.py,sha256=qZNnI89xbpP_jKthGe6LmS08VWFb1MfF2J6MtoHiTJw,74429
47
+ langfun/core/eval/base.py,sha256=zZgebhUubX-149VkwkyQBKkTyv5hF0ubjj9eBd2baLo,75201
48
48
  langfun/core/eval/base_test.py,sha256=cHOTIWVW4Dp8gKKIKcZrAcJ-w84j2GIozTzJoiAX7p4,26743
49
- langfun/core/eval/matching.py,sha256=jJy5YRARPwg4xchWQWMyBIQ-GoCZzfoFpMX8NjOFTnE,9690
49
+ langfun/core/eval/matching.py,sha256=9GX8HfO9jKxgNLAivgy5K88Xhoh6Z7Pptq65pe7vht8,9762
50
50
  langfun/core/eval/matching_test.py,sha256=f7iVyXH5KGJBWt4Wp14Bt9J3X59A6Ayfog9MbuFvPew,5532
51
51
  langfun/core/eval/patching.py,sha256=R0s2eAd1m97exQt06dmUL0V_MBG0W2Hxg7fhNB7cXW0,3866
52
52
  langfun/core/eval/patching_test.py,sha256=8kCd54Egjju22FMgtJuxEsrXkW8ifs-UUBHtrCG1L6w,4775
53
- langfun/core/eval/scoring.py,sha256=sDb0MuwEtkbAZOGzZ-gxtLdFtzWBHh-Kl8qGmKlWdNo,6350
53
+ langfun/core/eval/scoring.py,sha256=AlCwEVrU6nvURDB1aPxA2XBUmOjWxuNJDXJoS4-6VbU,6386
54
54
  langfun/core/eval/scoring_test.py,sha256=O8olHbrUEg60gMxwOkWzKBJZpZoUlmVnBANX5Se2SXM,4546
55
55
  langfun/core/llms/__init__.py,sha256=sRD_PjfD5wKuzANCOCjChjuZHUn2Q1WruZeVflqej5M,4609
56
56
  langfun/core/llms/anthropic.py,sha256=Gon3fOi31RhZFgNd0ijyTnKnUdp9hrWrCoSXyO4UaLw,7316
@@ -117,8 +117,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
117
117
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
118
118
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
119
119
  langfun/core/templates/selfplay_test.py,sha256=rBW2Qr8yi-aWYwoTwRR-n1peKyMX9QXPZXURjLgoiRs,2264
120
- langfun-0.1.1.dev20240730.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
121
- langfun-0.1.1.dev20240730.dist-info/METADATA,sha256=g9OiRFzhLhJmZNWlBX0oRQOTvMXVUHXW0yCkhXpARDE,5247
122
- langfun-0.1.1.dev20240730.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
123
- langfun-0.1.1.dev20240730.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
124
- langfun-0.1.1.dev20240730.dist-info/RECORD,,
120
+ langfun-0.1.1.dev20240731.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
121
+ langfun-0.1.1.dev20240731.dist-info/METADATA,sha256=WNoqA9YDPgBC2gIdUYCBcr2TPA7BBfs1DY4EI1WSy3I,5247
122
+ langfun-0.1.1.dev20240731.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
123
+ langfun-0.1.1.dev20240731.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
124
+ langfun-0.1.1.dev20240731.dist-info/RECORD,,