HumeStreamClient
Bases: ClientBase
Streaming API client.
Example
import asyncio
from hume import HumeStreamClient, StreamSocket
from hume.models.config import FaceConfig
async def main():
client = HumeStreamClient("<your-api-key>")
config = FaceConfig(identify_faces=True)
async with client.connect([configs]) as socket:
result = await socket.send_file("<your-image-filepath>")
print(result)
asyncio.run(main())
Source code in hume/_stream/hume_stream_client.py
__init__(api_key, *args, **kwargs)
Construct a HumeStreamClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
Hume API key. |
required |
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. |