langfun 0.0.2.dev20240716__py3-none-any.whl → 0.0.2.dev20240717__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.
@@ -76,14 +76,19 @@ def score(
76
76
  raise ValueError('`lm` must be specified or provided from `lf.context`.')
77
77
  lm = lm_override.value
78
78
 
79
+ completion_reprs = []
80
+ for c in completions:
81
+ if isinstance(c, mapping.MappingError):
82
+ rep = c.lm_response
83
+ else:
84
+ rep = mapping.MappingExample.value_repr(
85
+ c, protocol=protocol, compact=False, verbose=False
86
+ )
87
+ completion_reprs.append(rep)
88
+
79
89
  results = lm.score(
80
90
  input_message,
81
- [
82
- mapping.MappingExample.value_repr(
83
- c, protocol=protocol, compact=False, verbose=False
84
- )
85
- for c in completions
86
- ],
91
+ completion_reprs,
87
92
  )
88
93
  if return_scoring_results:
89
94
  return results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.0.2.dev20240716
3
+ Version: 0.0.2.dev20240717
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -106,7 +106,7 @@ langfun/core/structured/schema.py,sha256=oiT4P4Q9pG-QOnFzxETN2EQZqNln8nG4zAJHxcm
106
106
  langfun/core/structured/schema_generation.py,sha256=U3nRQsqmMZg_qIVDh2fiY3K4JLfsAL1LcKzIFP1iXFg,5316
107
107
  langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
108
108
  langfun/core/structured/schema_test.py,sha256=RjYhwTgktQgyqAjzLvo967nTiIK9KWgP-aNGg4e7ihE,25258
109
- langfun/core/structured/scoring.py,sha256=QyT1S8FkLtKICfUbh4AXoKK3YJ_rgejyk6TI2OtOa68,2751
109
+ langfun/core/structured/scoring.py,sha256=pE2ilZC7cV1qlPZANOFIFVbNB7IixSTLcnmf9pRU3tc,2883
110
110
  langfun/core/structured/scoring_test.py,sha256=39_dw6p_FkoqeUccO67yIqos-MccAWezoozS21i8mi0,1732
111
111
  langfun/core/templates/__init__.py,sha256=bO0eMsVJbi7sxEB2YlInKRQ2EVP-RyyKUwcD-8msuN4,927
112
112
  langfun/core/templates/completion.py,sha256=mUqZHOEV3ag6-A08XghpeEltcrBvCDxXP004eDDfeag,1931
@@ -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.0.2.dev20240716.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
121
- langfun-0.0.2.dev20240716.dist-info/METADATA,sha256=F_tZpKtsy804vC7T4BS7SFmOOS-31MGs_kY0UaZN2Ag,3550
122
- langfun-0.0.2.dev20240716.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
123
- langfun-0.0.2.dev20240716.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
124
- langfun-0.0.2.dev20240716.dist-info/RECORD,,
120
+ langfun-0.0.2.dev20240717.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
121
+ langfun-0.0.2.dev20240717.dist-info/METADATA,sha256=Ho6QyM-oWmPyKZ5Q5S6Zh7gh1R00X_cyS-0ChbUCzRU,3550
122
+ langfun-0.0.2.dev20240717.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
123
+ langfun-0.0.2.dev20240717.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
124
+ langfun-0.0.2.dev20240717.dist-info/RECORD,,