langfun 0.1.2.dev202502080803__py3-none-any.whl → 0.1.2.dev202502100804__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.
@@ -579,7 +579,7 @@ class QueryInvocation(pg.Object, pg.views.HtmlTreeView.Extension):
579
579
 
580
580
  @functools.cached_property
581
581
  def lm_request(self) -> lf.Message:
582
- return query_prompt(self.input, self.schema)
582
+ return query_prompt(self.input, self.schema, examples=self.examples or None)
583
583
 
584
584
  @functools.cached_property
585
585
  def output(self) -> Any:
@@ -1081,9 +1081,12 @@ class TrackQueriesTest(unittest.TestCase):
1081
1081
  with querying.track_queries() as queries:
1082
1082
  querying.query('foo', lm=lm)
1083
1083
  with querying.track_queries() as child_queries:
1084
- querying.query('give me an activity', Activity, lm=lm)
1084
+ querying.query('give me an activity', Activity, lm=lm, examples=[
1085
+ mapping.MappingExample(input='2 + 2', schema=int, output=4)
1086
+ ])
1085
1087
 
1086
1088
  self.assertEqual(len(queries), 2)
1089
+ self.assertEqual(queries[0].lm_response, 'bar')
1087
1090
  self.assertTrue(pg.eq(queries[0].input, lf.Template('foo')))
1088
1091
  self.assertIsNone(queries[0].schema)
1089
1092
  self.assertEqual(queries[0].output, 'bar')
@@ -1091,7 +1094,11 @@ class TrackQueriesTest(unittest.TestCase):
1091
1094
 
1092
1095
  self.assertTrue(pg.eq(queries[1].input, lf.Template('give me an activity')))
1093
1096
  self.assertEqual(queries[1].schema.spec.cls, Activity)
1097
+ self.assertIn('2 + 2', queries[1].lm_request.text)
1094
1098
  self.assertTrue(pg.eq(queries[1].output, Activity(description='hi')))
1099
+ self.assertTrue(pg.eq(queries[1].examples, [
1100
+ mapping.MappingExample(input='2 + 2', schema=int, output=4)
1101
+ ]))
1095
1102
  self.assertIs(queries[1].lm, lm)
1096
1103
  self.assertGreater(queries[0].elapse, 0)
1097
1104
  self.assertGreater(queries[0].usage_summary.total.total_tokens, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langfun
3
- Version: 0.1.2.dev202502080803
3
+ Version: 0.1.2.dev202502100804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -129,8 +129,8 @@ langfun/core/structured/mapping.py,sha256=of-EeBq0RgmkiUaSk2rVEDVCzgn_wXU8tRke7N
129
129
  langfun/core/structured/mapping_test.py,sha256=OntYvfDitAf0tAnzQty3YS90vyEn6FY1Mi93r_ViEk8,9594
130
130
  langfun/core/structured/parsing.py,sha256=MGvI7ypXlwfzr5XB8_TFU9Ei0_5reYqkWkv64eAy0EA,12015
131
131
  langfun/core/structured/parsing_test.py,sha256=kNPrhpdPY3iWhUld0TFYU-Zgn44wC0d6YuQ9XdVbQ8o,22346
132
- langfun/core/structured/querying.py,sha256=nqvsfMS_KLv5EvO0_VAGEHwY4pHy4S0CvJmeV0HBXlM,23066
133
- langfun/core/structured/querying_test.py,sha256=YlC4s9LVChfhGZzaXGW1UYlcBnAjNOunu4SLl5_p7PQ,32054
132
+ langfun/core/structured/querying.py,sha256=RgYsiiOu-a-mE87iDVJBrbkrfnCPXvoc6auIA8OrupQ,23098
133
+ langfun/core/structured/querying_test.py,sha256=1l0032afpSC_ewBNOp17bKK11fHlxlE9A2eJumsz_CE,32380
134
134
  langfun/core/structured/schema.py,sha256=_iqhHEGDQsHk0AsybWnK44sOspTWkKJjci781PWD7x0,27988
135
135
  langfun/core/structured/schema_generation.py,sha256=3AcuKvv3VOtKY5zMVqODrxfOuDxzoZtGeBxHlOWDOWw,5308
136
136
  langfun/core/structured/schema_generation_test.py,sha256=RM9s71kMNg2jTePwInkiW9fK1ACN37eyPeF8OII-0zw,2950
@@ -148,8 +148,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
148
148
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
149
149
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
150
150
  langfun/core/templates/selfplay_test.py,sha256=Ot__1P1M8oJfoTp-M9-PQ6HUXqZKyMwvZ5f7yQ3yfyM,2326
151
- langfun-0.1.2.dev202502080803.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
152
- langfun-0.1.2.dev202502080803.dist-info/METADATA,sha256=HwxvNwOrL6oliIMpZ9vm2dAU8E7BY5FGU6-8JpOmbkg,8172
153
- langfun-0.1.2.dev202502080803.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
154
- langfun-0.1.2.dev202502080803.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
155
- langfun-0.1.2.dev202502080803.dist-info/RECORD,,
151
+ langfun-0.1.2.dev202502100804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
152
+ langfun-0.1.2.dev202502100804.dist-info/METADATA,sha256=j1-_QWWv17zKz4eGuqDiQrlbOdLv_X6jo2YZneQ9v60,8172
153
+ langfun-0.1.2.dev202502100804.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
154
+ langfun-0.1.2.dev202502100804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
155
+ langfun-0.1.2.dev202502100804.dist-info/RECORD,,