HumeStreamClient
Bases: ClientBase
Streaming API client.
Example
import asyncio
from hume import HumeStreamClient
from hume.models.config import BurstConfig
from hume.models.config import ProsodyConfig
async def main():
client = HumeStreamClient("<your-api-key>")
configs = [BurstConfig(), ProsodyConfig()]
async with client.connect(configs) as socket:
result = await socket.send_file("<your-audio-filepath>")
print(result)
asyncio.run(main())
Source code in hume/_stream/hume_stream_client.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__init__(api_key, *args, open_timeout=10, close_timeout=10, **kwargs)
Construct a HumeStreamClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
Hume API key. |
required |
open_timeout |
Optional[int]
|
Time in seconds before canceling socket open operation. |
10
|
close_timeout |
Optional[int]
|
Time in seconds before canceling socket close operation. |
10
|
Source code in hume/_stream/hume_stream_client.py
connect(configs, stream_window_ms=None)
async
Connect to the streaming API.
Only one config per model type should be passed.
If more than one config is passed for a given model type, only the last config will be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configs |
List[ModelConfigBase]
|
List of job configs. |
required |
stream_window_ms |
Optional[int]
|
Length of the sliding window in milliseconds to use when aggregating media across streaming payloads within one WebSocket connection. |
None
|
Source code in hume/_stream/hume_stream_client.py
get_api_type()
classmethod
Get the ApiType of the client.
Returns:
Name | Type | Description |
---|---|---|
ApiType |
ApiType
|
API type of the client. |