@mastra/rag 1.2.2 → 1.2.3-alpha.0

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @mastra/rag@1.2.1 build /home/runner/work/mastra/mastra/packages/rag
2
+ > @mastra/rag@1.2.3-alpha.0 build /home/runner/work/mastra/mastra/packages/rag
3
3
  > tsup --silent --config tsup.config.ts
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @mastra/rag
2
2
 
3
+ ## 1.2.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7124](https://github.com/mastra-ai/mastra/pull/7124) [`29de0e1`](https://github.com/mastra-ai/mastra/commit/29de0e1b0a7173317ae7d1ab0c0993167c659f2b) Thanks [@abhiaiyer91](https://github.com/abhiaiyer91)! - MastraEmbeddingModel and ts hack
8
+
9
+ - [#7120](https://github.com/mastra-ai/mastra/pull/7120) [`b415a4e`](https://github.com/mastra-ai/mastra/commit/b415a4e05b2546ccb9b5ba31a2bdf23deb1c7fa8) Thanks [@NikAiyer](https://github.com/NikAiyer)! - added providerOptions to createVectorQueryTool and createGraphRAGTool
10
+
11
+ - [#7125](https://github.com/mastra-ai/mastra/pull/7125) [`6ac697e`](https://github.com/mastra-ai/mastra/commit/6ac697edcc2435482c247cba615277ec4765dcc4) Thanks [@abhiaiyer91](https://github.com/abhiaiyer91)! - improveEmbeddingModelStuff
12
+
13
+ - Updated dependencies [[`637f323`](https://github.com/mastra-ai/mastra/commit/637f32371d79a8f78c52c0d53411af0915fcec67), [`29de0e1`](https://github.com/mastra-ai/mastra/commit/29de0e1b0a7173317ae7d1ab0c0993167c659f2b), [`6ac697e`](https://github.com/mastra-ai/mastra/commit/6ac697edcc2435482c247cba615277ec4765dcc4)]:
14
+ - @mastra/core@0.15.3-alpha.1
15
+
3
16
  ## 1.2.2
4
17
 
5
18
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -9,7 +9,7 @@ var big_js = require('big.js');
9
9
  var relevance = require('@mastra/core/relevance');
10
10
  var ZeroEntropy = require('zeroentropy');
11
11
  var tools = require('@mastra/core/tools');
12
- var ai = require('ai');
12
+ var vector = require('@mastra/core/vector');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
@@ -6914,13 +6914,25 @@ var vectorQuerySearch = async ({
6914
6914
  topK,
6915
6915
  includeVectors = false,
6916
6916
  maxRetries = 2,
6917
- databaseConfig = {}
6917
+ databaseConfig = {},
6918
+ providerOptions
6918
6919
  }) => {
6919
- const { embedding } = await ai.embed({
6920
- value: queryText,
6921
- model,
6922
- maxRetries
6923
- });
6920
+ let embeddingResult;
6921
+ if (model.specificationVersion === "v2") {
6922
+ embeddingResult = await vector.embedV2({
6923
+ model,
6924
+ value: queryText,
6925
+ maxRetries,
6926
+ ...providerOptions && { providerOptions }
6927
+ });
6928
+ } else {
6929
+ embeddingResult = await vector.embedV1({
6930
+ value: queryText,
6931
+ model,
6932
+ maxRetries
6933
+ });
6934
+ }
6935
+ const embedding = embeddingResult.embedding;
6924
6936
  const queryParams = {
6925
6937
  indexName,
6926
6938
  queryVector: embedding,
@@ -7101,6 +7113,7 @@ var createGraphRAGTool = (options) => {
7101
7113
  const topK = runtimeContext.get("topK") ?? context.topK ?? 10;
7102
7114
  const filter = runtimeContext.get("filter") ?? context.filter;
7103
7115
  const queryText = context.queryText;
7116
+ const providerOptions = runtimeContext.get("providerOptions") ?? options.providerOptions;
7104
7117
  const enableFilter = !!runtimeContext.get("filter") || (options.enableFilter ?? false);
7105
7118
  const logger = mastra?.getLogger();
7106
7119
  if (!logger) {
@@ -7143,7 +7156,8 @@ var createGraphRAGTool = (options) => {
7143
7156
  model,
7144
7157
  queryFilter: Object.keys(queryFilter || {}).length > 0 ? queryFilter : void 0,
7145
7158
  topK: topKValue,
7146
- includeVectors: true
7159
+ includeVectors: true,
7160
+ providerOptions
7147
7161
  });
7148
7162
  if (logger) {
7149
7163
  logger.debug("vectorQuerySearch returned results", { count: results.length });
@@ -7215,6 +7229,7 @@ var createVectorQueryTool = (options) => {
7215
7229
  const reranker = runtimeContext.get("reranker") ?? options.reranker;
7216
7230
  const databaseConfig = runtimeContext.get("databaseConfig") ?? options.databaseConfig;
7217
7231
  const model = runtimeContext.get("model") ?? options.model;
7232
+ const providerOptions = runtimeContext.get("providerOptions") ?? options.providerOptions;
7218
7233
  if (!indexName) throw new Error(`indexName is required, got: ${indexName}`);
7219
7234
  if (!vectorStoreName) throw new Error(`vectorStoreName is required, got: ${vectorStoreName}`);
7220
7235
  const topK = runtimeContext.get("topK") ?? context.topK ?? 10;
@@ -7268,7 +7283,8 @@ var createVectorQueryTool = (options) => {
7268
7283
  queryFilter: Object.keys(queryFilter || {}).length > 0 ? queryFilter : void 0,
7269
7284
  topK: topKValue,
7270
7285
  includeVectors,
7271
- databaseConfig
7286
+ databaseConfig,
7287
+ providerOptions
7272
7288
  });
7273
7289
  if (logger) {
7274
7290
  logger.debug("vectorQuerySearch returned results", { count: results.length });