feat(data-warehouse): implement together_ai import source - #70011
Conversation
|
Hey @Gilbert09! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
|
Reviews (1): Last reviewed commit: "feat(data-warehouse): implement together..." | Re-trigger Greptile |
estefaniarabadan
left a comment
There was a problem hiding this comment.
Isolated new data-warehouse source scaffold — self-contained under its own source directory with only the expected shared-registry additions (SOURCES.md, generated_configs.py, icon), tests included, CI green. Reviewed as part of a batch. LGTM 👍
This PR appears superseded by #69608 — needs a human call before I can proceedWhile taking this PR to a clean, mergeable state I found that the
The two implementations are functionally equivalent, near-complete rewrites of each other, covering the same endpoints ( There's no conflict resolution that "preserves both sides" here:
The only content unique to this PR is a temporary in-repo doc, I've stopped rather than guess, since each path is destructive and this is a product/ownership decision. My recommendation is to close this PR as superseded by #69608. Alternatively, if there's anything in this version worth keeping (e.g. the docs), let me know and I'll rebase so the PR's only diff is that net-new content on top of master. 🦉 via talyn.dev |
Correction + concrete deltas vs the shipped #69608Following up on my earlier "superseded by #69608" note: I said the two implementations were "functionally equivalent." On a closer file-by-file diff that's not accurate — they differ in ways that matter, and a couple look like they could be latent issues in the version that shipped to
Two of these are worth verifying regardless of which PR wins, because if this PR is right they're bugs in the already-merged source:
The retry-layering change ( Recommendation unchanged: master's #69608 is the canonical shipped implementation, so this PR should most likely be closed as superseded — but if the two differences above check out, please port them onto master separately. If you'd instead like me to (a) rebase this PR down to only those corrections on top of master as a small focused-fix diff, or (b) overwrite master with this PR's version, just say which and I'll proceed. 🦉 via talyn.dev |
Fill in the scaffolded Together AI source: fine-tunes, batches, files, endpoints, evaluations, and the model catalog, synced via Bearer API-key auth through the tracked HTTP transport. All endpoints are full refresh (no pagination or server-side timestamp filter). Ships behind unreleasedSource with alpha release status. Generated-By: PostHog Code Task-Id: b299a7f7-7e63-4232-9743-569183792782
Treat a missing wrapper key as a response-shape fault instead of defaulting to an empty collection: these tables sync with full refresh, so a changed API shape silently reduced to `[]` would wipe previously synced rows. Disable the tracked session's built-in urllib3 retry layer (`Retry(total=0)`) so tenacity is the single backoff layer. Previously 429/5xx were retried at both the urllib3 and tenacity layers, multiplying requests against a rate-limited endpoint. Generated-By: PostHog Code Task-Id: 49ca5420-b722-483e-96a5-c51638676980
6d36912 to
467b697
Compare
…defaults Generated-By: PostHog Code Task-Id: 19cb6c2f-4ba4-4c08-be77-d3efde75137b
|
Heads-up on how I resolved the merge conflict here, because it turned out to be more than a mechanical fix. The
To avoid regressing
Net diff is now just those two files, cleanly on top of 🦉 via talyn.dev |
…ippets Generated-By: PostHog Code Task-Id: 19cb6c2f-4ba4-4c08-be77-d3efde75137b
Problem
Together AI was scaffolded as a warehouse source but had no sync logic - the stub had empty fields and did nothing. Together AI is an AI-native cloud for open-source model inference and fine-tuning, and it exposes queryable historical entities (fine-tuning jobs, batch inference jobs, files, deployed endpoints, evaluations) that are useful to join against product data in the warehouse.
Changes
This fills in the stub end-to-end following the
implementing-warehouse-sourcesskill'ssource.py/settings.py/together_ai.pysplit.Endpoints synced (all
GET /v1/<resource>with Bearer API-key auth):fine_tunes/fine-tunesid{"data": [...]}batches/batchesidfiles/filesidcreated_atis a Unix int, so unpartitionedendpoints/endpointsidevaluations/evaluationworkflow_idworkflow_id, notidmodels/modelsidKey decisions:
SimpleSource, full refresh only. No Together AI list endpoint exposes pagination or a server-side "updated since" filter, so incremental would re-fetch the whole collection every sync anyway. Collections are small per account, so a single full fetch per table is cheap. This matches the API research and keeps the source simple (no resume state to persist).{"data": [...]}, others return a bare top-level array.settings.pycarries a per-endpointdata_keyand the transport unwraps accordingly. A shape mismatch raisesValueErrorto bypass the retry budget (permanent contract violation).created_atonly where the field is an ISO-8601 datetime.files.created_atandmodels.createdare integer Unix timestamps the datetime partitioner can't parse, so those tables are unpartitioned. Never partition on a churning field.make_tracked_session()with the bearer token inredact_values.get_non_retryable_errors()fails fast on 401/403 (a bad key can't be fixed by retrying).lists_tables_without_credentials = Truesinceget_schemasis a static catalog, so the public docs render the Supported tables section.Kept behind
unreleasedSource=TruewithreleaseStatus=ALPHAper the task scope.Note
API behavior (response shapes, absence of pagination/timestamp filters,
evaluationskeying onworkflow_id) was verified against the current public Together AI API reference docs. It was not curl-verified against the live API - I don't have a Together AI API key in this environment. The parsing is conservative (explicit shape checks, unexpected shapes raise rather than silently drop rows), and the uncertainty is noted in code comments.How did you test this code?
Automated tests only (I did not run against the live Together AI API). Two new test modules, run with pytest:
tests/test_together_ai_source.py- source type, config (alpha + unreleased, category, docsUrl), fields, schema listing (full refresh,workflow_idkey for evaluations,modelsoff by default),validate_credentialsmapping and per-endpoint path probing,source_for_pipelinearg plumbing, non-retryable error matching, canonical descriptions coverage.tests/test_together_ai.py- URL building,data_keyunwrap vs bare-array parsing, retryable (429/5xx) vs non-retryable (4xx) status handling, unexpected-shapeValueError, credential validation, single-request full-collection fetch, and per-endpointSourceResponsepartition shape.All 47 new tests pass. The existing
test_source_categoriesandtest_source_config_generatorsuites (1521 tests) also pass, which confirms the category is set and the hand-writtengenerated_configs.pyentry matches generator output exactly.Note
Two things could not be completed in this environment and need follow-up:
pnpm run generate:source-configsandpnpm run schema:buildneed a booting Django app (DB connection), which isn't available here. I hand-editedTogetherAISourceConfigingenerated_configs.pytoapi_key: str- the exact output the generator produces for a single required password field, and the config-generator test passing (regenerate-and-compare) confirms it matches. No enum/schema migration was needed (the enum value already exists on master).frontend/public/services/together_ai.svgexists yet. Fetching a logo needs a Logo.dev key I don't have, so I did not commit a placeholder.iconPathstill points attogether_ai.png; the icon needs to be added before release. The source is hidden (unreleasedSource=True) so this doesn't affect users yet.documenting-warehouse-sourcesbut lives at.../together_ai/docs/together-ai.mdxin this repo since no posthog.com checkout was available. It needs to move toposthog.com/contents/docs/cdp/sources/together-ai.mdx, after whichaudit_source_docsshould be run.Automatic notifications
Docs update
🤖 Agent context
Autonomy: Fully autonomous
Implemented by Claude (Opus 4.8) via PostHog Code. Skills invoked:
/implementing-warehouse-sources(architecture contract, base-class choice, tracked transport, incremental rules) and/documenting-warehouse-sources(doc template + slug rule).Reference sources studied:
bluetally(closest analog - SimpleSource-shaped REST source with a static catalog and both test modules) andklaviyo. Together AI's API was researched from the current public reference docs to confirm each endpoint's response shape and the absence of pagination/timestamp filters.ResumableSourcewas considered and rejected: with no cursor or page token to persist, there is nothing to resume, soSimpleSourceis correct.modelswas set off-by-default because it's a large global catalog identical for every account rather than account-specific data.Created with PostHog Code