{"record":{"id":"c25510b70e5a509a","repo":"apache/beam","slug":"chunk-to-dict-fn-is-deprecated-use-embeddable-to-dict-fn","errorCode":null,"errorMessage":"chunk_to_dict_fn is deprecated, use embeddable_to_dict_fn","messagePattern":"chunk_to_dict_fn is deprecated, use embeddable_to_dict_fn","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/python/apache_beam/ml/rag/ingestion/bigquery.py","lineNumber":70,"sourceCode":"    Example with custom schema:\n      >>> schema_config = SchemaConfig(\n      ...   schema={\n      ...     'fields': [\n      ...       {'name': 'id', 'type': 'STRING'},\n      ...       {'name': 'embedding', 'type': 'FLOAT64', 'mode': 'REPEATED'},\n      ...       {'name': 'source_url', 'type': 'STRING'}\n      ...     ]\n      ...   },\n      ...   embeddable_to_dict_fn=lambda item: {\n      ...       'id': item.id,\n      ...       'embedding': item.embedding.dense_embedding,\n      ...       'source_url': item.metadata.get('url')\n      ...   }\n      ... )\n    \"\"\"\n    self.schema = schema\n    if 'chunk_to_dict_fn' in kwargs:\n      warnings.warn(\n          \"chunk_to_dict_fn is deprecated, use embeddable_to_dict_fn\",\n          DeprecationWarning,\n          stacklevel=2)\n      embeddable_to_dict_fn = kwargs.pop('chunk_to_dict_fn')\n    if kwargs:\n      raise TypeError(f\"Unexpected keyword arguments: {', '.join(kwargs)}\")\n    if embeddable_to_dict_fn is None:\n      raise TypeError(\"SchemaConfig requires embeddable_to_dict_fn\")\n    self.embeddable_to_dict_fn = embeddable_to_dict_fn\n\n\nclass BigQueryVectorWriterConfig(VectorDatabaseWriteConfig):\n  def __init__(\n      self,\n      write_config: dict[str, Any],\n      *,  # Force keyword arguments\n      schema_config: Optional[SchemaConfig] = None):\n    \"\"\"Configuration for writing vectors to BigQuery using managed transforms.","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/ingestion/bigquery.py#L52-L88","documentation":"The BigQuery ingestion transform in apache_beam.ml.rag.ingestion.bigquery renamed its keyword `chunk_to_dict_fn` to `embeddable_to_dict_fn`. Passing the old keyword still works (it is mapped internally) but triggers a DeprecationWarning with stacklevel=2 pointing at the caller; any other unexpected kwargs raise TypeError.","triggerScenarios":"`ChunkToBigQuery(..., chunk_to_dict_fn=my_fn, schema=...)` — any constructor call supplying the legacy `chunk_to_dict_fn` keyword.","commonSituations":"RAG ingestion pipelines written against earlier Beam RAG APIs; copy-pasted examples predating the rename; silent behavior change after a Beam upgrade.","solutions":["Rename the keyword to `embeddable_to_dict_fn` in the constructor call.","Update shared examples/templates that still pass chunk_to_dict_fn.","Add a CI grep check to fail on `chunk_to_dict_fn=` occurrences."],"exampleFix":"// before\nChunkToBigQuery(schema=schema, chunk_to_dict_fn=fn)\n// after\nChunkToBigQuery(schema=schema, embeddable_to_dict_fn=fn)","handlingStrategy":"validation","validationCode":"if 'chunk_to_dict_fn' in kwargs:\n    raise TypeError(\"Use 'embeddable_to_dict_fn' instead of deprecated 'chunk_to_dict_fn'\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rename keyword to embeddable_to_dict_fn at call sites.","Add a CI grep for 'chunk_to_dict_fn='.","Update internal examples and templates after each Beam upgrade."],"tags":["python","deprecation","apache-beam","rag"],"backgroundTag":"deprecated-api-usage","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}