-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e759f9e
commit eedb9ee
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |