Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
BigQuery ist in Document AI integriert, um die Entwicklung von Dokumentanalysen und generativen KI-Anwendungsfällen zu unterstützen. Mit der beschleunigten digitalen Transformation generieren Unternehmen riesige Mengen an Text und anderen Dokumentdaten, die ein immenses Potenzial für Erkenntnisse und neue generative KI-Anwendungsfälle bieten. Um diese Daten besser nutzen zu können, haben wir eine Integration zwischen BigQuery und Document AI entwickelt. Damit können Sie Erkenntnisse aus Dokumentdaten gewinnen und neue Anwendungen für Large Language Models (LLMs) erstellen.
Übersicht
BigQuery-Kunden können jetzt Document AI-benutzerdefinierte Extraktoren erstellen, die auf den hochmodernen Foundation Models von Google basieren und die sie anhand ihrer eigenen Dokumente und Metadaten anpassen können. Diese benutzerdefinierten Modelle können dann aus BigQuery aufgerufen werden, um strukturierte Daten aus Dokumenten auf sichere und kontrollierte Weise zu extrahieren. Dabei wird die Einfachheit und Leistungsfähigkeit von SQL genutzt.
Vor dieser Integration haben einige Kunden versucht, unabhängige Document AI-Pipelines zu erstellen, was die manuelle Zusammenstellung von Extraktionslogik und ‑schema erforderte. Da keine integrierten Integrationsfunktionen vorhanden waren, mussten sie eine maßgeschneiderte Infrastruktur entwickeln, um Daten zu synchronisieren und die Datenkonsistenz aufrechtzuerhalten. Dadurch wurde jedes Dokumentanalyseprojekt zu einem erheblichen Unterfangen, das erhebliche Investitionen erforderte.
Mit dieser Integration können Kunden jetzt Remote-Modelle in BigQuery für ihre benutzerdefinierten Extraktoren in Document AI erstellen und damit Dokumentanalysen und generative KI im großen Maßstab durchführen. Das eröffnet eine neue Ära datengestützter Erkenntnisse und Innovationen.
Einheitliche, geregelte Daten-zu-KI-Lösung
Sie können einen benutzerdefinierten Extraktor in Document AI in drei Schritten erstellen:
Definieren Sie die Daten, die Sie aus Ihren Dokumenten extrahieren möchten. Das wird als document schema bezeichnet und mit jeder Version des benutzerdefinierten Extraktors gespeichert. Es ist über BigQuery zugänglich.
Sie können optional zusätzliche Dokumente mit Anmerkungen als Beispiele für die Extraktion bereitstellen.
Trainieren Sie das Modell für den benutzerdefinierten Extraktor auf der Grundlage der in Document AI bereitgestellten Foundation Models.
Neben benutzerdefinierten Extraktoren, die manuelles Training erfordern, bietet Document AI in der Prozessorgalerie auch sofort einsatzbereite Extraktoren für Ausgaben, Belege, Rechnungen, Steuerformulare, amtliche Ausweise und viele andere Szenarien.
Sobald Sie den benutzerdefinierten Extraktor erstellt haben, können Sie in BigQuery Studio die Dokumente mit SQL analysieren. Gehen Sie dazu so vor:
Registrieren Sie ein BigQuery-Remote-Modell für den Extractor mit SQL. Das Modell kann das oben erstellte Dokumentschema verstehen, den benutzerdefinierten Extraktor aufrufen und die Ergebnisse parsen.
Objekttabellen mit SQL für die in Cloud Storage gespeicherten Dokumente erstellen Sie können die unstrukturierten Daten in den Tabellen verwalten, indem Sie Zugriffsrichtlinien auf Zeilenebene festlegen. Dadurch wird der Zugriff von Nutzern auf bestimmte Dokumente eingeschränkt und die KI-Leistung für Datenschutz und Sicherheit wird begrenzt.
Verwenden Sie die Funktion ML.PROCESS_DOCUMENT in der Objekttabelle, um relevante Felder zu extrahieren, indem Sie Inferenzaufrufe an den API-Endpunkt senden. Sie können die Dokumente für die Extraktionen auch mit einer WHERE-Klausel außerhalb der Funktion herausfiltern.
Die Funktion gibt eine strukturierte Tabelle zurück, wobei jede Spalte ein extrahiertes Feld ist.
Führen Sie die extrahierten Daten mit anderen BigQuery-Tabellen zusammen, um strukturierte und unstrukturierte Daten zu kombinieren und so einen geschäftlichen Mehrwert zu schaffen.
Das folgende Beispiel veranschaulicht die Nutzererfahrung:
# Create an object table in BigQuery that maps to the document files stored in Cloud Storage.CREATEORREPLACEEXTERNALTABLE`my_dataset.document`WITHCONNECTION`my_project.us.example_connection`OPTIONS(object_metadata='SIMPLE',uris=['gs://my_bucket/path/*'],metadata_cache_mode='AUTOMATIC',max_staleness=INTERVAL1HOUR);# Create a remote model to register your Doc AI processor in BigQuery.CREATEORREPLACEMODEL`my_dataset.layout_parser`REMOTEWITHCONNECTION`my_project.us.example_connection`OPTIONS(remote_service_type='CLOUD_AI_DOCUMENT_V1',document_processor='PROCESSOR_ID');# Invoke the registered model over the object table to parse PDF documentSELECTuri,total_amount,invoice_dateFROMML.PROCESS_DOCUMENT(MODEL`my_dataset.layout_parser`,TABLE`my_dataset.document`,PROCESS_OPTIONS=> (JSON'{"layout_config": {"chunking_config": {"chunk_size": 250}}}'))WHEREcontent_type='application/pdf';
Ergebnistabelle
Textanalyse, Zusammenfassung und andere Anwendungsfälle für die Dokumentanalyse
Nachdem Sie Text aus Ihren Dokumenten extrahiert haben, können Sie die Dokumente auf verschiedene Arten analysieren:
BigQuery ML für die Textanalyse verwenden: BigQuery ML unterstützt das Trainieren und Bereitstellen von Einbettungsmodellen auf verschiedene Arten. Mit BigQuery ML können Sie beispielsweise die Stimmung von Kunden bei Supportanrufen ermitteln oder Produktfeedback in verschiedene Kategorien einteilen. Wenn Sie Python verwenden, können Sie auch BigQuery DataFrames für pandas und scikit-learn-ähnliche APIs für die Textanalyse Ihrer Daten verwenden.
Mit dem text-embedding-004-LLM Einbettungen aus den in Chunks aufgeteilten Dokumenten generieren: BigQuery hat eine ML.GENERATE_EMBEDDING-Funktion, mit der das text-embedding-004-Modell aufgerufen wird, um Einbettungen zu generieren. Sie können beispielsweise Document AI verwenden, um Kundenfeedback zu extrahieren, und das Feedback mit PaLM 2 zusammenfassen lassen – alles mit BigQuery SQL.
Dokumentmetadaten mit anderen strukturierten Daten in BigQuery-Tabellen zusammenführen:
Sie können beispielsweise Einbettungen mit den in Chunks aufgeteilten Dokumenten generieren und für die Vektorsuche verwenden.
# Example 1: Parse the chunked dataCREATEORREPLACETABLEdocai_demo.demo_result_parsedAS(SELECTuri,JSON_EXTRACT_SCALAR(json,'$.chunkId')ASid,JSON_EXTRACT_SCALAR(json,'$.content')AScontent,JSON_EXTRACT_SCALAR(json,'$.pageFooters[0].text')ASpage_footers_text,JSON_EXTRACT_SCALAR(json,'$.pageSpan.pageStart')ASpage_span_start,JSON_EXTRACT_SCALAR(json,'$.pageSpan.pageEnd')ASpage_span_endFROMdocai_demo.demo_result,UNNEST(JSON_EXTRACT_ARRAY(ml_process_document_result.chunkedDocument.chunks,'$'))json)# Example 2: Generate embeddingCREATEORREPLACETABLE`docai_demo.embeddings`ASSELECT*FROMML.GENERATE_EMBEDDING(MODEL`docai_demo.embedding_model`,TABLE`docai_demo.demo_result_parsed`);
Anwendungsfälle für Suche und generative KI implementieren
Nachdem Sie strukturierten Text aus Ihren Dokumenten extrahiert haben, können Sie mithilfe der Such- und Indexierungsfunktionen von BigQuery Indizes erstellen, die für „Nadel im Heuhaufen“-Abfragen optimiert sind.
Diese Integration ermöglicht auch neue generative LLM-Anwendungen wie die Ausführung der Verarbeitung von Textdateien für Datenschutzfilterung, Inhaltsüberprüfung und Token-Chunking mit SQL und benutzerdefinierten Document AI-Modellen. Der extrahierte Text in Kombination mit anderen Metadaten vereinfacht die Zusammenstellung des Trainingskorpus, der zum Feinabstimmen von Large Language Models erforderlich ist. Außerdem erstellen Sie LLM-Anwendungsfälle auf Grundlage von verwalteten Unternehmensdaten, die durch die Funktionen von BigQuery zur Generierung von Einbettungen und zur Verwaltung von Vektorindexen fundiert sind. Wenn Sie diesen Index mit Vertex AI synchronisieren, können Sie RAG-Anwendungsfälle (Retrieval Augmented Generation) implementieren und so eine besser verwaltete und optimierte KI-Umgebung schaffen.
Beispielanwendung
Beispiel für eine End-to-End-Anwendung mit dem Document AI Connector:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eBigQuery now integrates with Document AI, enabling users to extract insights from document data and create new large language model (LLM) applications.\u003c/p\u003e\n"],["\u003cp\u003eCustomers can create custom extractors in Document AI, powered by Google's foundation models, and then invoke these models from BigQuery to extract structured data using SQL.\u003c/p\u003e\n"],["\u003cp\u003eThis integration simplifies document analytics projects by eliminating the need for manually building extraction logic and schemas, thus reducing the investment needed.\u003c/p\u003e\n"],["\u003cp\u003eBigQuery's \u003ccode\u003eML.PROCESS_DOCUMENT\u003c/code\u003e function, along with remote models, object tables, and SQL, facilitates the extraction of relevant fields from documents and the combination of this data with other structured data.\u003c/p\u003e\n"],["\u003cp\u003ePost-extraction, BigQuery ML and the \u003ccode\u003etext-embedding-004\u003c/code\u003e model can be leveraged for text analytics, generating embeddings, and building indexes for advanced search and generative AI applications.\u003c/p\u003e\n"]]],[],null,["# BigQuery integration\n====================\n\nBigQuery integrates with Document AI to help build document analytics and generative AI\nuse cases. As digital transformation accelerates, organizations are generating vast\namounts of text and other document data, all of which holds immense potential for\ninsights and powering novel generative AI use cases. To help harness this data,\nwe're excited to announce an integration between [BigQuery](/bigquery)\nand [Document AI](/document-ai), letting you extract insights from document data and build\nnew large language model (LLM) applications.\n\nOverview\n--------\n\nBigQuery customers can now create Document AI [custom extractors](/blog/products/ai-machine-learning/document-ai-workbench-custom-extractor-and-summarizer), powered by Google's\ncutting-edge foundation models, which they can customize based on their own documents\nand metadata. These customized models can then be invoked from BigQuery to\nextract structured data from documents in a secure, governed manner, using the\nsimplicity and power of SQL.\nPrior to this integration, some customers tried to construct independent Document AI\npipelines, which involved manually curating extraction logic and schema. The\nlack of built-in integration capabilities left them to develop bespoke infrastructure\nto synchronize and maintain data consistency. This turned each document analytics\nproject into a substantial undertaking that required significant investment.\nNow, with this integration, customers can create remote models in BigQuery\nfor their custom extractors in Document AI, and use them to perform document analytics\nand generative AI at scale, unlocking a new era of data-driven insights and innovation.\n\nA unified, governed data to AI experience\n-----------------------------------------\n\nYou can build a custom extractor in the Document AI with three steps:\n\n1. Define the data you need to extract from your documents. This is called `document schema`, stored with each version of the custom extractor, accessible from BigQuery.\n2. Optionally, provide extra documents with annotations as samples of the extraction.\n3. Train the model for the custom extractor, based on the foundation models provided in Document AI.\n\nIn addition to custom extractors that require manual training, Document AI also\nprovides ready to use extractors for expenses, receipts, invoices, tax forms,\ngovernment ids, and a multitude of other scenarios, in the processor gallery.\n\nThen, once you have the custom extractor ready, you can move to BigQuery Studio\nto analyze the documents using SQL in the following four steps:\n\n1. Register a BigQuery remote model for the extractor using SQL. The model can understand the document schema (created above), invoke the custom extractor, and parse the results.\n2. Create object tables using SQL for the documents stored in Cloud Storage. You can govern the unstructured data in the tables by setting row-level access policies, which limits users' access to certain documents and thus restricts the AI power for privacy and security.\n3. Use the function `ML.PROCESS_DOCUMENT` on the object table to extract relevant fields by making inference calls to the API endpoint. You can also filter out the documents for the extractions with a `WHERE` clause outside of the function. The function returns a structured table, with each column being an extracted field.\n4. Join the extracted data with other BigQuery tables to combine structured and unstructured data, producing business values.\n\nThe following example illustrates the user experience:\n\n # Create an object table in BigQuery that maps to the document files stored in Cloud Storage.\n CREATE OR REPLACE EXTERNAL TABLE `my_dataset.document`\n WITH CONNECTION `my_project.us.example_connection`\n OPTIONS (\n object_metadata = 'SIMPLE',\n uris = ['gs://my_bucket/path/*'],\n metadata_cache_mode= 'AUTOMATIC',\n max_staleness= INTERVAL 1 HOUR\n );\n\n # Create a remote model to register your Doc AI processor in BigQuery.\n CREATE OR REPLACE MODEL `my_dataset.layout_parser`\n REMOTE WITH CONNECTION `my_project.us.example_connection`\n OPTIONS (\n remote_service_type = 'CLOUD_AI_DOCUMENT_V1', \n document_processor='\u003cvar translate=\"no\"\u003ePROCESSOR_ID\u003c/var\u003e'\n );\n\n # Invoke the registered model over the object table to parse PDF document\n SELECT uri, total_amount, invoice_date\n FROM ML.PROCESS_DOCUMENT(\n MODEL `my_dataset.layout_parser`,\n TABLE `my_dataset.document`,\n PROCESS_OPTIONS =\u003e (\n JSON '{\"layout_config\": {\"chunking_config\": {\"chunk_size\": 250}}}')\n )\n WHERE content_type = 'application/pdf';\n\nTable of results\n\nText analytics, summarization and other document analysis use cases\n-------------------------------------------------------------------\n\nOnce you have extracted text from your documents, you can then perform document\nanalytics in a few ways:\n\n- Use BigQuery ML to perform text-analytics: BigQuery ML supports training and deploying embedding models in a variety of ways. For example, you can use BigQuery ML to identify customer sentiment in support calls, or to classify product feedback into different categories. If you are a Python user, you can also use BigQuery DataFrames for pandas, and scikit-learn-like APIs for text analysis on your data.\n- Use `text-embedding-004` LLM to generate embeddings from the chunked documents: BigQuery has a `ML.GENERATE_EMBEDDING` function that calls the `text-embedding-004` model to generate embeddings. For example, you can use a Document AI to extract customer feedback and summarize the feedback using PaLM 2, all with BigQuery SQL.\n- Join document metadata with other structured data stored in BigQuery tables:\n\nFor example, you can generate embeddings using the chunked documents and use it for vector search. \n\n # Example 1: Parse the chunked data\n\n CREATE OR REPLACE TABLE docai_demo.demo_result_parsed AS (SELECT\n uri,\n JSON_EXTRACT_SCALAR(json , '$.chunkId') AS id,\n JSON_EXTRACT_SCALAR(json , '$.content') AS content,\n JSON_EXTRACT_SCALAR(json , '$.pageFooters[0].text') AS page_footers_text,\n JSON_EXTRACT_SCALAR(json , '$.pageSpan.pageStart') AS page_span_start,\n JSON_EXTRACT_SCALAR(json , '$.pageSpan.pageEnd') AS page_span_end\n FROM docai_demo.demo_result, UNNEST(JSON_EXTRACT_ARRAY(ml_process_document_result.chunkedDocument.chunks, '$')) json)\n\n # Example 2: Generate embedding\n\n CREATE OR REPLACE TABLE `docai_demo.embeddings` AS\n SELECT * FROM ML.GENERATE_EMBEDDING(\n MODEL `docai_demo.embedding_model`,\n TABLE `docai_demo.demo_result_parsed`\n );\n\nImplement search and generative AI use cases\n--------------------------------------------\n\nOnce you've extracted structured text from your documents, you can build indexes\noptimized for needle in the haystack queries, made possible by BigQuery's search\nand indexing capabilities, unlocking powerful search capability.\nThis integration also helps unlock new generative LLM applications like executing\ntext-file processing for privacy filtering, content safety checks, and token chunking\nusing SQL and custom Document AI models. The extracted text, combined with other metadata,\nsimplifies the curation of the training corpus required to fine-tune large language\nmodels. Moreover, you're building LLM use cases on governed, enterprise data\nthat's been grounded through BigQuery's embedding generation and vector index\nmanagement capabilities. By synchronizing this index with Vertex AI, you can\nimplement retrieval-augmented generation use cases, for a more governed and\nstreamlined AI experience.\n\nSample application\n------------------\n\nFor an example of an end-to-end application using the Document AI Connector:\n\n- Refer to this expense report demo on [GitHub](https://github.com/GoogleCloudPlatform/smart-expenses).\n- Read the companion [blog post](/blog/topics/developers-practitioners/smarter-applications-document-ai-workflows-and-cloud-functions).\n- Watch a deep dive [video](https://www.youtube.com/watch?v=Bnac6JnBGQg&t=1s) from Google Cloud Next 2021."]]