Skip to content

Commit

Permalink
Support corrrection
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Aug 30, 2024
1 parent a74e072 commit b9d493d
Show file tree
Hide file tree
Showing 3 changed files with 1,152 additions and 1,239 deletions.
30 changes: 18 additions & 12 deletions langserve/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,12 @@ def _rename_pydantic_model(model: Type[BaseModel], prefix: str) -> Type[BaseMode
__config__=model.__config__,
**{
fieldname: (
_rename_pydantic_model(field.annotation, prefix)
if isclass(field.annotation) and issubclass(field.annotation, BaseModel)
else field.annotation,
(
_rename_pydantic_model(field.annotation, prefix)
if isclass(field.annotation)
and issubclass(field.annotation, BaseModel)
else field.annotation
),
Field(
field.default,
title=fieldname,
Expand Down Expand Up @@ -849,15 +852,17 @@ async def invoke(
callback_events=callback_events,
metadata=InvokeResponseMetadata(
run_id=run_id,
feedback_tokens=[
FeedbackToken(
key=feedback_key,
token_url=feedback_token.url,
expires_at=feedback_token.expires_at.isoformat(),
)
]
if feedback_token
else [],
feedback_tokens=(
[
FeedbackToken(
key=feedback_key,
token_url=feedback_token.url,
expires_at=feedback_token.expires_at.isoformat(),
)
]
if feedback_token
else []
),
),
),
)
Expand Down Expand Up @@ -1590,6 +1595,7 @@ async def create_feedback_from_token(
score=create_request.score,
value=create_request.value,
comment=create_request.comment,
correction=create_request.correction,
metadata=metadata,
)

Expand Down
Loading

0 comments on commit b9d493d

Please sign in to comment.