llama-index readers airbyte_gong integration
Project description
Airbyte Gong Loader
The Airbyte Gong Loader allows you to access different Gong objects.
Installation
- Install llama_hub:
pip install llama_hub
- Install the gong source:
pip install airbyte-source-gong
Usage
Here's an example usage of the AirbyteGongReader.
from llama_hub.airbyte_gong import AirbyteGongReader
gong_config = {
# ...
}
reader = AirbyteGongReader(config=gong_config)
documents = reader.load_data(stream_name="calls")
Configuration
Check out the Airbyte documentation page for details about how to configure the reader. The JSON schema the config object should adhere to can be found on Github: https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-gong/source_gong/spec.yaml.
The general shape looks like this:
{
"access_key": "<access key name>",
"access_key_secret": "<access key secret>",
"start_date": "<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>",
}
By default all fields are stored as metadata in the documents and the text is set to the JSON representation of all the fields. Construct the text of the document by passing a record_handler
to the reader:
def handle_record(record, id):
return Document(
doc_id=id, text=record.data["title"], extra_info=record.data
)
reader = AirbyteGongReader(config=gong_config, record_handler=handle_record)
Lazy loads
The reader.load_data
endpoint will collect all documents and return them as a list. If there are a large number of documents, this can cause issues. By using reader.lazy_load_data
instead, an iterator is returned which can be consumed document by document without the need to keep all documents in memory.
Incremental loads
This loader supports loading data incrementally (only returning documents that weren't loaded last time or got updated in the meantime):
reader = AirbyteGongReader(config={...})
documents = reader.load_data(stream_name="calls")
current_state = reader.last_state # can be pickled away or stored otherwise
updated_documents = reader.load_data(
stream_name="calls", state=current_state
) # only loads documents that were updated since last time
This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent. See here for examples.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for llama_index_readers_airbyte_gong-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647770c62ec0c08a6c1bcbd9c940fe08929610bfc70b0d0d550475955aaf9ebc |
|
MD5 | a4a7d363445d5ef0be55f9828a0a11bc |
|
BLAKE2b-256 | e73e9167f976e8f1ad4e72af0a71c25074525e28c26acb87725fc625bbbeba43 |
Hashes for llama_index_readers_airbyte_gong-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fdfb1d953dc11e2512e930d50a618b2bd20cd169f34c0af0cb0315eced1bf3a |
|
MD5 | b87617f6d26421075eea366828fc00b0 |
|
BLAKE2b-256 | 1518512362598186d51aff176be79c1c992466599ca734e4f3c30e48bbddcabb |