Package: llama-index-readers-kaltura-esearch
Kaltura eSearch LoaderThis loader reads Kaltura Entries fromKalturabased 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.ParametersKalturaESearchEntryParamsThis 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 ConfigurationTo use the Kaltura eSearch Loader, you need to provide the following configuration credentials:ParameterDescriptionDefault ValuepartnerIdYour Kaltura partner ID.Mandatory (no default)apiSecretYour Kaltura API secret key (aka Admin Secret).Mandatory (no default)userIdYour Kaltura user ID.Mandatory (no default)ksTypeThe Kaltura session type.KalturaSessionType.ADMINksExpiryThe Kaltura session expiry time.86400 secondsksPrivilegesThe Kaltura session privileges."disableentitlement"kalturaApiEndpointThe Kaltura API endpoint URL."https://cdnapi-ev.kaltura.com/"requestTimeoutThe request timeout duration in seconds.500 secondsshouldLogApiCallsIf passed True, all the Kaltura API calls will also be printed to log (only use during debug).Falseload_dataThis method run the search in Kaltura and load Kaltura entries in a list of dictionaries.Method inputssearch_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 outputEach 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 NameData TypeDescriptionentry_idstrUnique identifier of the entryentry_namestrName of the entryentry_descriptionstrDescription of the entryentry_captionsJSONCaptions of the entryentry_media_typeintType of the media (KalturaMediaType)entry_media_dateintDate of the media Unix timestampentry_ms_durationintDuration of the entry in msentry_last_played_atintLast played date of the entry Unix timestampentry_applicationstrThe app that created this entry (KalturaEntryApplication)entry_tagsstrTags of the entry (comma separated)entry_reference_idstrReference ID of the entryUsageFirst, instantiate the KalturaReader (aka Kaltura Loader) with your Kaltura configuration credentials:fromllama_indeximportdownload_loaderKalturaESearchReader=download_loader("KalturaESearchReader")loader=KalturaESearchReader(partnerId="INSERT_YOUR_PARTNER_ID",apiSecret="INSERT_YOUR_ADMIN_SECRET",userId="INSERT_YOUR_USER_ID",)Using an instance of KalturaESearchEntryParamsThen, create an instance ofKalturaESearchEntryParamsand set your desired search parameters:fromKalturaClient.Plugins.ElasticSearchimport(KalturaESearchEntryParams,KalturaESearchEntryOperator,KalturaESearchOperatorType,KalturaESearchUnifiedItem,)# instantiate the params objectsearch_params=KalturaESearchEntryParams()# define search parameters (for example, search for entries with a certain tag)search_params.searchOperator=KalturaESearchEntryOperator()search_params.searchOperator.operator=KalturaESearchOperatorType.AND_OPsearch_params.searchOperator.searchItems=[KalturaESearchUnifiedItem()]search_params.searchOperator.searchItems[0].searchTerm="my_tag"Once you have yourKalturaESearchEntryParamsready, you can pass it to the Kaltura Loader:# Using search paramsentry_docs=loader.load_data(search_params)Using Free Text Search# Simple pass the search params into the load_data method without setting search_paramsentry_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.pyThis loader is designed to be used as a way to load data intoLlamaIndexand/or subsequently used as a Tool in aLangChainAgent. Seeherefor examples.About KalturaKaltura 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.