Skip to content

Commit

Permalink
Compresses message metadata (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
markwaddle authored Oct 25, 2024
1 parent b856040 commit ea57c01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libraries/python/openai-client/openai_client/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

def truncate_messages_for_logging(
messages: list[ChatCompletionMessageParam],
truncate_messages_for_roles: set[Literal["user", "system", "assistant", "tool", "function"]] = {"user"},
maximum_content_length: int = 200,
truncate_messages_for_roles: set[Literal["user", "system", "assistant", "tool", "function"]] = {
"user",
"system",
"assistant",
},
maximum_content_length: int = 500,
filler_text: str = " ...truncated... ",
) -> list[dict]:
"""
Expand Down

0 comments on commit ea57c01

Please sign in to comment.