Skip to content

Make more informative string representations of Cohere Objects #24

Merged
jimwu6 merged 5 commits intomainfrom
better-str
Jul 22, 2021
Merged

Make more informative string representations of Cohere Objects #24
jimwu6 merged 5 commits intomainfrom
better-str

Conversation

@jimwu6
Copy link
Copy Markdown
Contributor

@jimwu6 jimwu6 commented Jul 21, 2021

This PR changes the __str__() method of Cohere objects to be more informative. It will be inherited from the new CohereResponse object, which will be the parent class of all non-error responses from Cohere endpoints. Specifically, it will print out the type of object it is and display its attributes. Note that this feature is more for debugging purposes. To actually access the returned information properly, users should go through the attributes.

This PR also renames CohereClient to Client to make it less redundant (i.e. users used to type co = cohere.CohereClient(...) but now only need to type co = cohere.Client(...).

@jimwu6 jimwu6 requested a review from kipply July 21, 2021 21:01
@jimwu6 jimwu6 merged commit db647f3 into main Jul 22, 2021
@jimwu6 jimwu6 deleted the better-str branch July 22, 2021 19:53
vshmyhlo pushed a commit that referenced this pull request Feb 21, 2023
* make better string statements + change CohereClient -> Client

* make response object the parent class, leave in (deprecated) CohereClient, rework __str__ method

* add newline

* add message for future deprecation

* change version number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants