Skip to content

Commit

Permalink
Add migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
billytrend-cohere committed Jan 24, 2024
1 parent e759f9e commit eedb9ee
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions v4-v5-migration-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## `cohere==4` to `cohere==5` migration guide

As we migrate from the handwritten manually-maintained sdk to our auto-generated sdk, there are some breaking changes that must be accomodated during migration. These should mostly improve the developer experience but thank you for bearing with us as we make these changes.

### Installation

To install the latest alpha version of the cohere sdk `pip3 install --pre --upgrade cohere`.

### Migrating usages

#### Migrating function calls

[This diff view](https://github.com/cohere-ai/cohere-python/compare/old-usage...new-usage) enumerates all usages of the old sdk and how they map to the new sdk. Some fields are no longer supported in the new sdk.

#### Migrating streaming usage

The `streaming: boolean` are no longer supported in the new sdk. Instead, you can replace the `chat` function with `chat_stream` and `generate` function with `generate_stream`. These will automatically inject the `streaming` parameter into the request. The following is an example usage for `chat_stream`:

```python
stream = co.chat_stream(
message="Tell me a short story"
)

for event in stream:
if event.event_type == "text-generation":
print(event.text, end='')
```

### Removed functionality (subject to change)

The following lists name the functions that are not in the new SDK and what their ongoing support status is.

#### Not yet supported

* loglikelihood
* wait_for_dataset
* wait_for_embed_job

#### No longer supported

* batch_generate
* codebook
* batch_tokenize
* batch_detokenize
* check_api_key
* detect_language
* generate_feedback
* generate_preference_feedback
* create_cluster_job
* get_cluster_job
* list_cluster_jobs
* wait_for_cluster_job

#### Status unknown

* create_custom_model
* wait_for_custom_model
* get_custom_model
* get_custom_model_by_name
* get_custom_model_metrics
* list_custom_models

0 comments on commit eedb9ee

Please sign in to comment.