Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!
Open In ColabOpen on GitHub

Airbyte Typeform (Deprecated)

Note: This connector-specific loader is deprecated. Please useAirbyteLoader instead.

Airbyte is a data integration platform for ELT pipelines from APIs, databases & files to warehouses & lakes. It has the largest catalog of ELT connectors to data warehouses and databases.

This loader exposes the Typeform connector as a document loader, allowing you to load various Typeform objects as documents.

Installation

First, you need to install theairbyte-source-typeform python package.

%pip install--upgrade--quiet  airbyte-source-typeform

Example

Check out theAirbyte 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-typeform/source_typeform/spec.json.

The general shape looks like this:

{
"credentials":{
"auth_type":"Private Token",
"access_token":"<your auth token>"
},
"start_date":"<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>",
"form_ids":["<id of form to load records for>"]# if omitted, records from all forms will be loaded
}

By default all fields are stored as metadata in the documents and the text is set to an empty string. Construct the text of the document by transforming the documents returned by the reader.

from langchain_community.document_loaders.airbyteimport AirbyteTypeformLoader

config={
# your typeform configuration
}

loader= AirbyteTypeformLoader(
config=config, stream_name="forms"
)# check the documentation linked above for a list of all streams
API Reference:AirbyteTypeformLoader

Now you can load documents the usual way

docs= loader.load()

Asload returns a list, it will block until all documents are loaded. To have better control over this process, you can also use thelazy_load method which returns an iterator instead:

docs_iterator= loader.lazy_load()

Keep in mind that by default the page content is empty and the metadata object contains all the information from the record. To create documents in a different way, pass in a record_handler function when creating the loader:

from langchain_core.documentsimport Document


defhandle_record(record,id):
return Document(page_content=record.data["title"], metadata=record.data)


loader= AirbyteTypeformLoader(
config=config, record_handler=handle_record, stream_name="forms"
)
docs= loader.load()
API Reference:Document

Incremental loads

Some streams allow incremental loading, this means the source keeps track of synced records and won't load them again. This is useful for sources that have a high volume of data and are updated frequently.

To take advantage of this, store thelast_state property of the loader and pass it in when creating the loader again. This will ensure that only new records are loaded.

last_state= loader.last_state# store safely

incremental_loader= AirbyteTypeformLoader(
config=config, record_handler=handle_record, stream_name="forms", state=last_state
)

new_docs= incremental_loader.load()

Related


[8]ページ先頭

©2009-2025 Movatter.jp