langfun 0.1.2.dev202503100804__py3-none-any.whl → 0.1.2.dev202503110804__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.
@@ -391,6 +391,13 @@ def query(
391
391
  if pg.MISSING_VALUE != prompt and not skip_lm:
392
392
  trackers = lf.context_value('__query_trackers__', [])
393
393
  if trackers:
394
+ # To minimize payload for serialization, we remove the result and usage
395
+ # fields from the metadata. They will be computed on the fly when the
396
+ # invocation is rendered.
397
+ metadata = dict(output_message.metadata)
398
+ metadata.pop('result', None)
399
+ metadata.pop('usage', None)
400
+
394
401
  invocation = QueryInvocation(
395
402
  input=pg.Ref(query_input),
396
403
  schema=(
@@ -399,7 +406,7 @@ def query(
399
406
  ),
400
407
  lm=pg.Ref(lm),
401
408
  examples=pg.Ref(examples) if examples else [],
402
- lm_response=lf.AIMessage(output_message.text),
409
+ lm_response=lf.AIMessage(output_message.text, metadata=metadata),
403
410
  usage_summary=usage_summary,
404
411
  start_time=start_time,
405
412
  end_time=end_time,
@@ -1069,6 +1069,8 @@ class QueryInvocationTest(unittest.TestCase):
1069
1069
  querying.query('foo', Activity, lm=lm)
1070
1070
 
1071
1071
  self.assertIn('schema', queries[0].to_html_str())
1072
+ self.assertEqual(queries[0].lm_response.score, 1.0)
1073
+ self.assertFalse(queries[0].lm_response.is_cached)
1072
1074
 
1073
1075
 
1074
1076
  class TrackQueriesTest(unittest.TestCase):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langfun
3
- Version: 0.1.2.dev202503100804
3
+ Version: 0.1.2.dev202503110804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -131,8 +131,8 @@ langfun/core/structured/mapping.py,sha256=of-EeBq0RgmkiUaSk2rVEDVCzgn_wXU8tRke7N
131
131
  langfun/core/structured/mapping_test.py,sha256=OntYvfDitAf0tAnzQty3YS90vyEn6FY1Mi93r_ViEk8,9594
132
132
  langfun/core/structured/parsing.py,sha256=MGvI7ypXlwfzr5XB8_TFU9Ei0_5reYqkWkv64eAy0EA,12015
133
133
  langfun/core/structured/parsing_test.py,sha256=kNPrhpdPY3iWhUld0TFYU-Zgn44wC0d6YuQ9XdVbQ8o,22346
134
- langfun/core/structured/querying.py,sha256=RgYsiiOu-a-mE87iDVJBrbkrfnCPXvoc6auIA8OrupQ,23098
135
- langfun/core/structured/querying_test.py,sha256=1l0032afpSC_ewBNOp17bKK11fHlxlE9A2eJumsz_CE,32380
134
+ langfun/core/structured/querying.py,sha256=Uvg64HOCzi5J-Uk3TNpkCgtKe6I02mThwjGbnRY6M7U,23420
135
+ langfun/core/structured/querying_test.py,sha256=H6LUgxaPOHqf37DCQ_PKpXUqgMc4aN211S34xpE-KcQ,32491
136
136
  langfun/core/structured/schema.py,sha256=_iqhHEGDQsHk0AsybWnK44sOspTWkKJjci781PWD7x0,27988
137
137
  langfun/core/structured/schema_generation.py,sha256=3AcuKvv3VOtKY5zMVqODrxfOuDxzoZtGeBxHlOWDOWw,5308
138
138
  langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
@@ -150,8 +150,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
150
150
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
151
151
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
152
152
  langfun/core/templates/selfplay_test.py,sha256=Ot__1P1M8oJfoTp-M9-PQ6HUXqZKyMwvZ5f7yQ3yfyM,2326
153
- langfun-0.1.2.dev202503100804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
154
- langfun-0.1.2.dev202503100804.dist-info/METADATA,sha256=3_ZHDh4WGF6EsjobrgPNTRE6rUORuyoJ1YgOsZmRNsg,8172
155
- langfun-0.1.2.dev202503100804.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
156
- langfun-0.1.2.dev202503100804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
157
- langfun-0.1.2.dev202503100804.dist-info/RECORD,,
153
+ langfun-0.1.2.dev202503110804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
154
+ langfun-0.1.2.dev202503110804.dist-info/METADATA,sha256=RAbqoIhzrV4vsEMV0kgFmA0WJPCWdnAmE--8bNuD81o,8172
155
+ langfun-0.1.2.dev202503110804.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
156
+ langfun-0.1.2.dev202503110804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
157
+ langfun-0.1.2.dev202503110804.dist-info/RECORD,,