Skip to content

Commit

Permalink
Docstring
Browse files Browse the repository at this point in the history
Signed-off-by: dbczumar <corey.zumar@databricks.com>
  • Loading branch information
dbczumar committed Oct 10, 2024
1 parent 1cf8daa commit 8a8f800
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion dspy/adapters/chat_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,22 @@ def parse_value(value, annotation):
return TypeAdapter(annotation).validate_python(parsed_value)


def format_turn(signature: SignatureMeta, values: Dict[str, Any], role, incomplete=False):
def format_turn(signature: SignatureMeta, values: Dict[str, Any], role, incomplete=False) -> Dict[str, str]:
"""
Constructs a new message ("turn") to append to a chat thread. The message is carefully formatted
so that it can instruct an LLM to generate responses conforming to the specified DSPy signature.
Args:
signature: The DSPy signature to which future LLM responses should conform.
values: A dictionary of field names (from the DSPy signature) to corresponding values that
should be included in the message.
role: The role of the message, which can be either "user" or "assistant".
incomplete: If True, indicates that output field values are present in the set of specified
``values``. If False, indicates that ``values`` only contains input field values.
Returns:
A chat message that can be appended to a chat thread. The message contains two string fields:
``role`` ("user" or "assistant") and ``content`` (containing the message itself).
"""
content = []

if role == "user":
Expand Down

0 comments on commit 8a8f800

Please sign in to comment.