hume


Namehume JSON
Version 0.10.1 PyPI version JSON
download
home_pageNone
SummaryA Python SDK for Hume AI
upload_time2025-07-17 22:03:09
maintainerNone
docs_urlNone
authorNone
requires_python<4,>=3.9
licenseMIT
keywords hume ai evi empathic multimodal expression analysis sentiment voice recognition detection emotion interface speech audio vision expressive embeddings communication learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <img src="https://storage.googleapis.com/hume-public-logos/hume/hume-banner.png">
  <h1>Hume AI Python SDK</h1>

  <p>
    <strong>Integrate Hume APIs directly into your Python application</strong>
  </p>

  <br>
  <div>
    <a href="https://pypi.python.org/pypi/hume"><img src="https://img.shields.io/pypi/v/hume"></a>
    <a href="https://buildwithfern.com/"><img src="https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen"></a>
  </div>
  <br>
</div>

## Migration Guide for Version 0.7.0 and Above

There were major breaking changes in version `0.7.0` of the SDK. If upgrading from a previous version, please 
**[View the Migration Guide](https://github.com/HumeAI/hume-python-sdk/wiki/Python-SDK-Migration-Guide)**. That release deprecated several interfaces and moved them to the `hume[legacy]` package extra. The `legacy` extra was removed in `0.9.0`. The last version to include `legacy` was `0.8.6`.

## Documentation

API reference documentation is available [here](https://dev.hume.ai/reference/).

## Compatibility

The Hume Python SDK is compatible across several Python versions and operating systems.

- For the [Empathic Voice Interface](https://dev.hume.ai/docs/empathic-voice-interface-evi/overview), Python versions `3.9` through `3.11` are supported on macOS and Linux.
- For [Text-to-speech (TTS)](https://dev.hume.ai/docs/text-to-speech-tts/overview), Python versions `3.9` through `3.12` are supported on macOS, Linux, and Windows.
- For [Expression Measurement](https://dev.hume.ai/docs/expression-measurement/overview), Python versions `3.9` through `3.12` are supported on macOS, Linux, and Windows.

Below is a table which shows the version and operating system compatibilities by product:

|                          | Python Version                | Operating System      |
| ------------------------ | ----------------------------- | --------------------- |
| Empathic Voice Interface | `3.9`, `3.10`, `3.11`         | macOS, Linux          |
| Text-to-speech (TTS)     | `3.9`, `3.10`, `3.11`, `3.12` | macOS, Linux, Windows |
| Expression Measurement   | `3.9`, `3.10`, `3.11`, `3.12` | macOS, Linux, Windows |

## Installation

```sh
pip install hume
# or
poetry add hume
# or
uv add hume
```

## Other Resources

```python
from hume.client import HumeClient

client = HumeClient(api_key="YOUR_API_KEY")
client.empathic_voice.configs.list_configs()
```

## Async Client

The SDK also exports an async client so that you can make non-blocking calls to our API.

```python
import asyncio

from hume.client import AsyncHumeClient

client = AsyncHumeClient(api_key="YOUR_API_KEY")

async def main() -> None:
    await client.empathic_voice.configs.list_configs()

asyncio.run(main())
```

### Writing File

Writing files with an async stream of bytes can be tricky in Python! `aiofiles` can simplify this some. For example,
you can download your job artifacts like so:

```python
import aiofiles

from hume import AsyncHumeClient

client = AsyncHumeClient()
async with aiofiles.open('artifacts.zip', mode='wb') as file:
    async for chunk in client.expression_measurement.batch.get_job_artifacts(id="my-job-id"):
        await file.write(chunk)
```

## Namespaces

This SDK contains the APIs for empathic voice, tts, and expression measurement. Even
if you do not plan on using more than one API to start, the SDK provides easy access in
case you would like to use additional APIs in the future.

Each API is namespaced accordingly:

```python
from hume.client import HumeClient

client = HumeClient(api_key="YOUR_API_KEY")

client.emapthic_voice.         # APIs specific to Empathic Voice
client.tts.                    # APIs specific to Text-to-speech
client.expression_measurement. # APIs specific to Expression Measurement
```

## Exception Handling

All errors thrown by the SDK will be subclasses of [`ApiError`](./src/hume/core/api_error.py).

```python
import hume.client

try:
  client.expression_measurement.batch.get_job_predictions(...)
except hume.core.ApiError as e: # Handle all errors
  print(e.status_code)
  print(e.body)
```

## Pagination

Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object. For example, `list_tools` will return a generator over `ReturnUserDefinedTool` and handle the pagination behind the scenes:

```python
import hume.client

client = HumeClient(api_key="YOUR_API_KEY")

for tool in client.empathic_voice.tools.list_tools():
  print(tool)
```

you could also iterate page-by-page:

```python
for page in client.empathic_voice.tools.list_tools().iter_pages():
  print(page.items)
```

or manually:

```python
pager = client.empathic_voice.tools.list_tools()
# First page
print(pager.items)
# Second page
pager = pager.next_page()
print(pager.items)
```

## WebSockets

We expose a websocket client for interacting with the EVI API as well as Expression Measurement.

When interacting with these clients, you can use them very similarly to how you'd use the common `websockets` library:

```python
from hume import StreamDataModels

client = AsyncHumeClient(api_key=os.getenv("HUME_API_KEY"))

async with client.expression_measurement.stream.connect(
    options={"config": StreamDataModels(...)}
) as hume_socket:
    print(await hume_socket.get_job_details())
```

The underlying connection, in this case `hume_socket`, will support intellisense/autocomplete for the different functions that are available on the socket!

### Advanced

#### Retries

The Hume SDK is instrumented with automatic retries with exponential backoff. A request will be
retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
than the configured retry limit.

A request is deemed retriable when any of the following HTTP status codes is returned:

- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

Use the `max_retries` request option to configure this behavior.

```python
from hume.client import HumeClient
from hume.core import RequestOptions

client = HumeClient(...)

# Override retries for a specific method
client.expression_measurement.batch.get_job_predictions(...,
    request_options=RequestOptions(max_retries=5)
)
```

#### Timeouts

By default, requests time out after 60 seconds. You can configure this with a
timeout option at the client or request level.

```python
from hume.client import HumeClient
from hume.core import RequestOptions

client = HumeClient(
    # All timeouts are 20 seconds
    timeout=20.0,
)

# Override timeout for a specific method
client.expression_measurement.batch.get_job_predictions(...,
    request_options=RequestOptions(timeout_in_seconds=20)
)
```

#### Custom HTTP client

You can override the httpx client to customize it for your use-case. Some common use-cases
include support for proxies and transports.

```python
import httpx

from hume.client import HumeClient

client = HumeClient(
    http_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)
```

## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.

Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hume",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "hume, ai, evi, empathic, multimodal, expression, analysis, sentiment, voice, recognition, detection, emotion, interface, speech, audio, vision, expressive, embeddings, communication, learning",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c1/22/f36f63bb245fd2e94f60b6de2d041769abc42b878fc71f541aa86334bc22/hume-0.10.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img src=\"https://storage.googleapis.com/hume-public-logos/hume/hume-banner.png\">\n  <h1>Hume AI Python SDK</h1>\n\n  <p>\n    <strong>Integrate Hume APIs directly into your Python application</strong>\n  </p>\n\n  <br>\n  <div>\n    <a href=\"https://pypi.python.org/pypi/hume\"><img src=\"https://img.shields.io/pypi/v/hume\"></a>\n    <a href=\"https://buildwithfern.com/\"><img src=\"https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen\"></a>\n  </div>\n  <br>\n</div>\n\n## Migration Guide for Version 0.7.0 and Above\n\nThere were major breaking changes in version `0.7.0` of the SDK. If upgrading from a previous version, please \n**[View the Migration Guide](https://github.com/HumeAI/hume-python-sdk/wiki/Python-SDK-Migration-Guide)**. That release deprecated several interfaces and moved them to the `hume[legacy]` package extra. The `legacy` extra was removed in `0.9.0`. The last version to include `legacy` was `0.8.6`.\n\n## Documentation\n\nAPI reference documentation is available [here](https://dev.hume.ai/reference/).\n\n## Compatibility\n\nThe Hume Python SDK is compatible across several Python versions and operating systems.\n\n- For the [Empathic Voice Interface](https://dev.hume.ai/docs/empathic-voice-interface-evi/overview), Python versions `3.9` through `3.11` are supported on macOS and Linux.\n- For [Text-to-speech (TTS)](https://dev.hume.ai/docs/text-to-speech-tts/overview), Python versions `3.9` through `3.12` are supported on macOS, Linux, and Windows.\n- For [Expression Measurement](https://dev.hume.ai/docs/expression-measurement/overview), Python versions `3.9` through `3.12` are supported on macOS, Linux, and Windows.\n\nBelow is a table which shows the version and operating system compatibilities by product:\n\n|                          | Python Version                | Operating System      |\n| ------------------------ | ----------------------------- | --------------------- |\n| Empathic Voice Interface | `3.9`, `3.10`, `3.11`         | macOS, Linux          |\n| Text-to-speech (TTS)     | `3.9`, `3.10`, `3.11`, `3.12` | macOS, Linux, Windows |\n| Expression Measurement   | `3.9`, `3.10`, `3.11`, `3.12` | macOS, Linux, Windows |\n\n## Installation\n\n```sh\npip install hume\n# or\npoetry add hume\n# or\nuv add hume\n```\n\n## Other Resources\n\n```python\nfrom hume.client import HumeClient\n\nclient = HumeClient(api_key=\"YOUR_API_KEY\")\nclient.empathic_voice.configs.list_configs()\n```\n\n## Async Client\n\nThe SDK also exports an async client so that you can make non-blocking calls to our API.\n\n```python\nimport asyncio\n\nfrom hume.client import AsyncHumeClient\n\nclient = AsyncHumeClient(api_key=\"YOUR_API_KEY\")\n\nasync def main() -> None:\n    await client.empathic_voice.configs.list_configs()\n\nasyncio.run(main())\n```\n\n### Writing File\n\nWriting files with an async stream of bytes can be tricky in Python! `aiofiles` can simplify this some. For example,\nyou can download your job artifacts like so:\n\n```python\nimport aiofiles\n\nfrom hume import AsyncHumeClient\n\nclient = AsyncHumeClient()\nasync with aiofiles.open('artifacts.zip', mode='wb') as file:\n    async for chunk in client.expression_measurement.batch.get_job_artifacts(id=\"my-job-id\"):\n        await file.write(chunk)\n```\n\n## Namespaces\n\nThis SDK contains the APIs for empathic voice, tts, and expression measurement. Even\nif you do not plan on using more than one API to start, the SDK provides easy access in\ncase you would like to use additional APIs in the future.\n\nEach API is namespaced accordingly:\n\n```python\nfrom hume.client import HumeClient\n\nclient = HumeClient(api_key=\"YOUR_API_KEY\")\n\nclient.emapthic_voice.         # APIs specific to Empathic Voice\nclient.tts.                    # APIs specific to Text-to-speech\nclient.expression_measurement. # APIs specific to Expression Measurement\n```\n\n## Exception Handling\n\nAll errors thrown by the SDK will be subclasses of [`ApiError`](./src/hume/core/api_error.py).\n\n```python\nimport hume.client\n\ntry:\n  client.expression_measurement.batch.get_job_predictions(...)\nexcept hume.core.ApiError as e: # Handle all errors\n  print(e.status_code)\n  print(e.body)\n```\n\n## Pagination\n\nPaginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object. For example, `list_tools` will return a generator over `ReturnUserDefinedTool` and handle the pagination behind the scenes:\n\n```python\nimport hume.client\n\nclient = HumeClient(api_key=\"YOUR_API_KEY\")\n\nfor tool in client.empathic_voice.tools.list_tools():\n  print(tool)\n```\n\nyou could also iterate page-by-page:\n\n```python\nfor page in client.empathic_voice.tools.list_tools().iter_pages():\n  print(page.items)\n```\n\nor manually:\n\n```python\npager = client.empathic_voice.tools.list_tools()\n# First page\nprint(pager.items)\n# Second page\npager = pager.next_page()\nprint(pager.items)\n```\n\n## WebSockets\n\nWe expose a websocket client for interacting with the EVI API as well as Expression Measurement.\n\nWhen interacting with these clients, you can use them very similarly to how you'd use the common `websockets` library:\n\n```python\nfrom hume import StreamDataModels\n\nclient = AsyncHumeClient(api_key=os.getenv(\"HUME_API_KEY\"))\n\nasync with client.expression_measurement.stream.connect(\n    options={\"config\": StreamDataModels(...)}\n) as hume_socket:\n    print(await hume_socket.get_job_details())\n```\n\nThe underlying connection, in this case `hume_socket`, will support intellisense/autocomplete for the different functions that are available on the socket!\n\n### Advanced\n\n#### Retries\n\nThe Hume SDK is instrumented with automatic retries with exponential backoff. A request will be\nretried as long as the request is deemed retriable and the number of retry attempts has not grown larger\nthan the configured retry limit.\n\nA request is deemed retriable when any of the following HTTP status codes is returned:\n\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)\n\nUse the `max_retries` request option to configure this behavior.\n\n```python\nfrom hume.client import HumeClient\nfrom hume.core import RequestOptions\n\nclient = HumeClient(...)\n\n# Override retries for a specific method\nclient.expression_measurement.batch.get_job_predictions(...,\n    request_options=RequestOptions(max_retries=5)\n)\n```\n\n#### Timeouts\n\nBy default, requests time out after 60 seconds. You can configure this with a\ntimeout option at the client or request level.\n\n```python\nfrom hume.client import HumeClient\nfrom hume.core import RequestOptions\n\nclient = HumeClient(\n    # All timeouts are 20 seconds\n    timeout=20.0,\n)\n\n# Override timeout for a specific method\nclient.expression_measurement.batch.get_job_predictions(...,\n    request_options=RequestOptions(timeout_in_seconds=20)\n)\n```\n\n#### Custom HTTP client\n\nYou can override the httpx client to customize it for your use-case. Some common use-cases\ninclude support for proxies and transports.\n\n```python\nimport httpx\n\nfrom hume.client import HumeClient\n\nclient = HumeClient(\n    http_client=httpx.Client(\n        proxies=\"http://my.test.proxy.example.com\",\n        transport=httpx.HTTPTransport(local_address=\"0.0.0.0\"),\n    ),\n)\n```\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\n\nAdditions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python SDK for Hume AI",
    "version": "0.10.1",
    "project_urls": null,
    "split_keywords": [
        "hume",
        " ai",
        " evi",
        " empathic",
        " multimodal",
        " expression",
        " analysis",
        " sentiment",
        " voice",
        " recognition",
        " detection",
        " emotion",
        " interface",
        " speech",
        " audio",
        " vision",
        " expressive",
        " embeddings",
        " communication",
        " learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c86b9551c53dd5caa9b2cbba3ae953a508558d3a22c7bd116282c86cb4b7b4c",
                "md5": "ac0e133afad7cdcac4b39e28bcce4624",
                "sha256": "c0d6b75863405e564d7dc169bdffd8a16081d519a28ca306ba15d61a21d1ecf6"
            },
            "downloads": -1,
            "filename": "hume-0.10.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac0e133afad7cdcac4b39e28bcce4624",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 300135,
            "upload_time": "2025-07-17T22:03:08",
            "upload_time_iso_8601": "2025-07-17T22:03:08.773705Z",
            "url": "https://files.pythonhosted.org/packages/0c/86/b9551c53dd5caa9b2cbba3ae953a508558d3a22c7bd116282c86cb4b7b4c/hume-0.10.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c122f36f63bb245fd2e94f60b6de2d041769abc42b878fc71f541aa86334bc22",
                "md5": "7d14452444c61bd5da6db6e5e3d1bc19",
                "sha256": "f4c900f3a63f29f532cb30ab6d064b8a9509618de187a4461aa29332cc164f3a"
            },
            "downloads": -1,
            "filename": "hume-0.10.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7d14452444c61bd5da6db6e5e3d1bc19",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 120817,
            "upload_time": "2025-07-17T22:03:09",
            "upload_time_iso_8601": "2025-07-17T22:03:09.979188Z",
            "url": "https://files.pythonhosted.org/packages/c1/22/f36f63bb245fd2e94f60b6de2d041769abc42b878fc71f541aa86334bc22/hume-0.10.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 22:03:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hume"
}
        
Elapsed time: 0.90201s