{"slug": "build-a-production-llm-integration-for-customer-support-on-gcp", "title": "Build a Production LLM Integration for Customer Support on GCP", "summary": "A developer published a guide for building a production-grade customer-support LLM integration on Google Cloud Platform, wiring Vertex AI, Cloud Storage, Dataflow, Matching Engine, Cloud Run, and Firestore into an end-to-end retrieval-augmented pipeline. The guide covers ingesting PDFs, HTML, and markdown via an Apache Beam/Dataflow pipeline with Tika-based text extraction, generating embeddings, populating a managed vector index, and deploying a stateless Cloud Run API with least-privilege IAM roles. It also details cost-control tactics, monitoring dashboards, and a production-ops checklist to keep the bot within latency and budget constraints.", "body_md": "A single mis-configured retrieval request can flood your GCP bill and return irrelevant answers, turning a promising support bot into a costly liability. An LLM integration that respects latency, cost, and data-privacy constraints is therefore the only viable path for a production-grade customer-support assistant.\n\nIn this guide you’ll build a end-to-end support bot that safely consumes your knowledge base, serves accurate answers, and stays within budget. We start with a full-stack architecture map that ties Vertex AI, Cloud Storage, and Cloud Run together. Next, you’ll assemble a scalable pipeline that crawls documents, creates vector embeddings, and populates a managed vector store. We then cover model hosting, retrieval, and a CI/CD workflow that automates model refreshes and API deployments. Finally, you’ll learn concrete cost-control tactics, monitoring dashboards, and a production-ops checklist that lets you scale the bot without surprise outages.\n\n| Service | Role in the support bot | Typical IAM role (least-privilege) | \n|---|---|---|\n| **Cloud Storage** | Stores the original knowledge-base PDFs, HTML, or markdown files. Acts as the source bucket for the ETL pipeline. | `roles/storage.objectViewer` on the bucket | \n| **Dataflow** | Executes a Beam pipeline that extracts text, cleans it, creates embeddings (via Vertex AI’s embedding model), and writes vectors to Matching Engine. Also writes the raw chunks to a Firestore collection for debugging. | `roles/dataflow.worker` ,`roles/vertexai.viewer` | \n| **Vertex AI Matching Engine** | Persistent vector index (≈ 10-100 M vectors) used for fast nearest-neighbor lookup during retrieval. | `roles/aiplatform.matchingEngineAdmin` | \n| **Vertex AI (LLM endpoint)** | Hosts the generative model (e.g., PaLM-2 or a fine-tuned T5). Provides two endpoints: `predict` for generation and`embed` for query embeddings. | `roles/aiplatform.modelViewer` ,`roles/aiplatform.endpointUser` | \n| **Cloud Run (API layer)** | Stateless HTTP front-end that receives user queries, orchestrates retrieval, calls the LLM, and returns the answer. Deployed in a fully managed VPC-connected service. | `roles/run.invoker` for internal callers,`roles/run.serviceAgent` for the service itself | \n| **Cloud SQL / Firestore** | Persists session context (e.g., last 3 user turns) and audit logs. Firestore is preferred for low-latency key-value access; Cloud SQL can host relational metadata if needed. | `roles/cloudsql.client` or`roles/datastore.user` | \n\n`dataflow-sa@project.iam.gserviceaccount.com`, `run-sa@project.iam.gserviceaccount.com`) and enforce With these pieces wired together, you have a production-grade, GCP-native stack that isolates data, scales retrieval, and serves LLM-driven answers with minimal operational friction.\n\n`gs://support-docs`) and enable `support-ingest`).\n\n``` python\nimport apache_beam as beam\nfrom apache_beam.io.gcp.pubsub import ReadFromPubSub\nfrom apache_beam.io.fileio import MatchFiles, ReadMatches\nfrom apache_beam.options.pipeline_options import PipelineOptions\n\noptions = PipelineOptions(\n    streaming=True,\n    project='my-gcp-project',\n    temp_location='gs://tmp-bucket/temp',\n    region='us-central1')\nwith beam.Pipeline(options=options) as p:\n    (p | 'ReadPubSub' >> ReadFromPubSub(topic='projects/my-gcp-project/topics/support-ingest')\n       | 'ParsePath' >> beam.Map(lambda msg: msg.decode('utf-8'))\n       | 'MatchFiles' >> MatchFiles('gs://support-docs/**')\n       | 'ReadFiles' >> ReadMatches()\n       | 'ExtractText' >> beam.ParDo(ExtractTextFn()))   # Tika-based parser\n```\n\n**Gotcha:** Beam’s default `ReadAllFromText` cannot handle binary PDFs; use Apache Tika (or `pdfminer.six`) inside a `DoFn` to pull out clean text for all three formats.\n\n`spm_unigram.model`) inside the same `DoFn`.\n\n``` python\nimport sentencepiece as spm\n\nsp = spm.SentencePieceProcessor()\nsp.Load('gs://models/spm_unigram.model')\n\ndef chunk(text, size=200, overlap=30):\n    ids = sp.EncodeAsIds(text)\n    for i in range(0, len(ids), size - overlap):\n        yield sp.DecodeIds(ids[i:i+size])\n```\n\n`projects/.../locations/us-central1/endpoints/12345`).\n`ParDo`. Batch up to 64 chunks per request to stay within latency budgets and reduce RPC overhead.\n\n``` python\nfrom google.cloud import aiplatform\n\nendpoint = aiplatform.Endpoint('12345')\ndef embed(chunk):\n    response = endpoint.predict(instances=[{'content': chunk}])\n    return response.predictions[0]['embedding']\n```\n\n| Destination | Purpose | Write method | \n|---|---|---|\n| **Vertex AI Matching Engine** | Fast nearest-neighbor lookup for support queries | `IndexServiceClient.upsert_datapoints` (batch up to 1000) | \n| **Cloud SQL (PostgreSQL)** | Auditable metadata – source file, chunk offset, processing timestamps | JDBC sink ( `beam.io.jdbc.WriteToJdbc` ) | \n\nInclude columns like `doc_id`, `chunk_index`, `embedding_id`, `ingest_ts`. Use a composite primary key (` doc_id`, `chunk_index`) so re-processing the same file simply overwrites existing rows without duplication.\n\n`.processed`). For each missing marker, it publishes the object path to \n\n```\ngcloud functions deploy trigger_ingest \\\n  --runtime python311 \\\n  --trigger-http \\\n  --entry-point run_ingest \\\n  --set-env-vars BUCKET=support-docs,TOPIC=support-ingest\n```\n\n**Key gotchas** \n\n`gs://support-docs/<path>.processed`) after successful upserts; the Cloud Function checks this flag before republishing.\n`beam.transforms.util.Reshuffle` and exponential back-off on `ResourceExhausted` errors.\n`index_v1`, `index_v2`) and keep the old index read-only for rollback.\nWith these pieces wired together, new support documents become searchable vector representations within minutes, and the pipeline scales automatically as your knowledge base grows.\n\n```\n### 1️⃣ Upload the model artifact (if you have a custom checkpoint)\ngcloud ai models upload \\\n  --region=us-central1 \\\n  --display-name=\"gemini-1.5-flash\" \\\n  --container-image-uri=\"us-docker.pkg.dev/vertex-ai/prediction/gemini-1.5-flash:latest\"\n\n### 2️⃣ Create an endpoint\ngcloud ai endpoints create \\\n  --region=us-central1 \\\n  --display-name=\"support-bot-endpoint\"\n\n### 3️⃣ Deploy with autoscaling (min=0 allows cold-start, max=5 caps cost)\ngcloud ai endpoints deploy-model us-central1 \\\n  --endpoint=SUPPORT_BOT_ENDPOINT_ID \\\n  --model=GEMINI_MODEL_ID \\\n  --display-name=\"gemini-prod\" \\\n  --machine-type=n1-standard-4 \\\n  --min-replica-count=0 \\\n  --max-replica-count=5 \\\n  --traffic-split=0=100\n```\n\n*Why min = 0?* Vertex AI spins the pod down when idle, saving compute dollars. Expect a 1-2 s warm-up on the first request after a lull; mitigate by sending a lightweight “ping” from a Cloud Scheduler job every 5 min.\n\nWhen a newer model version (e.g., a fine-tuned Gemini-Flash) is ready, you can route a fraction of traffic without redeploying the whole endpoint:\n\n```\ngcloud ai endpoints update-traffic-split us-central1 \\\n  --endpoint=SUPPORT_BOT_ENDPOINT_ID \\\n  --traffic-split=0=90,1=10   # 10 % to model version 1 (canary)\n```\n\n*Gotcha:* The split works per-request, not per-client. If you need user-level canary, embed a custom header (`X-Canary: true`) and let your front-end decide which model ID to call via the Vertex AI SDK’s `predict` method.\n\n``` python\nfrom vertexai.preview import matching_engine, language_models\n\n### 1️⃣ Initialise the Matching Engine index\nindex = matching_engine.MatchServiceClient().index_path(\n    project=\"my-project\",\n    location=\"us-central1\",\n    index=\"support-docs-index\"\n)\n\ndef retrieve_chunks(query: str, k: int = 5):\n    # Encode query with the same embedding model used for indexing\n    embed = language_models.TextEmbeddingModel.from_pretrained(\"textembedding-gecko@001\")\n    query_vec = embed.embed_text([query])[0]\n\n    # Perform ANN search\n    response = matching_engine.MatchServiceClient().find_neighbors(\n        request={\n            \"index\": index,\n            \"queries\": [{\"embedding\": query_vec, \"neighbor_count\": k}]\n        }\n    )\n    # Return raw text chunks\n    return [neighbor.datapoint.restricts[0].value for neighbor in response.neighbors[0].neighbors]\n\ndef generate_answer(question: str):\n    context = \"\\n\".join(retrieve_chunks(question))\n    prompt = f\"\"\"Context:\\n{context}\\n\\nQuestion: {question}\\nAnswer:\"\"\"\n    llm = language_models.TextGenerationModel.from_pretrained(\"gemini-1.5-flash\")\n    return llm.predict(prompt)\n```\n\nThe retrieval call runs **before** each LLM generation, ensuring the prompt stays under token limits while still grounding the answer.\n\n**OAuth2 client-ID** – Create a confidential OAuth client in Cloud Identity, then grant the `aiplatform.endpoints.predict` permission to its service account. In your API gateway (e.g., Cloud Endpoints or API Gateway), enforce `audience = <client-id>` and validate the bearer token before forwarding to the Vertex endpoint.\n\n**VPC Service Controls (VPC-SC)** – Add the Vertex AI service to the same service perimeter as your data stores. Then define an egress rule that only allows traffic to `aiplatform.googleapis.com` over private Google Access:\n\n```\ngcloud access-context-manager perimeters update my-perimeter \\\n  --add-egress-policies='{\"egressFrom\":{\"identities\":[\"serviceAccount:my-service@my-project.iam.gserviceaccount.com\"]},\"egressTo\":{\"resources\":[\"//aiplatform.googleapis.com/projects/my-project/locations/us-central1\"]}}'\n```\n\n*Gotcha:* VPC-SC blocks public internet calls; ensure your Matching Engine index resides in the same perimeter, otherwise the retrieval step will fail with a permission error.\n\nBy combining autoscaled Vertex endpoints, request-level traffic splitting, on-the-fly retrieval, and strict OAuth/VPC-SC controls, you get a production-grade LLM integration that can evolve safely while keeping costs predictable.\n\n**Connect Cloud Build to GitHub** – In the Cloud Console, create a trigger that watches the `main` and `release/*` branches. Set the trigger event to *Push to branch* and select the repository that holds both the API code and the model-artifact manifest (`model.yaml`).\n\n**Run static checks first** – The trigger invokes a Cloud Build step that runs:\n\n`pylint` (or `eslint` for Node) to enforce coding standards.`pytest --junitxml=unit.xml` to produce a machine-readable test report.`flake8` (or equivalent) for style compliance.\n**Integration test against a staging Vertex AI endpoint** – After the unit phase, Cloud Build spins up a temporary staging endpoint (`staging-support-bot`) and executes a small suite of end-to-end queries. The test harness reads the staging endpoint URL from the substitution variable `$STAGING_ENDPOINT`. If any request fails, the build aborts and no deployment proceeds.\n\n**Gotcha:** Vertex AI may take 1–2 minutes to spin up a new endpoint. Include a `retry` loop in the integration step to avoid false negatives.\n\nCloud Run supports traffic splitting, which we use for zero-downtime releases:\n\n```\n- name: 'gcr.io/cloud-builders/gcloud'\n  args:\n    - run\n    - services\n    - update\n    - support-bot-api\n    - --image=gcr.io/$PROJECT_ID/support-bot-api:$COMMIT_SHA\n    - --platform=managed\n    - --region=us-central1\n    - --no-traffic\n- name: 'gcr.io/cloud-builders/gcloud'\n  args:\n    - run\n    - services\n    - update-traffic\n    - support-bot-api\n    - --to-revisions=latest=10\n    - --platform=managed\n    - --region=us-central1\n```\n\nThe first step creates a new revision without routing traffic. The second step shifts **10 %** of live traffic to the new revision; you can increase the percentage in a follow-up manual approval step. If monitoring shows no errors, promote the revision to 100 % and retire the old one.\n\nModel updates are treated as separate artifacts stored in Artifact Registry (`model-artifacts`). After the integration tests pass, a dedicated Cloud Build step promotes the candidate model:\n\n```\n- name: 'gcr.io/cloud-builders/gcloud'\n  id: promote-model\n  waitFor: ['-']\n  args:\n    - ai\n    - models\n    - upload\n    - --region=us-central1\n    - --display-name=customer-support-v2\n    - --artifact-uri=gs://my-bucket/models/$MODEL_SHA\n- name: 'gcr.io/cloud-builders/gcloud'\n  args:\n    - ai\n    - endpoints\n    - deploy\n    - --region=us-central1\n    - --model=projects/$PROJECT_ID/locations/us-central1/models/$MODEL_SHA\n    - --endpoint=projects/$PROJECT_ID/locations/us-central1/endpoints/PROD_ENDPOINT_ID\n    - --traffic-split=100\n```\n\nThe first command registers the new model version; the second swaps the production Vertex AI endpoint to point at it. Because the endpoint is already serving traffic, the switch is instantaneous and does not disrupt existing requests.\n\n| Step | Artifact | Destination | \n|---|---|---|\n| 1️⃣ | API container image | Cloud Run (new revision) | \n| 2️⃣ | Model checkpoint ( `.tar.gz` ) | Artifact Registry | \n| 3️⃣ | Model version | Vertex AI production endpoint | \n\nBy wiring these three pieces—Git-triggered tests, blue-green Cloud Run deployments, and atomic model promotion—your support bot can iterate on both code and AI improvements without ever taking the service offline.\n\n| Token throughput (tokens / sec) | Recommended instance | Why it matters | \n|---|---|---|\n| ≤ 200 tps | **n2-standard** (CPU) | CPUs handle low-throughput inference at ~ $0.04 / hour, avoiding the $0.70 / hour GPU surcharge. | \n| 200 – 800 tps | **a2-highgpu-1** (GPU) | A single A100 delivers ~ 300 tps for 7B-parameter models; cost per token drops sharply once you cross the CPU ceiling. | \n| > 800 tps | **a2-highgpu-4** (GPU) +**autoscaling** | Multiple GPUs keep latency < 2 s while spreading the workload; you pay only for the active replicas. | \n\n**Gotcha:** Token-per-second estimates must include both prompt and completion tokens. Over-provisioning a GPU for a workload that rarely exceeds 150 tps can waste > 80 % of the budget.\n\nDeploy the endpoint with a **Vertex AI Model Deployment** that references an autoscaling policy:\n\n```\n### vertex_autoscale.yaml\nautoscaling:\n  minReplicaCount: 0            # scale to zero when idle\n  maxReplicaCount: 8\n  metric:\n    type: custom.googleapis.com/vertex_ai/throughput\n    target: 250                  # tokens per second per replica\n```\n\n`gcloud beta ai endpoints deploy-model`.` throughput`) exists by publishing a custom metric from your inference code.`minReplicaCount: 0` only if your SLA tolerates a cold-start latency of a few seconds; otherwise use `1`.\n**Pitfall:** Cloud Run-for-Containers (if you wrap the model in a container) does not support GPU scaling to zero—use Vertex AI directly.\n\nWhen you create resources (datasets, pipelines, endpoints), add a **cost tag**:\n\n```\ngcloud beta ai endpoints update ENDPOINT_ID \\\n  --update-labels=stage=embedding,pipeline=doc_ingest\n```\n\nIn the **Billing > Cost Table**, filter by `stage` or `pipeline` to see:\n\nThis granularity lets you spot a runaway cost in the retrieval layer before it balloons.\n\nCreate two alert policies:\n\n| Condition | Threshold | Notification channel | \n|---|---|---|\n| Request latency (p95) | > 2 s | Slack / PagerDuty | \n| Weekly spend increase | > 20 % vs. prior week | Email to finance lead | \n\nUse the built-in `vertex_ai_endpoint_request_latency` metric and a **budget alert** tied to the billing project.\n\n**Note:** Latency spikes often correlate with cold-starts after scaling to zero; consider a warm-up cron that sends a dummy request every 5 min.\n\n| Pattern | When to use | Trade-offs | \n|---|---|---|\n| **Scale-to-zero CPU endpoint** | Low traffic (< 200 tps) and tolerant of ~ 2 s cold start | Minimal cost, higher latency on first request | \n| **GPU burst with max-replica cap** | Variable traffic, occasional peaks > 800 tps | Predictable max spend, may queue requests during spikes | \n| **Hybrid CPU-GPU routing** | Mixed workloads: cheap text-only queries + occasional generation | Complexity in routing logic; requires separate endpoints and a request router (e.g., Cloud Functions) | \n\nPick the pattern that matches your SLA and budget horizon, then instrument the relevant metrics so you can verify the expected savings.\n\nA lightweight Cloud Scheduler job (e.g., a Cloud Function) should run every 24 h and exit with a non-zero status if any check fails. Example in Python:\n\n``` python\nimport requests, google.cloud.logging as glog, sys\nfrom google.cloud import aiplatform, storage\n\nPROJECT = \"my-gcp-project\"\nREGION  = \"us-central1\"\nENDPOINT_ID = \"1234567890123456789\"\nVECTOR_BUCKET = \"support-vectors\"\nINDEX_ID = \"matching-engine-idx\"\n\ndef check_vectors():\n    client = storage.Client()\n    blobs = list(client.list_blobs(VECTOR_BUCKET, prefix=\"2023/\"))\n    # assume daily batch creates a manifest file; its timestamp must be within 48 h\n    latest = max(b.time_created for b in blobs)\n    if (now() - latest).total_seconds() > 48*3600:\n        raise RuntimeError(\"Stale vector store\")\n\ndef check_endpoint():\n    endpoint = aiplatform.Endpoint(endpoint_name=ENDPOINT_ID, project=PROJECT, location=REGION)\n    if endpoint.state != aiplatform.gapic.Endpoint.State.READY:\n        raise RuntimeError(f\"Endpoint not ready: {endpoint.state}\")\n\ndef check_cloudrun():\n    url = \"https://support-bot-xyz.run.app/health\"\n    r = requests.get(url, timeout=5)\n    if r.status_code != 200:\n        raise RuntimeError(f\"Cloud Run health check failed: {r.status_code}\")\n\nif __name__ == \"__main__\":\n    try:\n        check_vectors()\n        check_endpoint()\n        check_cloudrun()\n    except Exception as e:\n        glog.get_logger().error(e)\n        sys.exit(1)\n    glog.get_logger().info(\"All checks passed\")\n```\n\n*Why*: Vector freshness guarantees that new FAQs are searchable; endpoint health catches model crashes; Cloud Run response codes surface routing or quota issues.\n\n*Gotchas*: Cloud Scheduler’s default retry policy may mask transient failures—set `retry_count=0` and let the script surface the error to Cloud Monitoring alerts.\n\nWhen the support bot calls the Vertex AI endpoint, throttling (HTTP 429) can cascade under load. Wrap the call with a retry library (e.g., `tenacity`) and a simple circuit-breaker:\n\n``` python\nfrom tenacity import retry, wait_exponential, stop_after_attempt, retry_if_exception_type\nimport time\n\nclass CircuitBreaker:\n    def __init__(self, failures=5, reset_sec=300):\n        self.failures, self.reset_sec = failures, reset_sec\n        self._counter, self._opened_at = 0, None\n\n    def call(self, fn, *a, **kw):\n        if self._opened_at and time.time() - self._opened_at < self._reset_sec:\n            raise RuntimeError(\"Circuit open\")\n        try:\n            return fn(*a, **kw)\n        except Exception:\n            self._counter += 1\n            if self._counter >= self.failures:\n                self._opened_at = time.time()\n            raise\n\ncb = CircuitBreaker()\n\n@retry(wait=wait_exponential(multiplier=1, min=2, max=30),\n       stop=stop_after_attempt(5),\n       retry=retry_if_exception_type(requests.exceptions.HTTPError))\ndef predict(payload):\n    return cb.call(requests.post, endpoint_url, json=payload)\n```\n\n*Why*: Exponential back-off reduces burst pressure on the endpoint; the circuit-breaker prevents endless retries that would exhaust Cloud Run CPU quotas.\n\n*Gotchas*: Do not set `max` too low; otherwise legitimate spikes get dropped. Log every circuit-open event for capacity planning.\n\n`us-central1-a` and `us-central1-b`). Use the `--replica-count=2` flag in `gcloud beta ai indexes create`.\n`prod-us`).\n`backend_service` that includes both regions) to the Cloud Run service.\n*Why*: A zone outage isolates to a single replica; the load balancer automatically routes traffic to the surviving region.\n\n*Gotchas*: Cross-region latency can surface in the vector similarity step; keep the index replicas in the same region as the serving endpoint to avoid extra network hops.\n\n| Artifact | Rollback trigger | Steps | \n|---|---|---|\n| Model version | New version degrades latency or quality | 1. Call `gcloud ai endpoints undeploy-model --endpoint=ENDPOINT_ID --deployed-model=NEW_ID` 2. Deploy the previous model ID with`gcloud ai endpoints deploy-model` | \n| API code (Cloud Run) | Health-check script reports failure after deploy | 1. `gcloud run revisions list --service=support-bot --platform=managed` 2. Identify the last known-good revision 3.`gcloud run services update-traffic --to-revisions=REVISION=100` | \n\nDocument these steps in a version-controlled ops repo, tag each rollback with the associated Git SHA, and trigger an alert on every rollback so that post-mortems are mandatory.\n\nStore document embeddings in a Matching Engine index. When a user query arrives, call the index via its REST API to retrieve the top-k vectors, fetch the corresponding raw text from Cloud Storage or Firestore, and concatenate it into a prompt. Send that prompt to your LLM hosted on Vertex AI Prediction (or a custom endpoint) and return the generated answer. The flow is: query → vector search → context fetch → LLM inference.\n\nDeploy the model on Vertex AI Serverless endpoints using custom machine types sized just enough for your token throughput, and enable GPU-based preemptible instances for batch inference. Combine this with model quantization (e.g., 8-bit) to reduce compute demand. Cache frequent retrieval results in Memorystore, and use autoscaling to spin down resources during idle periods. This balances cost and sub-second response times.\n\nYes. Configure a Cloud Build trigger on your model repository. The pipeline runs unit and integration tests, builds a Docker image (if using custom serving), and uses Terraform or gcloud commands to register the new model version in Vertex AI. After a successful canary validation, the pipeline updates traffic splitting to promote the new version to 100 % production. All steps are version-controlled and repeatable.\n\nCreate a Cloud Billing budget for the project and set alert thresholds (e.g., 50 %, 80 %, 100 %). Export detailed cost data to BigQuery daily and build a dashboard in Looker Studio that breaks spend by service (Vertex AI, Dataflow, Cloud Run). Use Cloud Monitoring to track usage metrics (requests, GPU hours) and set alerting policies that trigger Cloud Functions to throttle or pause pipelines when thresholds are approached.\n\nYou now have a concrete blueprint for a production-grade LLM-powered support bot on GCP, from data ingestion to continuous delivery and cost control. The next step is to spin up a minimal proof-of-concept using the outlined services, validate latency and accuracy, then iterate toward full rollout. If you’d like an experienced partner to accelerate this journey, [talk to Cloudesign’s engineering team](https://www.cloudesign.com/contact-us).", "url": "https://wpnews.pro/news/build-a-production-llm-integration-for-customer-support-on-gcp", "canonical_source": "https://dev.to/harshal_malaviya_3928ea9b/build-a-production-llm-integration-for-customer-support-on-gcp-4f7b", "published_at": "2026-11-24 04:30:06+00:00", "updated_at": "2026-11-24 04:42:37.020443+00:00", "lang": "en", "topics": ["large-language-models", "ai-infrastructure", "mlops", "ai-agents"], "entities": ["Google Cloud", "Vertex AI", "Cloud Run", "Cloud Storage", "Dataflow", "Apache Beam", "Apache Tika", "Firestore"], "also_reported_by": [], "takeaway": "Use Apache Tika or pdfminer.six inside a Beam DoFn to extract text from binary PDFs, since Beam's default ReadAllFromText cannot parse them, and chunk text with a SentencePiece model at 200 tokens with 30-token overlap.", "recommendation": {"advice": "Parse binary PDFs with Tika or pdfminer.six inside a Beam DoFn rather than ReadAllFromText, and chunk with SentencePiece at 200 tokens with 30-token overlap before embedding.", "playbook": "rag-retrieval", "playbook_url": "https://wpnews.pro/playbooks/rag-retrieval"}, "alternates": {"html": "https://wpnews.pro/news/build-a-production-llm-integration-for-customer-support-on-gcp", "markdown": "https://wpnews.pro/news/build-a-production-llm-integration-for-customer-support-on-gcp.md", "text": "https://wpnews.pro/news/build-a-production-llm-integration-for-customer-support-on-gcp.txt", "jsonld": "https://wpnews.pro/news/build-a-production-llm-integration-for-customer-support-on-gcp.jsonld"}}