langchain 0.0.176 → 0.0.178

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 (84) hide show
  1. package/chat_models/iflytek_xinghuo/web.cjs +1 -0
  2. package/chat_models/iflytek_xinghuo/web.d.ts +1 -0
  3. package/chat_models/iflytek_xinghuo/web.js +1 -0
  4. package/chat_models/iflytek_xinghuo.cjs +1 -0
  5. package/chat_models/iflytek_xinghuo.d.ts +1 -0
  6. package/chat_models/iflytek_xinghuo.js +1 -0
  7. package/dist/chat_models/bedrock.cjs +25 -4
  8. package/dist/chat_models/bedrock.d.ts +2 -1
  9. package/dist/chat_models/bedrock.js +25 -4
  10. package/dist/chat_models/cloudflare_workersai.cjs +70 -24
  11. package/dist/chat_models/cloudflare_workersai.d.ts +6 -2
  12. package/dist/chat_models/cloudflare_workersai.js +71 -25
  13. package/dist/chat_models/iflytek_xinghuo/common.cjs +335 -0
  14. package/dist/chat_models/iflytek_xinghuo/common.d.ts +165 -0
  15. package/dist/chat_models/iflytek_xinghuo/common.js +331 -0
  16. package/dist/chat_models/iflytek_xinghuo/index.cjs +35 -0
  17. package/dist/chat_models/iflytek_xinghuo/index.d.ts +5 -0
  18. package/dist/chat_models/iflytek_xinghuo/index.js +28 -0
  19. package/dist/chat_models/iflytek_xinghuo/web.cjs +30 -0
  20. package/dist/chat_models/iflytek_xinghuo/web.d.ts +5 -0
  21. package/dist/chat_models/iflytek_xinghuo/web.js +26 -0
  22. package/dist/chat_models/llama_cpp.cjs +31 -79
  23. package/dist/chat_models/llama_cpp.d.ts +15 -58
  24. package/dist/chat_models/llama_cpp.js +32 -80
  25. package/dist/chat_models/openai.cjs +91 -6
  26. package/dist/chat_models/openai.d.ts +10 -0
  27. package/dist/chat_models/openai.js +91 -6
  28. package/dist/embeddings/hf.cjs +10 -1
  29. package/dist/embeddings/hf.d.ts +4 -2
  30. package/dist/embeddings/hf.js +10 -1
  31. package/dist/embeddings/llama_cpp.cjs +67 -0
  32. package/dist/embeddings/llama_cpp.d.ts +26 -0
  33. package/dist/embeddings/llama_cpp.js +63 -0
  34. package/dist/embeddings/ollama.cjs +7 -1
  35. package/dist/embeddings/ollama.js +7 -1
  36. package/dist/graphs/neo4j_graph.cjs +36 -5
  37. package/dist/graphs/neo4j_graph.js +14 -3
  38. package/dist/llms/bedrock.cjs +25 -3
  39. package/dist/llms/bedrock.d.ts +2 -1
  40. package/dist/llms/bedrock.js +25 -3
  41. package/dist/llms/cloudflare_workersai.cjs +59 -13
  42. package/dist/llms/cloudflare_workersai.d.ts +9 -3
  43. package/dist/llms/cloudflare_workersai.js +59 -13
  44. package/dist/llms/hf.cjs +10 -1
  45. package/dist/llms/hf.d.ts +3 -0
  46. package/dist/llms/hf.js +10 -1
  47. package/dist/llms/llama_cpp.cjs +25 -65
  48. package/dist/llms/llama_cpp.d.ts +7 -43
  49. package/dist/llms/llama_cpp.js +25 -65
  50. package/dist/load/import_constants.cjs +3 -0
  51. package/dist/load/import_constants.js +3 -0
  52. package/dist/prompts/chat.cjs +8 -0
  53. package/dist/prompts/chat.d.ts +5 -0
  54. package/dist/prompts/chat.js +8 -0
  55. package/dist/prompts/few_shot.cjs +162 -1
  56. package/dist/prompts/few_shot.d.ts +90 -2
  57. package/dist/prompts/few_shot.js +160 -0
  58. package/dist/prompts/index.cjs +2 -1
  59. package/dist/prompts/index.d.ts +1 -1
  60. package/dist/prompts/index.js +1 -1
  61. package/dist/retrievers/zep.cjs +26 -3
  62. package/dist/retrievers/zep.d.ts +11 -2
  63. package/dist/retrievers/zep.js +26 -3
  64. package/dist/util/bedrock.d.ts +2 -0
  65. package/dist/util/event-source-parse.cjs +20 -1
  66. package/dist/util/event-source-parse.d.ts +2 -0
  67. package/dist/util/event-source-parse.js +18 -0
  68. package/dist/util/iflytek_websocket_stream.cjs +81 -0
  69. package/dist/util/iflytek_websocket_stream.d.ts +27 -0
  70. package/dist/util/iflytek_websocket_stream.js +77 -0
  71. package/dist/util/llama_cpp.cjs +34 -0
  72. package/dist/util/llama_cpp.d.ts +46 -0
  73. package/dist/util/llama_cpp.js +28 -0
  74. package/dist/util/openai-format-fndef.cjs +81 -0
  75. package/dist/util/openai-format-fndef.d.ts +44 -0
  76. package/dist/util/openai-format-fndef.js +77 -0
  77. package/dist/util/openapi.d.ts +2 -2
  78. package/dist/vectorstores/pinecone.cjs +5 -5
  79. package/dist/vectorstores/pinecone.d.ts +2 -2
  80. package/dist/vectorstores/pinecone.js +5 -5
  81. package/embeddings/llama_cpp.cjs +1 -0
  82. package/embeddings/llama_cpp.d.ts +1 -0
  83. package/embeddings/llama_cpp.js +1 -0
  84. package/package.json +34 -5
@@ -34,6 +34,7 @@ const base_js_1 = require("./base.cjs");
34
34
  const document_js_1 = require("../document.cjs");
35
35
  const async_caller_js_1 = require("../util/async_caller.cjs");
36
36
  const math_js_1 = require("../util/math.cjs");
37
+ const chunk_js_1 = require("../util/chunk.cjs");
37
38
  /**
38
39
  * Class that extends the VectorStore class and provides methods to
39
40
  * interact with the Pinecone vector database.
@@ -138,11 +139,10 @@ class PineconeStore extends base_js_1.VectorStore {
138
139
  });
139
140
  const namespace = this.pineconeIndex.namespace(this.namespace ?? "");
140
141
  // Pinecone recommends a limit of 100 vectors per upsert request
141
- const chunkSize = 50;
142
- for (let i = 0; i < pineconeVectors.length; i += chunkSize) {
143
- const chunk = pineconeVectors.slice(i, i + chunkSize);
144
- await namespace.upsert(chunk);
145
- }
142
+ const chunkSize = 100;
143
+ const chunkedVectors = (0, chunk_js_1.chunkArray)(pineconeVectors, chunkSize);
144
+ const batchRequests = chunkedVectors.map((chunk) => this.caller.call(async () => namespace.upsert(chunk)));
145
+ await Promise.all(batchRequests);
146
146
  return documentIds;
147
147
  }
148
148
  /**
@@ -2,9 +2,9 @@ import { RecordMetadata, Index as PineconeIndex } from "@pinecone-database/pinec
2
2
  import { MaxMarginalRelevanceSearchOptions, VectorStore } from "./base.js";
3
3
  import { Embeddings } from "../embeddings/base.js";
4
4
  import { Document } from "../document.js";
5
- import { AsyncCaller } from "../util/async_caller.js";
5
+ import { AsyncCaller, AsyncCallerParams } from "../util/async_caller.js";
6
6
  type PineconeMetadata = Record<string, any>;
7
- export interface PineconeLibArgs {
7
+ export interface PineconeLibArgs extends AsyncCallerParams {
8
8
  pineconeIndex: PineconeIndex;
9
9
  textKey?: string;
10
10
  namespace?: string;
@@ -5,6 +5,7 @@ import { VectorStore } from "./base.js";
5
5
  import { Document } from "../document.js";
6
6
  import { AsyncCaller } from "../util/async_caller.js";
7
7
  import { maximalMarginalRelevance } from "../util/math.js";
8
+ import { chunkArray } from "../util/chunk.js";
8
9
  /**
9
10
  * Class that extends the VectorStore class and provides methods to
10
11
  * interact with the Pinecone vector database.
@@ -109,11 +110,10 @@ export class PineconeStore extends VectorStore {
109
110
  });
110
111
  const namespace = this.pineconeIndex.namespace(this.namespace ?? "");
111
112
  // Pinecone recommends a limit of 100 vectors per upsert request
112
- const chunkSize = 50;
113
- for (let i = 0; i < pineconeVectors.length; i += chunkSize) {
114
- const chunk = pineconeVectors.slice(i, i + chunkSize);
115
- await namespace.upsert(chunk);
116
- }
113
+ const chunkSize = 100;
114
+ const chunkedVectors = chunkArray(pineconeVectors, chunkSize);
115
+ const batchRequests = chunkedVectors.map((chunk) => this.caller.call(async () => namespace.upsert(chunk)));
116
+ await Promise.all(batchRequests);
117
117
  return documentIds;
118
118
  }
119
119
  /**
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/embeddings/llama_cpp.cjs');
@@ -0,0 +1 @@
1
+ export * from '../dist/embeddings/llama_cpp.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/embeddings/llama_cpp.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.176",
3
+ "version": "0.0.178",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -142,6 +142,9 @@
142
142
  "embeddings/minimax.cjs",
143
143
  "embeddings/minimax.js",
144
144
  "embeddings/minimax.d.ts",
145
+ "embeddings/llama_cpp.cjs",
146
+ "embeddings/llama_cpp.js",
147
+ "embeddings/llama_cpp.d.ts",
145
148
  "llms/load.cjs",
146
149
  "llms/load.js",
147
150
  "llms/load.d.ts",
@@ -493,6 +496,12 @@
493
496
  "chat_models/baiduwenxin.cjs",
494
497
  "chat_models/baiduwenxin.js",
495
498
  "chat_models/baiduwenxin.d.ts",
499
+ "chat_models/iflytek_xinghuo.cjs",
500
+ "chat_models/iflytek_xinghuo.js",
501
+ "chat_models/iflytek_xinghuo.d.ts",
502
+ "chat_models/iflytek_xinghuo/web.cjs",
503
+ "chat_models/iflytek_xinghuo/web.js",
504
+ "chat_models/iflytek_xinghuo/web.d.ts",
496
505
  "chat_models/ollama.cjs",
497
506
  "chat_models/ollama.js",
498
507
  "chat_models/ollama.d.ts",
@@ -806,12 +815,12 @@
806
815
  "@elastic/elasticsearch": "^8.4.0",
807
816
  "@faker-js/faker": "^7.6.0",
808
817
  "@getmetal/metal-sdk": "^4.0.0",
809
- "@getzep/zep-js": "^0.8.0",
818
+ "@getzep/zep-js": "^0.9.0",
810
819
  "@gomomento/sdk": "^1.44.1",
811
820
  "@gomomento/sdk-core": "^1.44.1",
812
821
  "@google-ai/generativelanguage": "^0.2.1",
813
822
  "@google-cloud/storage": "^6.10.1",
814
- "@huggingface/inference": "^1.5.1",
823
+ "@huggingface/inference": "^2.6.4",
815
824
  "@jest/globals": "^29.5.0",
816
825
  "@mozilla/readability": "^0.4.4",
817
826
  "@notionhq/client": "^2.2.10",
@@ -846,6 +855,7 @@
846
855
  "@types/pg": "^8",
847
856
  "@types/pg-copy-streams": "^1.2.2",
848
857
  "@types/uuid": "^9",
858
+ "@types/ws": "^8",
849
859
  "@typescript-eslint/eslint-plugin": "^5.58.0",
850
860
  "@typescript-eslint/parser": "^5.58.0",
851
861
  "@upstash/redis": "^1.20.6",
@@ -942,13 +952,13 @@
942
952
  "@cloudflare/ai": "^1.0.12",
943
953
  "@elastic/elasticsearch": "^8.4.0",
944
954
  "@getmetal/metal-sdk": "*",
945
- "@getzep/zep-js": "^0.8.0",
955
+ "@getzep/zep-js": "^0.9.0",
946
956
  "@gomomento/sdk": "^1.44.1",
947
957
  "@gomomento/sdk-core": "^1.44.1",
948
958
  "@gomomento/sdk-web": "^1.44.1",
949
959
  "@google-ai/generativelanguage": "^0.2.1",
950
960
  "@google-cloud/storage": "^6.10.1",
951
- "@huggingface/inference": "^1.5.1",
961
+ "@huggingface/inference": "^2.6.4",
952
962
  "@mozilla/readability": "*",
953
963
  "@notionhq/client": "^2.2.10",
954
964
  "@opensearch-project/opensearch": "*",
@@ -1022,6 +1032,7 @@
1022
1032
  "voy-search": "0.6.2",
1023
1033
  "weaviate-ts-client": "^1.4.0",
1024
1034
  "web-auth-library": "^1.0.3",
1035
+ "ws": "^8.14.2",
1025
1036
  "youtube-transcript": "^1.0.6",
1026
1037
  "youtubei.js": "^5.8.0"
1027
1038
  },
@@ -1308,6 +1319,9 @@
1308
1319
  "web-auth-library": {
1309
1320
  "optional": true
1310
1321
  },
1322
+ "ws": {
1323
+ "optional": true
1324
+ },
1311
1325
  "youtube-transcript": {
1312
1326
  "optional": true
1313
1327
  },
@@ -1577,6 +1591,11 @@
1577
1591
  "import": "./embeddings/minimax.js",
1578
1592
  "require": "./embeddings/minimax.cjs"
1579
1593
  },
1594
+ "./embeddings/llama_cpp": {
1595
+ "types": "./embeddings/llama_cpp.d.ts",
1596
+ "import": "./embeddings/llama_cpp.js",
1597
+ "require": "./embeddings/llama_cpp.cjs"
1598
+ },
1580
1599
  "./llms/load": {
1581
1600
  "types": "./llms/load.d.ts",
1582
1601
  "import": "./llms/load.js",
@@ -2162,6 +2181,16 @@
2162
2181
  "import": "./chat_models/baiduwenxin.js",
2163
2182
  "require": "./chat_models/baiduwenxin.cjs"
2164
2183
  },
2184
+ "./chat_models/iflytek_xinghuo": {
2185
+ "types": "./chat_models/iflytek_xinghuo.d.ts",
2186
+ "import": "./chat_models/iflytek_xinghuo.js",
2187
+ "require": "./chat_models/iflytek_xinghuo.cjs"
2188
+ },
2189
+ "./chat_models/iflytek_xinghuo/web": {
2190
+ "types": "./chat_models/iflytek_xinghuo/web.d.ts",
2191
+ "import": "./chat_models/iflytek_xinghuo/web.js",
2192
+ "require": "./chat_models/iflytek_xinghuo/web.cjs"
2193
+ },
2165
2194
  "./chat_models/ollama": {
2166
2195
  "types": "./chat_models/ollama.d.ts",
2167
2196
  "import": "./chat_models/ollama.js",