Skip to content

Add Iterators to Custom Objects#19

Merged
jeffistyping merged 27 commits intomainfrom
iterators
Jul 7, 2021
Merged

Add Iterators to Custom Objects#19
jeffistyping merged 27 commits intomainfrom
iterators

Conversation

@jeffistyping
Copy link
Copy Markdown
Contributor

The Python response objects that just wrap around a list object (BestChoices, Embeddings, Similarities) should be iterable.

For example, Embeddings returned from the Embed endpoint can be iterated through by using:

# embeddings = co.embed(model="baseline-shrimp", texts=["co:here", "cohere"])

for em in embeddings.embeddings:
      print(em)

Users should expect to be able to do this instead:

for em in embeddings:
      print(em)

kipply and others added 20 commits January 20, 2021 17:47
* Initial change from dicts to objects

* add newline at EOF

* Add __str__ methods to objects

* Change naming of objects to remove 'Cohere'

* Change object names to be nouns

* change sanity-test.py and rename ChooseBest object
Co-authored-by: jeff <jeff@cohere.ai>
)

* change version number for release

* Remove unused self.model Variable (#11)

Co-authored-by: jeff <jeff@cohere.ai>

* change version number for release

* add request dependency, add type annotations:

* missed something

* add init and request type annotations

Co-authored-by: Jeff <jeffrey-hui@users.noreply.github.com>
Co-authored-by: jeff <jeff@cohere.ai>
* Seperate files from

* fix version again

* include import for easier user access

* Update __init__.py

add missing double quotes

* Make more formatting changes and update sanity-test.py
@jeffistyping jeffistyping requested a review from jimwu6 July 7, 2021 15:58
Comment thread setup.py Outdated
@jeffistyping jeffistyping requested a review from jimwu6 July 7, 2021 16:32
Copy link
Copy Markdown
Contributor

@jimwu6 jimwu6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments to separate stuff in sanity-test.py, so take a look

LGTM otherwise

@jeffistyping jeffistyping merged commit 48eb84c into main Jul 7, 2021
@jeffistyping jeffistyping deleted the iterators branch July 7, 2021 21:21
vshmyhlo pushed a commit that referenced this pull request Feb 21, 2023
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.

5 participants