-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Summarization requests Allows using the /summarize endpoint from the python client. * Add examples to readme Co-authored-by: Julius Kreuzer <[email protected]> * bump version Co-authored-by: Julius Kreuzer <[email protected]>
- Loading branch information
Showing
10 changed files
with
355 additions
and
45 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 |
---|---|---|
@@ -1,76 +1,82 @@ | ||
# Changelog | ||
|
||
## 2.3.0 | ||
|
||
### New feature | ||
|
||
- Summarization of Documents | ||
|
||
## 2.2.4 | ||
|
||
### Documentation | ||
|
||
* Update documentation for `hosting` parameter | ||
- Update documentation for `hosting` parameter | ||
|
||
## 2.2.3 | ||
|
||
### Bugfix | ||
|
||
* Remove `message` field from CompletionResult | ||
- Remove `message` field from CompletionResult | ||
|
||
## 2.2.2 | ||
|
||
### Bugfix | ||
|
||
* Document `hosting` parameter. | ||
* The hosting parameter determines in which datacenters the request may be processed. | ||
* Currently, we only support setting it to "aleph-alpha", which allows us to only process the request in our own datacenters. | ||
* Not setting this value, or setting it to null, allows us to process the request in both our own as well as external datacenters. | ||
- Document `hosting` parameter. | ||
- The hosting parameter determines in which datacenters the request may be processed. | ||
- Currently, we only support setting it to "aleph-alpha", which allows us to only process the request in our own datacenters. | ||
- Not setting this value, or setting it to null, allows us to process the request in both our own as well as external datacenters. | ||
|
||
## 2.2.1 | ||
|
||
### Bugfix | ||
|
||
* Restore original error handling of HTTP status codes to before 2.2.0 | ||
* Add dedicated exception BusyError for status code 503 | ||
- Restore original error handling of HTTP status codes to before 2.2.0 | ||
- Add dedicated exception BusyError for status code 503 | ||
|
||
## 2.2.0 | ||
|
||
### New feature | ||
|
||
* Retry failed HTTP requests via urllib for status codes 408, 429, 500, 502, 503, 504 | ||
- Retry failed HTTP requests via urllib for status codes 408, 429, 500, 502, 503, 504 | ||
|
||
## 2.1.0 | ||
|
||
### New feature | ||
|
||
* Add new parameters to control how repetition penalties are applied for completion requests (see [docs](https://docs.aleph-alpha.com/api/#/paths/~1complete/post) for more information): | ||
* `penalty_bias` | ||
* `penalty_exceptions` | ||
* `penalty_exceptions_include_stop_sequences` | ||
- Add new parameters to control how repetition penalties are applied for completion requests (see [docs](https://docs.aleph-alpha.com/api/#/paths/~1complete/post) for more information): | ||
- `penalty_bias` | ||
- `penalty_exceptions` | ||
- `penalty_exceptions_include_stop_sequences` | ||
|
||
## 2.0.0 | ||
|
||
### Breaking change | ||
|
||
* Make hosting parameter optional in semantic_embed on client. Changed order of parameters `hosting` and `request`. | ||
- Make hosting parameter optional in semantic_embed on client. Changed order of parameters `hosting` and `request`. | ||
Should not be an issue if you're not using semantic_embed from the client directly or if you're using keyword args. | ||
|
||
### Experimental feature | ||
|
||
* Add experimental penalty parameters for completion | ||
- Add experimental penalty parameters for completion | ||
|
||
## 1.7.1 | ||
|
||
* Improved handling of text-based Documents in Q&A | ||
- Improved handling of text-based Documents in Q&A | ||
|
||
## 1.7.0 | ||
|
||
* Introduce `semantic_embed` endpoint on client and model. | ||
* Introduce timeout on client | ||
- Introduce `semantic_embed` endpoint on client and model. | ||
- Introduce timeout on client | ||
|
||
## 1.6.0 | ||
|
||
* Introduce AlephAlphaModel as a more convenient alternative to direct usage of AlephAlphaClient | ||
- Introduce AlephAlphaModel as a more convenient alternative to direct usage of AlephAlphaClient | ||
|
||
## 1.1.0 | ||
|
||
* Support for sending images to multimodal Models. | ||
- Support for sending images to multimodal Models. | ||
|
||
## 1.0.0 | ||
|
||
* Initial Release | ||
- Initial Release |
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
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
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
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
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,38 @@ | ||
from typing import Any, Mapping, NamedTuple, Sequence | ||
|
||
from aleph_alpha_client.document import Document | ||
|
||
|
||
class SummarizationRequest(NamedTuple): | ||
""" | ||
Summarizes a document. | ||
Parameters: | ||
document (Document, required): | ||
A single document. This can be one of the following formats: | ||
- Docx: A base64 encoded Docx file | ||
- Text: A string of text | ||
- Prompt: A multimodal prompt, as is used in our other tasks like Completion | ||
Documents of types Docx and Text are usually preferred, and will have optimizations (such as chunking) applied to work better with the respective task that is being run. | ||
Prompt documents are assumed to be used for advanced use cases, and will be left as-is. | ||
disable_optimizations (bool, default False) | ||
We continually research optimal ways to work with our models. By default, we apply these optimizations to both your query, documents, and answers for you. | ||
Our goal is to improve your results while using our API. | ||
But you can always pass `disable_optimizations: true` and we will leave your document and summary untouched. | ||
""" | ||
|
||
document: Document | ||
disable_optimizations: bool = False | ||
|
||
|
||
class SummarizationResponse(NamedTuple): | ||
model_version: str | ||
summary: str | ||
|
||
@classmethod | ||
def from_json(cls, json: Mapping[str, Any]) -> "SummarizationResponse": | ||
return cls(model_version=json["model_version"], summary=json["summary"]) |
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "2.2.3" | ||
__version__ = "2.3.0" |
Oops, something went wrong.