Repository navigation
[Python] Add Vespa write config for ml.rag ingestion (prototype) - #40881
Draft
pangwangshu wants to merge 2 commits into
Draft
pangwangshu wants to merge 2 commits into
pangwangshu wants to merge 2 commits into
Conversation
Follow the updated design doc: write through requests instead of pyvespa, so no new dependency or apache-beam[vespa] extra is needed. - Rename vespa_cloud_secret_token to auth_token and "feed" to "put". - Replace the pyvespa feed knobs with max_concurrent_requests, max_retries and timeout_s. - Retry 429 with backoff (not counted), 5xx and connection errors up to max_retries; fail other errors at once with the Vespa message. - Check mTLS files exist on the worker in setup(). - Unit tests use requests_mock; the IT deploys a zipped application package without pyvespa. - Defer the CHANGES.md entry to the documentation PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #40837.
Draft prototype of
VespaWriteConfigforVectorDatabaseWriteTransform, following the design doc under discussion on dev@. It is shared so @LibenHailu and others can build on it; it is not ready for merge review until the dev@ questions are settled.What it does
EmbeddableItemto a Vespa document: id →id:<namespace>:<schema>::<id>, dense embedding → indexed tensor short form, sparse embedding → mapped tensor{"<index>": value}, content and metadata → fields (metadata_fieldsto rename/filter,fields_fnto override everything)./document/v1HTTP API withrequests(already a core dependency), so there is no new dependency and noapache-beam[vespa]extra.put→POST;update→PUT ?create=truewithassignoperations only, so bundle replays are idempotent.max_concurrent_requestsdocuments in parallel over a pooled session.max_retries; 5xx, connection errors and timeouts are retried up tomax_retries; other errors (e.g. a 400 for a field missing from the schema) fail the bundle at once with the document id and Vespa's message.cert/keyfile paths (checked on the worker insetup()) or a Vespa Cloudauth_tokensent as a bearer token.Testing
vespa_test.py: 45 unit tests (config validation, converter, HTTP behavior and retries viarequests_mock, pipeline withTestPipeline).vespa_it_test.py: 8 integration tests againstvespaengine/vespain testcontainers. They deploy a zipped application package through the config server and read documents back over/document/v1(about 45s locally). The design doc plans this for a separate PR; it is included here so collaborators can run it.The CHANGES.md entry and docs are deferred to a later PR, per the doc's rollout plan.
Open questions
From the design doc (pending on dev@):
/document/v1client (this PR) vs. pyvespa as an optional extra.Found while implementing, open for discussion:
4. 429 retries are unbounded per the doc. Should there be a total time limit per document so a constantly overloaded cluster can't hang a batch job?
5. Throughput: one HTTP/1.1 request per document. Worth benchmarking against pyvespa's feed client before settling question 1.
6. One
requests.Sessionis shared across the worker threads. This is common practice but not documented as thread-safe; one session per thread is an alternative.7. Should the Vespa server-side
timeoutquery parameter be sent alongsidetimeout_s?8.
updatekeeps fields it does not write (e.g. withcontent_field=Noneor an item without a sparse embedding), whileputclears them. Document this, or leave it as expected partial-update behavior?9. Backoff constants (0.5s initial, 30s cap) are hard-coded. Should they be configurable?
10.
auth_tokenis serialized with the pipeline, like Qdrant'sapi_key. Is there a preferred way to pass secrets to IO configs?🤖 Generated with Claude Code