Skip to content
Open
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
16 changes: 9 additions & 7 deletions src/cohere/manually_maintained/cohere_aws/response.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
class CohereObject():
class CohereObject:
def __repr__(self) -> str:
contents = ''
exclude_list = ['iterator']
# exclude_list and type name computation maintained as before
exclude_list = ["iterator"]
type_name = type(self).__name__

for k in self.__dict__.keys():
if k not in exclude_list:
contents += f'\t{k}: {self.__dict__[k]}\n'
# Build list of lines more efficiently (avoids string concatenation in loop)
contents_lines = [f"\t{k}: {v}\n" for k, v in self.__dict__.items() if k not in exclude_list]
# Join all lines in one efficient call
contents = "".join(contents_lines)

output = f'cohere.{type(self).__name__} {{\n{contents}}}'
output = f"cohere.{type_name} {{\n{contents}}}"
return output