Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 15 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
# Changelog

## 4.26

- [#296] (https://github.com/cohere-ai/cohere-python/pull/301)
- Chat: add support for prompt_truncation param

## 4.25
- [#303] (https://github.com/cohere-ai/cohere-python/pull/303)
- Allow uploading of evaluation data

## 4.24

- [#296] (https://github.com/cohere-ai/cohere-python/pull/296)
- Allow passing of delimiter for csv

## 4.23

- [#294] (https://github.com/cohere-ai/cohere-python/pull/294)
- Allow passing of ParseInfo for datasets

## 4.22

- [#292] (https://github.com/cohere-ai/cohere-python/pull/292)
- Add search query only parameter
- Add documents to generate citations
- Add connectors to generate citations
- Add documents to generate citations
- Add connectors to generate citations
- Add citation quality

## 4.21

- [#287] (https://github.com/cohere-ai/cohere-python/pull/287)
- Remove deprecated chat "query" parameter including inside chat_history parameter
- Support event-type for chat streaming

## 4.20.2

- [#284] (https://github.com/cohere-ai/cohere-python/pull/284)
- Rename dataset urls to download_urls

## 4.20.1

- [#279] (https://github.com/cohere-ai/cohere-python/pull/279)
- Fix dataset listing key error

Expand Down Expand Up @@ -64,7 +75,7 @@
- [#262](https://github.com/cohere-ai/cohere-python/pull/262)
- Deprecate embed custom models

## 4.15
## 4.15

- [#256](https://github.com/cohere-ai/cohere-python/pull/256)
- Add rerank finetuning endpoint
Expand Down
5 changes: 5 additions & 0 deletions cohere/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def chat(
search_queries_only: Optional[bool] = None,
documents: Optional[List[Dict[str, Any]]] = None,
citation_quality: Optional[str] = None,
prompt_truncation: Optional[str] = None,
connectors: Optional[List[Dict[str, Any]]] = None,
) -> Union[Chat, StreamingChat]:
"""Returns a Chat object with the query reply.
Expand Down Expand Up @@ -288,6 +289,7 @@ def chat(
],
connectors (List[Dict[str, str]]): (Optional) When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). Example: connectors=[{"id": "web-search"}]
citation_quality (str): (Optional) Dictates the approach taken to generating citations by allowing the user to specify whether they want "accurate" results or "fast" results. Defaults to "accurate".
prompt_truncation (str): (Optional) Dictates how the prompt will be constructed. With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in attempt to construct a prompt that fits within the model's context length limit. With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.
Returns:
a Chat object if stream=False, or a StreamingChat object if stream=True

Expand Down Expand Up @@ -376,6 +378,9 @@ def chat(
}
if citation_quality is not None:
json_body["citation_quality"] = citation_quality
if prompt_truncation is not None:
json_body["prompt_truncation"] = prompt_truncation

response = self._request(cohere.CHAT_URL, json=json_body, stream=stream)

if stream:
Expand Down
3 changes: 3 additions & 0 deletions cohere/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ async def chat(
search_queries_only: Optional[bool] = None,
documents: Optional[List[Dict[str, Any]]] = None,
citation_quality: Optional[str] = None,
prompt_truncation: Optional[str] = None,
connectors: Optional[List[Dict[str, Any]]] = None,
) -> Union[AsyncChat, StreamingChat]:
if message is None:
Expand Down Expand Up @@ -253,6 +254,8 @@ async def chat(
}
if citation_quality is not None:
json_body["citation_quality"] = citation_quality
if prompt_truncation is not None:
json_body["prompt_truncation"] = prompt_truncation

response = await self._request(cohere.CHAT_URL, json=json_body, stream=stream)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cohere"
version = "4.25"
version = "4.26"
description = ""
authors = ["Cohere"]
readme = "README.md"
Expand Down