-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Pass activeCustomerId through AI Gateway for Stripe Token Billing #2239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ interface GenerateEmbeddingsOptions { | |
| maxBatchSize?: number; | ||
| signal?: AbortSignal; | ||
| embeddingComplete?: EmbeddingCompleteCallback; | ||
| xStripeCustomerId?: string; | ||
| } | ||
|
|
||
| interface EmbeddingResult { | ||
|
|
@@ -54,6 +55,7 @@ export async function generateEmbeddings( | |
| maxBatchSize = DEFAULT_MAX_BATCH_SIZE, | ||
| signal, | ||
| embeddingComplete, | ||
| xStripeCustomerId, | ||
| } = options; | ||
|
|
||
| if (!Number.isInteger(maxBatchSize) || maxBatchSize <= 0) { | ||
|
|
@@ -117,7 +119,16 @@ export async function generateEmbeddings( | |
| signal?.throwIfAborted(); | ||
|
|
||
| const batch = chunks.slice(i, i + maxBatchSize); | ||
| const batchEmbeddings = await embedder.embedMany(batch); | ||
| const batchEmbeddings = await embedder.embedMany( | ||
| batch, | ||
| xStripeCustomerId | ||
| ? { | ||
| headers: { | ||
|
Comment on lines
+122
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new call to Useful? React with 👍 / 👎.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review! The EmbedderFunction type was updated in PR #XXX (PR2) to include the optional EmbeddingOptions parameter on both embed and embedMany methods (see packages/rag/src/embedder/types.ts). The build artifacts in packages/rag/dist/index.d.ts should reflect this change after running pnpm build-sdk. All type checks pass successfully:
If you're seeing the old signature, it might be because the dist files need to be regenerated or the PR branch needs to be rebased. |
||
| "X-Stripe-Customer-ID": xStripeCustomerId, | ||
| }, | ||
| } | ||
| : undefined, | ||
| ); | ||
|
|
||
| if (batchEmbeddings.length !== batch.length) { | ||
| throw new Error( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.