Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable field docstr for lf.complete. #32

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion langfun/core/structured/completion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ class Activity(pg.Object):

class Itinerary(pg.Object):
day: pg.typing.Int[1, None]
type: pg.typing.Enum['daytime', 'nighttime']
type: pg.typing.Annotated[
pg.typing.Enum['daytime', 'nighttime'],
'Type of itinerary.'
]
activities: list[Activity]
hotel: pg.typing.Str['.*Hotel'] | None

Expand Down Expand Up @@ -73,18 +76,21 @@ def test_render_no_examples(self):
itineraries=[
Itinerary(
day=1,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
),
Itinerary(
day=2,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
),
Itinerary(
day=3,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
Expand Down Expand Up @@ -134,6 +140,7 @@ def test_render_no_class_definitions(self):
itineraries=[
Itinerary(
day=1,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=[
Activity(
Expand All @@ -144,6 +151,7 @@ def test_render_no_class_definitions(self):
),
Itinerary(
day=2,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=[
Activity(
Expand All @@ -154,6 +162,7 @@ def test_render_no_class_definitions(self):
),
Itinerary(
day=3,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=[
Activity(
Expand Down Expand Up @@ -238,18 +247,21 @@ class _Date:
itineraries=[
Itinerary(
day=1,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
),
Itinerary(
day=2,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
),
Itinerary(
day=3,
# Type of itinerary.
type=MISSING(Literal['daytime', 'nighttime']),
activities=MISSING(list[Activity]),
hotel=None
Expand Down
3 changes: 2 additions & 1 deletion langfun/core/structured/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ def input_value(self) -> Any:
return schema_lib.mark_missing(self.message.result)

def value_str(self, value: Any) -> str:
return schema_lib.value_repr('python').repr(value, compact=False)
return schema_lib.value_repr('python').repr(
value, compact=False, verbose=True)

def missing_type_dependencies(self, value: Any) -> list[Type[Any]]:
value_specs = tuple(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jinja2>=3.1.2
openai==0.27.2
pyglove>=0.4.4.dev20230926
pyglove>=0.4.4.dev20231006
termcolor==1.1.0
tqdm>=4.64.1
Loading