-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from uhlive/feature/sc-28389/documentation
API documentation
- Loading branch information
Showing
27 changed files
with
915 additions
and
266 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 |
---|---|---|
|
@@ -8,3 +8,4 @@ build | |
.venv | ||
*.local | ||
.env | ||
site |
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,4 @@ | ||
include README.md | ||
include LICENSE | ||
include src/uhlive/py.typed | ||
|
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,6 @@ | ||
# uhlive.auth | ||
|
||
::: uhlive.auth | ||
options: | ||
show_source: false | ||
|
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,5 @@ | ||
# uhlive.stream.conversation | ||
|
||
::: uhlive.stream.conversation | ||
options: | ||
show_source: false |
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,41 @@ | ||
/* Indentation. */ | ||
div.doc-contents:not(.first) { | ||
padding-left: 25px; | ||
border-left: .15rem solid var(--secondary); | ||
} | ||
|
||
/*code { | ||
font-size: inherit; | ||
} | ||
*/ | ||
h2.doc-heading { | ||
font-size: 1.75rem; | ||
/* font-weight: 600;*/ | ||
} | ||
|
||
h3.doc-heading { | ||
/* font-weight: 600;*/ | ||
font-size: 1.2rem; | ||
} | ||
|
||
/* Mark external links as such. */ | ||
a.external::after, | ||
a.autorefs-external::after { | ||
/* https://primer.style/octicons/arrow-up-right-24 */ | ||
mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>'); | ||
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>'); | ||
content: ' '; | ||
|
||
display: inline-block; | ||
vertical-align: middle; | ||
position: relative; | ||
|
||
height: 1em; | ||
width: 1em; | ||
background-color: var(--md-typeset-a-color); | ||
} | ||
|
||
a.external:hover::after, | ||
a.autorefs-external:hover::after { | ||
background-color: var(--md-accent-fg-color); | ||
} |
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,105 @@ | ||
# Welcome to the Uh!ive Python SDK | ||
|
||
The Uh!ive Python SDK is a library to access our live Automated Speech Recognition online APIs. | ||
It provides [I/O Free](https://sans-io.readthedocs.io/index.html) Python abstractions over the underlying protocols and workflows to hide the complexity. | ||
|
||
By providing an I/O Free implementation, we let developers choose whatever websocket transport library and paradigm — synchronous or asynchronous (asyncio) — they like most. | ||
|
||
## Access to the API | ||
|
||
In order to have access to our online APIs, your company needs to register for an account. Depending on the plan, you may get two kinds of credentials: | ||
|
||
* Either a `client_id` and `client_secret`; | ||
* or a `client_id`, `user_id` and `user_password`. | ||
|
||
In all cases, those credentials are used to retrieve a one time access token from our SSO. | ||
|
||
You are free to use whatever HTTP client library you like. | ||
|
||
Here is a synchronous example using `requests`: | ||
|
||
```python | ||
from uhlive.auth import build_authentication_request | ||
import requests | ||
|
||
uhlive_client = "…" | ||
uhlive_secret = "…" | ||
# user_id = "…" | ||
# user_password = "…" | ||
|
||
auth_url, auth_params = build_authentication_request(uhlive_client, uhlive_secret) | ||
# or auth_url, auth_params = build_authentication_request(uhlive_client, user_id=user_id, user_pwd=user_password) | ||
login = requests.post(auth_url, data=auth_params) | ||
login.raise_for_status() | ||
uhlive_token = login.json()["access_token"] | ||
``` | ||
|
||
Here is an asynchronous example using `aiohttp`: | ||
|
||
```python | ||
import asyncio | ||
from uhlive.auth import build_authentication_request | ||
from aiohttp import ClientSession | ||
|
||
uhlive_client = "…" | ||
uhlive_secret = "…" | ||
# user_id = "…" | ||
# user_password = "…" | ||
|
||
|
||
async def main(uhlive_client, uhlive_secret): | ||
async with ClientSession() as session: | ||
auth_url, auth_params = build_authentication_request( | ||
uhlive_client, uhlive_secret | ||
) | ||
async with session.post(auth_url, data=auth_params) as login: | ||
login.raise_for_status() | ||
body = await login.json() | ||
uhlive_token = body["access_token"] | ||
# continue with Stream API of your choice | ||
# ... | ||
|
||
asyncio.run(main(uhlive_client, uhlive_secret)) | ||
``` | ||
|
||
Then this one time token allows you to connect to any subscribed API within 5 minutes. | ||
|
||
* [Auth API reference](auth.md) | ||
|
||
|
||
## Conversation API to analyze human to human interactions. | ||
|
||
Also known as the human to human (H2H) stream API. | ||
|
||
* [High level overview](https://docs.allo-media.net/stream-h2h/overview/#high-level-overview-and-concepts) | ||
* [Python SDK API documentation](conversation_api.md) | ||
|
||
## Recognition and interpretation API for voice bots. | ||
|
||
Also known as the human to bot (H2B) stream API. | ||
|
||
* [High level overview](https://docs.allo-media.net/stream-h2b/#real-time-stream-api-for-voicebots) | ||
* [Python SDK API documentation](recognition_api.md) | ||
|
||
|
||
## Changelog | ||
|
||
### v1.3.1 | ||
|
||
Full API documentation. | ||
|
||
### v1.3.0 | ||
|
||
* Support for `SegmentNormalized` | ||
* SSO | ||
* Concurrent test runner `test_runner_async.py` in `examples/recognition` | ||
|
||
### v1.2.0 | ||
|
||
* Improved streamer | ||
* Improved test_runner.py | ||
* Forbid sharing connection between conversations | ||
|
||
### v1.1.0 | ||
|
||
* Support for passing codec parameter |
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,5 @@ | ||
# uhlive.stream.recognition | ||
|
||
::: uhlive.stream.recognition | ||
options: | ||
show_source: false |
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 |
---|---|---|
|
@@ -31,3 +31,4 @@ number = "37" | |
street = "rue du docteur leroy" | ||
zipcode = "72000" | ||
city = "le mans" | ||
complement = "" |
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 |
---|---|---|
|
@@ -26,7 +26,6 @@ def main( | |
codec: str, | ||
filepath: str, | ||
): | ||
|
||
# Shortcuts | ||
send = socket.send | ||
|
||
|
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,32 @@ | ||
site_name: Uh!ive python SDK | ||
|
||
theme: | ||
name: "mkdocs" | ||
|
||
extra_css: | ||
- css/mkdocstrings.css | ||
|
||
plugins: | ||
- search | ||
- mkdocstrings: | ||
default_handler: python | ||
handlers: | ||
python: | ||
paths: [src] | ||
options: | ||
show_signature_annotations: true | ||
group_by_category: true | ||
show_category_heading: false | ||
inherited_members: true | ||
members_order: source | ||
docstring_section_style: "list" | ||
signature_crossrefs: true | ||
separate_signature: true | ||
line_length: 110 | ||
merge_init_into_class: true | ||
|
||
nav: | ||
- Home: index.md | ||
- Auth: auth.md | ||
- H2H API: conversation_api.md | ||
- H2B API: recognition_api.md |
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,54 @@ | ||
aiohttp==3.8.4 | ||
aiosignal==1.3.1 | ||
async-timeout==4.0.2 | ||
attrs==23.1.0 | ||
Babel==2.14.0 | ||
black==23.12.1 | ||
cachetools==5.3.2 | ||
certifi==2023.5.7 | ||
cffi==1.15.1 | ||
chardet==5.2.0 | ||
charset-normalizer==3.1.0 | ||
click==8.1.7 | ||
colorama==0.4.6 | ||
distlib==0.3.8 | ||
filelock==3.13.1 | ||
frozenlist==1.3.3 | ||
ghp-import==2.1.0 | ||
griffe==0.38.1 | ||
idna==3.4 | ||
Jinja2==3.1.2 | ||
Markdown==3.5.1 | ||
MarkupSafe==2.1.3 | ||
mergedeep==1.3.4 | ||
mkdocs==1.5.3 | ||
mkdocs-autorefs==0.5.0 | ||
mkdocs-material==9.5.3 | ||
mkdocs-material-extensions==1.3.1 | ||
mkdocstrings==0.24.0 | ||
mkdocstrings-python==1.7.5 | ||
multidict==6.0.4 | ||
mypy-extensions==1.0.0 | ||
packaging==23.2 | ||
paginate==0.5.6 | ||
pathspec==0.12.1 | ||
platformdirs==4.1.0 | ||
pluggy==1.3.0 | ||
pycparser==2.21 | ||
Pygments==2.17.2 | ||
pymdown-extensions==10.7 | ||
pyproject-api==1.6.1 | ||
python-dateutil==2.8.2 | ||
PyYAML==6.0.1 | ||
pyyaml_env_tag==0.1 | ||
regex==2023.12.25 | ||
requests==2.31.0 | ||
six==1.16.0 | ||
sounddevice==0.4.6 | ||
toml==0.10.2 | ||
tox==4.11.4 | ||
urllib3==2.0.3 | ||
virtualenv==20.25.0 | ||
watchdog==3.0.0 | ||
websocket-client==1.6.1 | ||
yarl==1.9.2 |
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
Empty file.
Oops, something went wrong.