@pleaseai/context-please-core 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +39 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/context.d.ts +25 -0
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/context.js +74 -0
  6. package/dist/context.js.map +1 -1
  7. package/dist/embedding/base-embedding.d.ts.map +1 -1
  8. package/dist/embedding/base-embedding.js +4 -0
  9. package/dist/embedding/base-embedding.js.map +1 -1
  10. package/dist/embedding/gemini-embedding.d.ts +41 -0
  11. package/dist/embedding/gemini-embedding.d.ts.map +1 -1
  12. package/dist/embedding/gemini-embedding.js +154 -25
  13. package/dist/embedding/gemini-embedding.js.map +1 -1
  14. package/dist/embedding/huggingface-embedding.d.ts +70 -0
  15. package/dist/embedding/huggingface-embedding.d.ts.map +1 -0
  16. package/dist/embedding/huggingface-embedding.js +270 -0
  17. package/dist/embedding/huggingface-embedding.js.map +1 -0
  18. package/dist/embedding/index.d.ts +1 -0
  19. package/dist/embedding/index.d.ts.map +1 -1
  20. package/dist/embedding/index.js +1 -0
  21. package/dist/embedding/index.js.map +1 -1
  22. package/dist/splitter/ast-splitter.d.ts.map +1 -1
  23. package/dist/splitter/ast-splitter.js.map +1 -1
  24. package/dist/vectordb/factory.d.ts +20 -1
  25. package/dist/vectordb/factory.d.ts.map +1 -1
  26. package/dist/vectordb/factory.js +67 -1
  27. package/dist/vectordb/factory.js.map +1 -1
  28. package/dist/vectordb/faiss-vectordb.d.ts +162 -0
  29. package/dist/vectordb/faiss-vectordb.d.ts.map +1 -0
  30. package/dist/vectordb/faiss-vectordb.js +762 -0
  31. package/dist/vectordb/faiss-vectordb.js.map +1 -0
  32. package/dist/vectordb/index.d.ts +1 -0
  33. package/dist/vectordb/index.d.ts.map +1 -1
  34. package/dist/vectordb/index.js +20 -1
  35. package/dist/vectordb/index.js.map +1 -1
  36. package/dist/vectordb/sparse/simple-bm25.d.ts +1 -0
  37. package/dist/vectordb/sparse/simple-bm25.d.ts.map +1 -1
  38. package/dist/vectordb/sparse/simple-bm25.js +1 -3
  39. package/dist/vectordb/sparse/simple-bm25.js.map +1 -1
  40. package/package.json +18 -16
  41. package/LICENSE +0 -24
package/README.md CHANGED
@@ -238,6 +238,45 @@ const context = new Context({
238
238
  })
239
239
  ```
240
240
 
241
+ ### Using Gemini Embeddings with Retry Configuration
242
+
243
+ ```typescript
244
+ import { Context, MilvusVectorDatabase, GeminiEmbedding } from '@pleaseai/context-please-core'
245
+
246
+ // Initialize with Gemini embedding provider
247
+ const embedding = new GeminiEmbedding({
248
+ apiKey: process.env.GEMINI_API_KEY || 'your-gemini-api-key',
249
+ model: 'gemini-embedding-001',
250
+ outputDimensionality: 768, // Optional: Matryoshka Representation Learning support (256, 768, 1536, 3072)
251
+ maxRetries: 3, // Optional: Maximum retry attempts (default: 3)
252
+ baseDelay: 1000 // Optional: Base delay in ms for exponential backoff (default: 1000ms)
253
+ })
254
+
255
+ const vectorDatabase = new MilvusVectorDatabase({
256
+ address: process.env.MILVUS_ADDRESS || 'localhost:19530',
257
+ token: process.env.MILVUS_TOKEN || ''
258
+ })
259
+
260
+ const context = new Context({
261
+ embedding,
262
+ vectorDatabase
263
+ })
264
+
265
+ // The retry mechanism automatically handles:
266
+ // - Rate limit errors (429)
267
+ // - Server errors (500, 502, 503, 504)
268
+ // - Network errors (ECONNREFUSED, ETIMEDOUT, ENOTFOUND, EAI_AGAIN)
269
+ // - Transient API failures with exponential backoff (1s → 2s → 4s → 8s, capped at 10s)
270
+
271
+ // Update retry configuration at runtime
272
+ embedding.setMaxRetries(5)
273
+ embedding.setBaseDelay(2000)
274
+
275
+ // Check current retry configuration
276
+ const retryConfig = embedding.getRetryConfig()
277
+ console.log(`Max retries: ${retryConfig.maxRetries}, Base delay: ${retryConfig.baseDelay}ms`)
278
+ ```
279
+
241
280
  ### Custom File Filtering
242
281
 
243
282
  ```typescript