llama-index-readers-kaltura-esearch


Namellama-index-readers-kaltura-esearch JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
Summaryllama-index readers kaltura e-search integration
upload_time2024-08-22 06:25:27
maintainerkaltura
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords audio events image kaltura library media portal search video
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Kaltura eSearch Loader

```bash
pip install llama-index-readers-kaltura-esearch
```

This loader reads Kaltura Entries from [Kaltura](https://corp.kaltura.com) based on a Kaltura eSearch API call.
Search queries can be passed as a pre-defined object of KalturaESearchEntryParams, or through a simple free text query.
The result is a list of documents containing the Kaltura Entries and Captions json.

## Parameters

### `KalturaESearchEntryParams`

This is a Kaltura class used for performing search operations in Kaltura. You can use this class to define various search criteria, such as search phrases, operators, and objects to be searched.

For example, you can search for entries with specific tags, created within a specific time frame, or containing specific metadata.

### Kaltura Configuration

To use the Kaltura eSearch Loader, you need to provide the following configuration credentials:

| Parameter          | Description                                                                                    | Default Value                                                      |
| ------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| partnerId          | Your Kaltura partner ID.                                                                       | Mandatory (no default)                                             |
| apiSecret          | Your Kaltura API secret key (aka Admin Secret).                                                | Mandatory (no default)                                             |
| userId             | Your Kaltura user ID.                                                                          | Mandatory (no default)                                             |
| ksType             | The Kaltura session type.                                                                      | KalturaSessionType.ADMIN                                           |
| ksExpiry           | The Kaltura session expiry time.                                                               | 86400 seconds                                                      |
| ksPrivileges       | The Kaltura session privileges.                                                                | "disableentitlement"                                               |
| kalturaApiEndpoint | The Kaltura API endpoint URL.                                                                  | "[https://cdnapi-ev.kaltura.com/](https://cdnapi-ev.kaltura.com/)" |
| requestTimeout     | The request timeout duration in seconds.                                                       | 500 seconds                                                        |
| shouldLogApiCalls  | If passed True, all the Kaltura API calls will also be printed to log (only use during debug). | False                                                              |

### load_data

This method run the search in Kaltura and load Kaltura entries in a list of dictionaries.

#### Method inputs

- search_params: search parameters of type KalturaESearchEntryParams with pre-set search queries. If not provided, the other parameters will be used to construct the search query.
- search_operator_and: if True, the constructed search query will have AND operator between query filters, if False, the operator will be OR.
- free_text: if provided, will be used as the free text query of the search in Kaltura.
- category_ids: if provided, will only search for entries that are found inside these category ids.
- withCaptions: determines whether or not to also download captions/transcript contents from Kaltura.
- maxEntries: sets the maximum number of entries to pull from Kaltura, between 0 to 500 (max pageSize in Kaltura).

#### Method output

Each dictionary in the response represents a Kaltura media entry, where the keys are strings (field names) and the values can be of any type:

| Column Name          | Data Type | Description                                               |
| -------------------- | --------- | --------------------------------------------------------- |
| entry_id             | str       | Unique identifier of the entry                            |
| entry_name           | str       | Name of the entry                                         |
| entry_description    | str       | Description of the entry                                  |
| entry_captions       | JSON      | Captions of the entry                                     |
| entry_media_type     | int       | Type of the media (KalturaMediaType)                      |
| entry_media_date     | int       | Date of the media Unix timestamp                          |
| entry_ms_duration    | int       | Duration of the entry in ms                               |
| entry_last_played_at | int       | Last played date of the entry Unix timestamp              |
| entry_application    | str       | The app that created this entry (KalturaEntryApplication) |
| entry_tags           | str       | Tags of the entry (comma separated)                       |
| entry_reference_id   | str       | Reference ID of the entry                                 |

## Usage

First, instantiate the KalturaReader (aka Kaltura Loader) with your Kaltura configuration credentials:

```python
from llama_index.readers.kaltura_esearch import KalturaESearchReader

loader = KalturaESearchReader(
    partnerId="INSERT_YOUR_PARTNER_ID",
    apiSecret="INSERT_YOUR_ADMIN_SECRET",
    userId="INSERT_YOUR_USER_ID",
)
```

### Using an instance of KalturaESearchEntryParams

Then, create an instance of `KalturaESearchEntryParams` and set your desired search parameters:

```python
from KalturaClient.Plugins.ElasticSearch import (
    KalturaESearchEntryParams,
    KalturaESearchEntryOperator,
    KalturaESearchOperatorType,
    KalturaESearchUnifiedItem,
)

# instantiate the params object
search_params = KalturaESearchEntryParams()

# define search parameters (for example, search for entries with a certain tag)
search_params.searchOperator = KalturaESearchEntryOperator()
search_params.searchOperator.operator = KalturaESearchOperatorType.AND_OP
search_params.searchOperator.searchItems = [KalturaESearchUnifiedItem()]
search_params.searchOperator.searchItems[0].searchTerm = "my_tag"
```

Once you have your `KalturaESearchEntryParams` ready, you can pass it to the Kaltura Loader:

```python
# Using search params
entry_docs = loader.load_data(search_params)
```

### Using Free Text Search

```python
# Simple pass the search params into the load_data method without setting search_params
entry_docs = loader.load_data(
    search_operator_and=True,
    free_text="education",
    category_ids=None,
    with_captions=True,
    max_entries=5,
)
```

For a more elaborate example, see: [llamaindex_kaltura_esearch_reader_example.py](https://gist.github.com/zoharbabin/07febcfe52b64116c9e3ba1a392b59a0)

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).

## About Kaltura

Kaltura Video Cloud is a Digital Experience Platform enabling streamlined creation, management, and distribution of media content (video, audio, image, doc, live stream, real-time video). It powers many applications across industries with collaboration, interactivity, virtual events, and deep video analytics capabilities.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-readers-kaltura-esearch",
    "maintainer": "kaltura",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": "audio, events, image, kaltura, library, media, portal, search, video",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/a4/00/02824dc1be53bb6e25c7e8778ffe24093611d6b141aaad8386b7986b47fd/llama_index_readers_kaltura_esearch-0.2.0.tar.gz",
    "platform": null,
    "description": "# Kaltura eSearch Loader\n\n```bash\npip install llama-index-readers-kaltura-esearch\n```\n\nThis loader reads Kaltura Entries from [Kaltura](https://corp.kaltura.com) based on a Kaltura eSearch API call.\nSearch queries can be passed as a pre-defined object of KalturaESearchEntryParams, or through a simple free text query.\nThe result is a list of documents containing the Kaltura Entries and Captions json.\n\n## Parameters\n\n### `KalturaESearchEntryParams`\n\nThis is a Kaltura class used for performing search operations in Kaltura. You can use this class to define various search criteria, such as search phrases, operators, and objects to be searched.\n\nFor example, you can search for entries with specific tags, created within a specific time frame, or containing specific metadata.\n\n### Kaltura Configuration\n\nTo use the Kaltura eSearch Loader, you need to provide the following configuration credentials:\n\n| Parameter          | Description                                                                                    | Default Value                                                      |\n| ------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| partnerId          | Your Kaltura partner ID.                                                                       | Mandatory (no default)                                             |\n| apiSecret          | Your Kaltura API secret key (aka Admin Secret).                                                | Mandatory (no default)                                             |\n| userId             | Your Kaltura user ID.                                                                          | Mandatory (no default)                                             |\n| ksType             | The Kaltura session type.                                                                      | KalturaSessionType.ADMIN                                           |\n| ksExpiry           | The Kaltura session expiry time.                                                               | 86400 seconds                                                      |\n| ksPrivileges       | The Kaltura session privileges.                                                                | \"disableentitlement\"                                               |\n| kalturaApiEndpoint | The Kaltura API endpoint URL.                                                                  | \"[https://cdnapi-ev.kaltura.com/](https://cdnapi-ev.kaltura.com/)\" |\n| requestTimeout     | The request timeout duration in seconds.                                                       | 500 seconds                                                        |\n| shouldLogApiCalls  | If passed True, all the Kaltura API calls will also be printed to log (only use during debug). | False                                                              |\n\n### load_data\n\nThis method run the search in Kaltura and load Kaltura entries in a list of dictionaries.\n\n#### Method inputs\n\n- search_params: search parameters of type KalturaESearchEntryParams with pre-set search queries. If not provided, the other parameters will be used to construct the search query.\n- search_operator_and: if True, the constructed search query will have AND operator between query filters, if False, the operator will be OR.\n- free_text: if provided, will be used as the free text query of the search in Kaltura.\n- category_ids: if provided, will only search for entries that are found inside these category ids.\n- withCaptions: determines whether or not to also download captions/transcript contents from Kaltura.\n- maxEntries: sets the maximum number of entries to pull from Kaltura, between 0 to 500 (max pageSize in Kaltura).\n\n#### Method output\n\nEach dictionary in the response represents a Kaltura media entry, where the keys are strings (field names) and the values can be of any type:\n\n| Column Name          | Data Type | Description                                               |\n| -------------------- | --------- | --------------------------------------------------------- |\n| entry_id             | str       | Unique identifier of the entry                            |\n| entry_name           | str       | Name of the entry                                         |\n| entry_description    | str       | Description of the entry                                  |\n| entry_captions       | JSON      | Captions of the entry                                     |\n| entry_media_type     | int       | Type of the media (KalturaMediaType)                      |\n| entry_media_date     | int       | Date of the media Unix timestamp                          |\n| entry_ms_duration    | int       | Duration of the entry in ms                               |\n| entry_last_played_at | int       | Last played date of the entry Unix timestamp              |\n| entry_application    | str       | The app that created this entry (KalturaEntryApplication) |\n| entry_tags           | str       | Tags of the entry (comma separated)                       |\n| entry_reference_id   | str       | Reference ID of the entry                                 |\n\n## Usage\n\nFirst, instantiate the KalturaReader (aka Kaltura Loader) with your Kaltura configuration credentials:\n\n```python\nfrom llama_index.readers.kaltura_esearch import KalturaESearchReader\n\nloader = KalturaESearchReader(\n    partnerId=\"INSERT_YOUR_PARTNER_ID\",\n    apiSecret=\"INSERT_YOUR_ADMIN_SECRET\",\n    userId=\"INSERT_YOUR_USER_ID\",\n)\n```\n\n### Using an instance of KalturaESearchEntryParams\n\nThen, create an instance of `KalturaESearchEntryParams` and set your desired search parameters:\n\n```python\nfrom KalturaClient.Plugins.ElasticSearch import (\n    KalturaESearchEntryParams,\n    KalturaESearchEntryOperator,\n    KalturaESearchOperatorType,\n    KalturaESearchUnifiedItem,\n)\n\n# instantiate the params object\nsearch_params = KalturaESearchEntryParams()\n\n# define search parameters (for example, search for entries with a certain tag)\nsearch_params.searchOperator = KalturaESearchEntryOperator()\nsearch_params.searchOperator.operator = KalturaESearchOperatorType.AND_OP\nsearch_params.searchOperator.searchItems = [KalturaESearchUnifiedItem()]\nsearch_params.searchOperator.searchItems[0].searchTerm = \"my_tag\"\n```\n\nOnce you have your `KalturaESearchEntryParams` ready, you can pass it to the Kaltura Loader:\n\n```python\n# Using search params\nentry_docs = loader.load_data(search_params)\n```\n\n### Using Free Text Search\n\n```python\n# Simple pass the search params into the load_data method without setting search_params\nentry_docs = loader.load_data(\n    search_operator_and=True,\n    free_text=\"education\",\n    category_ids=None,\n    with_captions=True,\n    max_entries=5,\n)\n```\n\nFor a more elaborate example, see: [llamaindex_kaltura_esearch_reader_example.py](https://gist.github.com/zoharbabin/07febcfe52b64116c9e3ba1a392b59a0)\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).\n\n## About Kaltura\n\nKaltura Video Cloud is a Digital Experience Platform enabling streamlined creation, management, and distribution of media content (video, audio, image, doc, live stream, real-time video). It powers many applications across industries with collaboration, interactivity, virtual events, and deep video analytics capabilities.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index readers kaltura e-search integration",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [
        "audio",
        " events",
        " image",
        " kaltura",
        " library",
        " media",
        " portal",
        " search",
        " video"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c437964890f58da9306d668fcd2465d5e89c9ed42c7e1142485220d7d3f1eb8",
                "md5": "9165e6fdcfacb3578efe8e949bd8e55a",
                "sha256": "a665f23aed7589559bf739dca8edea9e0cc60561bdda86bf714aba1fcb8eef0c"
            },
            "downloads": -1,
            "filename": "llama_index_readers_kaltura_esearch-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9165e6fdcfacb3578efe8e949bd8e55a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 7233,
            "upload_time": "2024-08-22T06:25:25",
            "upload_time_iso_8601": "2024-08-22T06:25:25.942187Z",
            "url": "https://files.pythonhosted.org/packages/5c/43/7964890f58da9306d668fcd2465d5e89c9ed42c7e1142485220d7d3f1eb8/llama_index_readers_kaltura_esearch-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a40002824dc1be53bb6e25c7e8778ffe24093611d6b141aaad8386b7986b47fd",
                "md5": "a1aa4aa4e4f89126ad080bd589f5cb24",
                "sha256": "a8b7bcd78234e2db8f63c04498170257823b79989e7d6fca78b6cfb6a3d2b21d"
            },
            "downloads": -1,
            "filename": "llama_index_readers_kaltura_esearch-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a1aa4aa4e4f89126ad080bd589f5cb24",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 6485,
            "upload_time": "2024-08-22T06:25:27",
            "upload_time_iso_8601": "2024-08-22T06:25:27.156035Z",
            "url": "https://files.pythonhosted.org/packages/a4/00/02824dc1be53bb6e25c7e8778ffe24093611d6b141aaad8386b7986b47fd/llama_index_readers_kaltura_esearch-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 06:25:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-readers-kaltura-esearch"
}
        
Elapsed time: 0.33195s