langchain 0.1.11 → 0.1.13

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 (309) hide show
  1. package/agents/format_scratchpad/log.d.cts +1 -0
  2. package/agents/format_scratchpad/log_to_message.d.cts +1 -0
  3. package/agents/format_scratchpad/openai_tools.d.cts +1 -0
  4. package/agents/format_scratchpad/xml.d.cts +1 -0
  5. package/agents/format_scratchpad.d.cts +1 -0
  6. package/agents/load.d.cts +1 -0
  7. package/agents/openai/output_parser.d.cts +1 -0
  8. package/agents/react/output_parser.d.cts +1 -0
  9. package/agents/toolkits/aws_sfn.d.cts +1 -0
  10. package/agents/toolkits/connery.d.cts +1 -0
  11. package/agents/toolkits/sql.d.cts +1 -0
  12. package/agents/toolkits.d.cts +1 -0
  13. package/agents/xml/output_parser.d.cts +1 -0
  14. package/agents.d.cts +1 -0
  15. package/base_language.d.cts +1 -0
  16. package/cache/cloudflare_kv.d.cts +1 -0
  17. package/cache/file_system.d.cts +1 -0
  18. package/cache/ioredis.d.cts +1 -0
  19. package/cache/momento.d.cts +1 -0
  20. package/cache/redis.d.cts +1 -0
  21. package/cache/upstash_redis.d.cts +1 -0
  22. package/cache.d.cts +1 -0
  23. package/callbacks/handlers/llmonitor.d.cts +1 -0
  24. package/callbacks.d.cts +1 -0
  25. package/chains/combine_documents/reduce.d.cts +1 -0
  26. package/chains/combine_documents.d.cts +1 -0
  27. package/chains/graph_qa/cypher.d.cts +1 -0
  28. package/chains/history_aware_retriever.d.cts +1 -0
  29. package/chains/load.d.cts +1 -0
  30. package/chains/openai_functions.d.cts +1 -0
  31. package/chains/query_constructor/ir.d.cts +1 -0
  32. package/chains/query_constructor.d.cts +1 -0
  33. package/chains/retrieval.d.cts +1 -0
  34. package/chains/sql_db.d.cts +1 -0
  35. package/chains.d.cts +1 -0
  36. package/chat_models/anthropic.d.cts +1 -0
  37. package/chat_models/baiduwenxin.d.cts +1 -0
  38. package/chat_models/base.d.cts +1 -0
  39. package/chat_models/bedrock/web.d.cts +1 -0
  40. package/chat_models/bedrock.d.cts +1 -0
  41. package/chat_models/cloudflare_workersai.d.cts +1 -0
  42. package/chat_models/fake.d.cts +1 -0
  43. package/chat_models/fireworks.d.cts +1 -0
  44. package/chat_models/googlepalm.d.cts +1 -0
  45. package/chat_models/googlevertexai/web.d.cts +1 -0
  46. package/chat_models/googlevertexai.d.cts +1 -0
  47. package/chat_models/iflytek_xinghuo/web.d.cts +1 -0
  48. package/chat_models/iflytek_xinghuo.d.cts +1 -0
  49. package/chat_models/llama_cpp.d.cts +1 -0
  50. package/chat_models/minimax.d.cts +1 -0
  51. package/chat_models/ollama.d.cts +1 -0
  52. package/chat_models/openai.d.cts +1 -0
  53. package/chat_models/portkey.d.cts +1 -0
  54. package/chat_models/yandex.d.cts +1 -0
  55. package/dist/document.cjs +0 -6
  56. package/dist/document.js +0 -6
  57. package/dist/document_loaders/web/confluence.cjs +8 -5
  58. package/dist/document_loaders/web/confluence.d.ts +7 -1
  59. package/dist/document_loaders/web/confluence.js +8 -5
  60. package/dist/embeddings/fake.cjs +21 -92
  61. package/dist/embeddings/fake.d.ts +1 -53
  62. package/dist/embeddings/fake.js +7 -89
  63. package/dist/experimental/prompts/custom_format.cjs +12 -2
  64. package/dist/experimental/prompts/custom_format.js +12 -2
  65. package/dist/load/import_map.cjs +20 -2
  66. package/dist/load/import_map.d.ts +18 -0
  67. package/dist/load/import_map.js +18 -0
  68. package/dist/load/import_type.cjs +3 -0
  69. package/dist/load/import_type.d.ts +8 -0
  70. package/dist/load/import_type.js +2 -0
  71. package/dist/vectorstores/weaviate.cjs +2 -0
  72. package/dist/vectorstores/weaviate.js +2 -0
  73. package/document.d.cts +1 -0
  74. package/document_loaders/base.d.cts +1 -0
  75. package/document_loaders/fs/buffer.d.cts +1 -0
  76. package/document_loaders/fs/chatgpt.d.cts +1 -0
  77. package/document_loaders/fs/csv.d.cts +1 -0
  78. package/document_loaders/fs/directory.d.cts +1 -0
  79. package/document_loaders/fs/docx.d.cts +1 -0
  80. package/document_loaders/fs/epub.d.cts +1 -0
  81. package/document_loaders/fs/json.d.cts +1 -0
  82. package/document_loaders/fs/notion.d.cts +1 -0
  83. package/document_loaders/fs/obsidian.d.cts +1 -0
  84. package/document_loaders/fs/openai_whisper_audio.d.cts +1 -0
  85. package/document_loaders/fs/pdf.d.cts +1 -0
  86. package/document_loaders/fs/pptx.d.cts +1 -0
  87. package/document_loaders/fs/srt.d.cts +1 -0
  88. package/document_loaders/fs/text.d.cts +1 -0
  89. package/document_loaders/fs/unstructured.d.cts +1 -0
  90. package/document_loaders/web/apify_dataset.d.cts +1 -0
  91. package/document_loaders/web/assemblyai.d.cts +1 -0
  92. package/document_loaders/web/azure_blob_storage_container.d.cts +1 -0
  93. package/document_loaders/web/azure_blob_storage_file.d.cts +1 -0
  94. package/document_loaders/web/cheerio.d.cts +1 -0
  95. package/document_loaders/web/college_confidential.d.cts +1 -0
  96. package/document_loaders/web/confluence.d.cts +1 -0
  97. package/document_loaders/web/figma.d.cts +1 -0
  98. package/document_loaders/web/gitbook.d.cts +1 -0
  99. package/document_loaders/web/github.d.cts +1 -0
  100. package/document_loaders/web/hn.d.cts +1 -0
  101. package/document_loaders/web/imsdb.d.cts +1 -0
  102. package/document_loaders/web/notionapi.d.cts +1 -0
  103. package/document_loaders/web/notiondb.d.cts +1 -0
  104. package/document_loaders/web/pdf.d.cts +1 -0
  105. package/document_loaders/web/playwright.d.cts +1 -0
  106. package/document_loaders/web/puppeteer.d.cts +1 -0
  107. package/document_loaders/web/recursive_url.d.cts +1 -0
  108. package/document_loaders/web/s3.d.cts +1 -0
  109. package/document_loaders/web/searchapi.d.cts +1 -0
  110. package/document_loaders/web/serpapi.d.cts +1 -0
  111. package/document_loaders/web/sonix_audio.d.cts +1 -0
  112. package/document_loaders/web/sort_xyz_blockchain.d.cts +1 -0
  113. package/document_loaders/web/youtube.d.cts +1 -0
  114. package/document_transformers/html_to_text.d.cts +1 -0
  115. package/document_transformers/mozilla_readability.d.cts +1 -0
  116. package/document_transformers/openai_functions.d.cts +1 -0
  117. package/embeddings/base.d.cts +1 -0
  118. package/embeddings/bedrock.d.cts +1 -0
  119. package/embeddings/cache_backed.d.cts +1 -0
  120. package/embeddings/cloudflare_workersai.d.cts +1 -0
  121. package/embeddings/cohere.d.cts +1 -0
  122. package/embeddings/fake.d.cts +1 -0
  123. package/embeddings/googlepalm.d.cts +1 -0
  124. package/embeddings/googlevertexai.d.cts +1 -0
  125. package/embeddings/gradient_ai.d.cts +1 -0
  126. package/embeddings/hf.d.cts +1 -0
  127. package/embeddings/hf_transformers.d.cts +1 -0
  128. package/embeddings/llama_cpp.d.cts +1 -0
  129. package/embeddings/minimax.d.cts +1 -0
  130. package/embeddings/ollama.d.cts +1 -0
  131. package/embeddings/openai.d.cts +1 -0
  132. package/embeddings/tensorflow.d.cts +1 -0
  133. package/embeddings/voyage.d.cts +1 -0
  134. package/evaluation.d.cts +1 -0
  135. package/experimental/autogpt.d.cts +1 -0
  136. package/experimental/babyagi.d.cts +1 -0
  137. package/experimental/chains/violation_of_expectations.d.cts +1 -0
  138. package/experimental/chat_models/anthropic_functions.d.cts +1 -0
  139. package/experimental/chat_models/bittensor.d.cts +1 -0
  140. package/experimental/chat_models/ollama_functions.d.cts +1 -0
  141. package/experimental/generative_agents.d.cts +1 -0
  142. package/experimental/hubs/makersuite/googlemakersuitehub.d.cts +1 -0
  143. package/experimental/llms/bittensor.d.cts +1 -0
  144. package/experimental/masking.d.cts +1 -0
  145. package/experimental/multimodal_embeddings/googlevertexai.d.cts +1 -0
  146. package/experimental/openai_assistant.d.cts +1 -0
  147. package/experimental/openai_files.d.cts +1 -0
  148. package/experimental/plan_and_execute.d.cts +1 -0
  149. package/experimental/prompts/custom_format.d.cts +1 -0
  150. package/experimental/prompts/handlebars.d.cts +1 -0
  151. package/experimental/tools/pyinterpreter.d.cts +1 -0
  152. package/graphs/neo4j_graph.d.cts +1 -0
  153. package/hub.d.cts +1 -0
  154. package/indexes.d.cts +1 -0
  155. package/llms/ai21.d.cts +1 -0
  156. package/llms/aleph_alpha.d.cts +1 -0
  157. package/llms/base.d.cts +1 -0
  158. package/llms/bedrock/web.d.cts +1 -0
  159. package/llms/bedrock.d.cts +1 -0
  160. package/llms/cloudflare_workersai.d.cts +1 -0
  161. package/llms/cohere.d.cts +1 -0
  162. package/llms/fake.d.cts +1 -0
  163. package/llms/fireworks.d.cts +1 -0
  164. package/llms/googlepalm.d.cts +1 -0
  165. package/llms/googlevertexai/web.d.cts +1 -0
  166. package/llms/googlevertexai.d.cts +1 -0
  167. package/llms/gradient_ai.d.cts +1 -0
  168. package/llms/hf.d.cts +1 -0
  169. package/llms/llama_cpp.d.cts +1 -0
  170. package/llms/load.d.cts +1 -0
  171. package/llms/ollama.d.cts +1 -0
  172. package/llms/openai.d.cts +1 -0
  173. package/llms/portkey.d.cts +1 -0
  174. package/llms/raycast.d.cts +1 -0
  175. package/llms/replicate.d.cts +1 -0
  176. package/llms/sagemaker_endpoint.d.cts +1 -0
  177. package/llms/watsonx_ai.d.cts +1 -0
  178. package/llms/writer.d.cts +1 -0
  179. package/llms/yandex.d.cts +1 -0
  180. package/load/serializable.d.cts +1 -0
  181. package/load.d.cts +1 -0
  182. package/memory/zep.d.cts +1 -0
  183. package/memory.d.cts +1 -0
  184. package/output_parsers/expression.d.cts +1 -0
  185. package/output_parsers.d.cts +1 -0
  186. package/package.json +1745 -299
  187. package/prompts/load.d.cts +1 -0
  188. package/prompts.d.cts +1 -0
  189. package/retrievers/amazon_kendra.d.cts +1 -0
  190. package/retrievers/chaindesk.d.cts +1 -0
  191. package/retrievers/contextual_compression.d.cts +1 -0
  192. package/retrievers/databerry.d.cts +1 -0
  193. package/retrievers/document_compressors/chain_extract.d.cts +1 -0
  194. package/retrievers/document_compressors/embeddings_filter.d.cts +1 -0
  195. package/retrievers/document_compressors.d.cts +1 -0
  196. package/retrievers/hyde.d.cts +1 -0
  197. package/retrievers/metal.d.cts +1 -0
  198. package/retrievers/multi_query.d.cts +1 -0
  199. package/retrievers/multi_vector.d.cts +1 -0
  200. package/retrievers/parent_document.d.cts +1 -0
  201. package/retrievers/remote.d.cts +1 -0
  202. package/retrievers/score_threshold.d.cts +1 -0
  203. package/retrievers/self_query/chroma.d.cts +1 -0
  204. package/retrievers/self_query/functional.d.cts +1 -0
  205. package/retrievers/self_query/pinecone.d.cts +1 -0
  206. package/retrievers/self_query/supabase.d.cts +1 -0
  207. package/retrievers/self_query/vectara.d.cts +1 -0
  208. package/retrievers/self_query/weaviate.d.cts +1 -0
  209. package/retrievers/self_query.d.cts +1 -0
  210. package/retrievers/supabase.d.cts +1 -0
  211. package/retrievers/tavily_search_api.d.cts +1 -0
  212. package/retrievers/time_weighted.d.cts +1 -0
  213. package/retrievers/vectara_summary.d.cts +1 -0
  214. package/retrievers/vespa.d.cts +1 -0
  215. package/retrievers/zep.d.cts +1 -0
  216. package/runnables/remote.d.cts +1 -0
  217. package/runnables.d.cts +1 -0
  218. package/schema/document.d.cts +1 -0
  219. package/schema/output_parser.d.cts +1 -0
  220. package/schema/prompt_template.d.cts +1 -0
  221. package/schema/query_constructor.d.cts +1 -0
  222. package/schema/retriever.d.cts +1 -0
  223. package/schema/runnable.d.cts +1 -0
  224. package/schema/storage.d.cts +1 -0
  225. package/schema.d.cts +1 -0
  226. package/smith.d.cts +1 -0
  227. package/sql_db.d.cts +1 -0
  228. package/storage/convex.d.cts +1 -0
  229. package/storage/encoder_backed.d.cts +1 -0
  230. package/storage/file_system.d.cts +1 -0
  231. package/storage/in_memory.d.cts +1 -0
  232. package/storage/ioredis.d.cts +1 -0
  233. package/storage/upstash_redis.d.cts +1 -0
  234. package/storage/vercel_kv.d.cts +1 -0
  235. package/stores/doc/gcs.d.cts +1 -0
  236. package/stores/doc/in_memory.d.cts +1 -0
  237. package/stores/file/in_memory.d.cts +1 -0
  238. package/stores/file/node.d.cts +1 -0
  239. package/stores/message/cassandra.d.cts +1 -0
  240. package/stores/message/cloudflare_d1.d.cts +1 -0
  241. package/stores/message/convex.d.cts +1 -0
  242. package/stores/message/dynamodb.d.cts +1 -0
  243. package/stores/message/firestore.d.cts +1 -0
  244. package/stores/message/in_memory.d.cts +1 -0
  245. package/stores/message/ioredis.d.cts +1 -0
  246. package/stores/message/momento.d.cts +1 -0
  247. package/stores/message/mongodb.d.cts +1 -0
  248. package/stores/message/planetscale.d.cts +1 -0
  249. package/stores/message/redis.d.cts +1 -0
  250. package/stores/message/upstash_redis.d.cts +1 -0
  251. package/stores/message/xata.d.cts +1 -0
  252. package/text_splitter.d.cts +1 -0
  253. package/tools/aws_lambda.d.cts +1 -0
  254. package/tools/aws_sfn.d.cts +1 -0
  255. package/tools/calculator.d.cts +1 -0
  256. package/tools/chain.d.cts +1 -0
  257. package/tools/connery.d.cts +1 -0
  258. package/tools/gmail.d.cts +1 -0
  259. package/tools/google_calendar.d.cts +1 -0
  260. package/tools/google_places.d.cts +1 -0
  261. package/tools/render.d.cts +1 -0
  262. package/tools/retriever.d.cts +1 -0
  263. package/tools/sql.d.cts +1 -0
  264. package/tools/webbrowser.d.cts +1 -0
  265. package/tools.d.cts +1 -0
  266. package/util/convex.d.cts +1 -0
  267. package/util/document.d.cts +1 -0
  268. package/util/math.d.cts +1 -0
  269. package/util/time.d.cts +1 -0
  270. package/vectorstores/analyticdb.d.cts +1 -0
  271. package/vectorstores/base.d.cts +1 -0
  272. package/vectorstores/cassandra.d.cts +1 -0
  273. package/vectorstores/chroma.d.cts +1 -0
  274. package/vectorstores/clickhouse.d.cts +1 -0
  275. package/vectorstores/closevector/node.d.cts +1 -0
  276. package/vectorstores/closevector/web.d.cts +1 -0
  277. package/vectorstores/cloudflare_vectorize.d.cts +1 -0
  278. package/vectorstores/convex.d.cts +1 -0
  279. package/vectorstores/elasticsearch.d.cts +1 -0
  280. package/vectorstores/faiss.d.cts +1 -0
  281. package/vectorstores/googlevertexai.d.cts +1 -0
  282. package/vectorstores/hnswlib.d.cts +1 -0
  283. package/vectorstores/lancedb.d.cts +1 -0
  284. package/vectorstores/memory.d.cts +1 -0
  285. package/vectorstores/milvus.d.cts +1 -0
  286. package/vectorstores/momento_vector_index.d.cts +1 -0
  287. package/vectorstores/mongo.d.cts +1 -0
  288. package/vectorstores/mongodb_atlas.d.cts +1 -0
  289. package/vectorstores/myscale.d.cts +1 -0
  290. package/vectorstores/neo4j_vector.d.cts +1 -0
  291. package/vectorstores/opensearch.d.cts +1 -0
  292. package/vectorstores/pgvector.d.cts +1 -0
  293. package/vectorstores/pinecone.d.cts +1 -0
  294. package/vectorstores/prisma.d.cts +1 -0
  295. package/vectorstores/qdrant.d.cts +1 -0
  296. package/vectorstores/redis.d.cts +1 -0
  297. package/vectorstores/rockset.d.cts +1 -0
  298. package/vectorstores/singlestore.d.cts +1 -0
  299. package/vectorstores/supabase.d.cts +1 -0
  300. package/vectorstores/tigris.d.cts +1 -0
  301. package/vectorstores/typeorm.d.cts +1 -0
  302. package/vectorstores/typesense.d.cts +1 -0
  303. package/vectorstores/usearch.d.cts +1 -0
  304. package/vectorstores/vectara.d.cts +1 -0
  305. package/vectorstores/vercel_postgres.d.cts +1 -0
  306. package/vectorstores/voy.d.cts +1 -0
  307. package/vectorstores/weaviate.d.cts +1 -0
  308. package/vectorstores/xata.d.cts +1 -0
  309. package/vectorstores/zep.d.cts +1 -0
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/format_scratchpad/log.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/format_scratchpad/log_to_message.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/format_scratchpad/openai_tools.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/format_scratchpad/xml.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/agents/format_scratchpad/openai_functions.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/agents/load.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/openai/output_parser.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/react/output_parser.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/toolkits/aws_sfn.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/toolkits/connery/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/toolkits/sql/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/agents/toolkits/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/agents/xml/output_parser.js'
package/agents.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/agents/index.js'
@@ -0,0 +1 @@
1
+ export * from './dist/base_language/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/cloudflare_kv.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/file_system.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/ioredis.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/momento.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/redis.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/cache/upstash_redis.js'
package/cache.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/cache/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/callbacks/handlers/llmonitor.js'
@@ -0,0 +1 @@
1
+ export * from './dist/callbacks/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chains/combine_documents/reduce.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/combine_documents/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chains/graph_qa/cypher.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/history_aware_retriever.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/load.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/openai_functions/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chains/query_constructor/ir.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/query_constructor/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/retrieval.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chains/sql_db/index.js'
package/chains.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/chains/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/anthropic.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/baiduwenxin.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/base.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chat_models/bedrock/web.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/bedrock/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/cloudflare_workersai.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/fake.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/fireworks.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/googlepalm.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chat_models/googlevertexai/web.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/googlevertexai/index.js'
@@ -0,0 +1 @@
1
+ export * from '../../dist/chat_models/iflytek_xinghuo/web.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/iflytek_xinghuo/index.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/llama_cpp.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/minimax.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/ollama.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/openai.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/portkey.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/chat_models/yandex.js'
package/dist/document.cjs CHANGED
@@ -1,11 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Document = void 0;
4
- const entrypoint_deprecation_js_1 = require("./util/entrypoint_deprecation.cjs");
5
- /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
6
- oldEntrypointName: "document",
7
- newEntrypointName: "documents",
8
- newPackageName: "@langchain/core",
9
- });
10
4
  var documents_1 = require("@langchain/core/documents");
11
5
  Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return documents_1.Document; } });
package/dist/document.js CHANGED
@@ -1,7 +1 @@
1
- import { logVersion010MigrationWarning } from "./util/entrypoint_deprecation.js";
2
- /* #__PURE__ */ logVersion010MigrationWarning({
3
- oldEntrypointName: "document",
4
- newEntrypointName: "documents",
5
- newPackageName: "@langchain/core",
6
- });
7
1
  export { Document } from "@langchain/core/documents";
@@ -92,11 +92,14 @@ class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
92
92
  /**
93
93
  * Fetches all the pages in the specified space and converts each page to
94
94
  * a Document instance.
95
+ * @param options the extra options of the load function
96
+ * @param options.limit The limit parameter to overwrite the size to fetch pages.
97
+ * @param options.start The start parameter to set inital offset to fetch pages.
95
98
  * @returns Promise resolving to an array of Document instances.
96
99
  */
97
- async load() {
100
+ async load(options) {
98
101
  try {
99
- const pages = await this.fetchAllPagesInSpace();
102
+ const pages = await this.fetchAllPagesInSpace(options?.start, options?.limit);
100
103
  return pages.map((page) => this.createDocumentFromPage(page));
101
104
  }
102
105
  catch (error) {
@@ -136,14 +139,14 @@ class ConfluencePagesLoader extends base_js_1.BaseDocumentLoader {
136
139
  * @param start The start parameter to paginate through the results.
137
140
  * @returns Promise resolving to an array of ConfluencePage objects.
138
141
  */
139
- async fetchAllPagesInSpace(start = 0) {
140
- const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand=${this.expand}`;
142
+ async fetchAllPagesInSpace(start = 0, limit = this.limit) {
143
+ const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${limit}&start=${start}&expand=${this.expand}`;
141
144
  const data = await this.fetchConfluenceData(url);
142
145
  if (data.size === 0) {
143
146
  return [];
144
147
  }
145
148
  const nextPageStart = start + data.size;
146
- const nextPageResults = await this.fetchAllPagesInSpace(nextPageStart);
149
+ const nextPageResults = await this.fetchAllPagesInSpace(nextPageStart, limit);
147
150
  return data.results.concat(nextPageResults);
148
151
  }
149
152
  /**
@@ -67,9 +67,15 @@ export declare class ConfluencePagesLoader extends BaseDocumentLoader {
67
67
  /**
68
68
  * Fetches all the pages in the specified space and converts each page to
69
69
  * a Document instance.
70
+ * @param options the extra options of the load function
71
+ * @param options.limit The limit parameter to overwrite the size to fetch pages.
72
+ * @param options.start The start parameter to set inital offset to fetch pages.
70
73
  * @returns Promise resolving to an array of Document instances.
71
74
  */
72
- load(): Promise<Document[]>;
75
+ load(options?: {
76
+ start?: number;
77
+ limit?: number;
78
+ }): Promise<Document[]>;
73
79
  /**
74
80
  * Fetches data from the Confluence API using the provided URL.
75
81
  * @param url The URL to fetch data from.
@@ -89,11 +89,14 @@ export class ConfluencePagesLoader extends BaseDocumentLoader {
89
89
  /**
90
90
  * Fetches all the pages in the specified space and converts each page to
91
91
  * a Document instance.
92
+ * @param options the extra options of the load function
93
+ * @param options.limit The limit parameter to overwrite the size to fetch pages.
94
+ * @param options.start The start parameter to set inital offset to fetch pages.
92
95
  * @returns Promise resolving to an array of Document instances.
93
96
  */
94
- async load() {
97
+ async load(options) {
95
98
  try {
96
- const pages = await this.fetchAllPagesInSpace();
99
+ const pages = await this.fetchAllPagesInSpace(options?.start, options?.limit);
97
100
  return pages.map((page) => this.createDocumentFromPage(page));
98
101
  }
99
102
  catch (error) {
@@ -133,14 +136,14 @@ export class ConfluencePagesLoader extends BaseDocumentLoader {
133
136
  * @param start The start parameter to paginate through the results.
134
137
  * @returns Promise resolving to an array of ConfluencePage objects.
135
138
  */
136
- async fetchAllPagesInSpace(start = 0) {
137
- const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${this.limit}&start=${start}&expand=${this.expand}`;
139
+ async fetchAllPagesInSpace(start = 0, limit = this.limit) {
140
+ const url = `${this.baseUrl}/rest/api/content?spaceKey=${this.spaceKey}&limit=${limit}&start=${start}&expand=${this.expand}`;
138
141
  const data = await this.fetchConfluenceData(url);
139
142
  if (data.size === 0) {
140
143
  return [];
141
144
  }
142
145
  const nextPageStart = start + data.size;
143
- const nextPageResults = await this.fetchAllPagesInSpace(nextPageStart);
146
+ const nextPageResults = await this.fetchAllPagesInSpace(nextPageStart, limit);
144
147
  return data.results.concat(nextPageResults);
145
148
  }
146
149
  /**
@@ -1,94 +1,23 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyntheticEmbeddings = exports.FakeEmbeddings = void 0;
4
- const embeddings_1 = require("@langchain/core/embeddings");
5
- /**
6
- * A class that provides fake embeddings by overriding the embedDocuments
7
- * and embedQuery methods to return fixed values.
8
- */
9
- class FakeEmbeddings extends embeddings_1.Embeddings {
10
- constructor(params) {
11
- super(params ?? {});
12
- }
13
- /**
14
- * Generates fixed embeddings for a list of documents.
15
- * @param documents List of documents to generate embeddings for.
16
- * @returns A promise that resolves with a list of fixed embeddings for each document.
17
- */
18
- embedDocuments(documents) {
19
- return Promise.resolve(documents.map(() => [0.1, 0.2, 0.3, 0.4]));
20
- }
21
- /**
22
- * Generates a fixed embedding for a query.
23
- * @param _ The query to generate an embedding for.
24
- * @returns A promise that resolves with a fixed embedding for the query.
25
- */
26
- embedQuery(_) {
27
- return Promise.resolve([0.1, 0.2, 0.3, 0.4]);
28
- }
29
- }
30
- exports.FakeEmbeddings = FakeEmbeddings;
31
- /**
32
- * A class that provides synthetic embeddings by overriding the
33
- * embedDocuments and embedQuery methods to generate embeddings based on
34
- * the input documents. The embeddings are generated by converting each
35
- * document into chunks, calculating a numerical value for each chunk, and
36
- * returning an array of these values as the embedding.
37
- */
38
- class SyntheticEmbeddings extends embeddings_1.Embeddings {
39
- constructor(params) {
40
- super(params ?? {});
41
- Object.defineProperty(this, "vectorSize", {
42
- enumerable: true,
43
- configurable: true,
44
- writable: true,
45
- value: void 0
46
- });
47
- this.vectorSize = params?.vectorSize ?? 4;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
48
7
  }
49
- /**
50
- * Generates synthetic embeddings for a list of documents.
51
- * @param documents List of documents to generate embeddings for.
52
- * @returns A promise that resolves with a list of synthetic embeddings for each document.
53
- */
54
- async embedDocuments(documents) {
55
- return Promise.all(documents.map((doc) => this.embedQuery(doc)));
56
- }
57
- /**
58
- * Generates a synthetic embedding for a document. The document is
59
- * converted into chunks, a numerical value is calculated for each chunk,
60
- * and an array of these values is returned as the embedding.
61
- * @param document The document to generate an embedding for.
62
- * @returns A promise that resolves with a synthetic embedding for the document.
63
- */
64
- async embedQuery(document) {
65
- let doc = document;
66
- // Only use the letters (and space) from the document, and make them lower case
67
- doc = doc.toLowerCase().replaceAll(/[^a-z ]/g, "");
68
- // Pad the document to make sure it has a divisible number of chunks
69
- const padMod = doc.length % this.vectorSize;
70
- const padGapSize = padMod === 0 ? 0 : this.vectorSize - padMod;
71
- const padSize = doc.length + padGapSize;
72
- doc = doc.padEnd(padSize, " ");
73
- // Break it into chunks
74
- const chunkSize = doc.length / this.vectorSize;
75
- const docChunk = [];
76
- for (let co = 0; co < doc.length; co += chunkSize) {
77
- docChunk.push(doc.slice(co, co + chunkSize));
78
- }
79
- // Turn each chunk into a number
80
- const ret = docChunk.map((s) => {
81
- let sum = 0;
82
- // Get a total value by adding the value of each character in the string
83
- for (let co = 0; co < s.length; co += 1) {
84
- sum += s === " " ? 0 : s.charCodeAt(co);
85
- }
86
- // Reduce this to a number between 0 and 25 inclusive
87
- // Then get the fractional number by dividing it by 26
88
- const ret = (sum % 26) / 26;
89
- return ret;
90
- });
91
- return ret;
92
- }
93
- }
94
- exports.SyntheticEmbeddings = SyntheticEmbeddings;
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const entrypoint_deprecation_js_1 = require("../util/entrypoint_deprecation.cjs");
18
+ __exportStar(require("@langchain/core/utils/testing"), exports);
19
+ /* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion010MigrationWarning)({
20
+ oldEntrypointName: "embeddings/fake",
21
+ newEntrypointName: "utils/testing",
22
+ newPackageName: "@langchain/core",
23
+ });
@@ -1,53 +1 @@
1
- import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings";
2
- /**
3
- * A class that provides fake embeddings by overriding the embedDocuments
4
- * and embedQuery methods to return fixed values.
5
- */
6
- export declare class FakeEmbeddings extends Embeddings {
7
- constructor(params?: EmbeddingsParams);
8
- /**
9
- * Generates fixed embeddings for a list of documents.
10
- * @param documents List of documents to generate embeddings for.
11
- * @returns A promise that resolves with a list of fixed embeddings for each document.
12
- */
13
- embedDocuments(documents: string[]): Promise<number[][]>;
14
- /**
15
- * Generates a fixed embedding for a query.
16
- * @param _ The query to generate an embedding for.
17
- * @returns A promise that resolves with a fixed embedding for the query.
18
- */
19
- embedQuery(_: string): Promise<number[]>;
20
- }
21
- /**
22
- * An interface that defines additional parameters specific to the
23
- * SyntheticEmbeddings class.
24
- */
25
- interface SyntheticEmbeddingsParams extends EmbeddingsParams {
26
- vectorSize: number;
27
- }
28
- /**
29
- * A class that provides synthetic embeddings by overriding the
30
- * embedDocuments and embedQuery methods to generate embeddings based on
31
- * the input documents. The embeddings are generated by converting each
32
- * document into chunks, calculating a numerical value for each chunk, and
33
- * returning an array of these values as the embedding.
34
- */
35
- export declare class SyntheticEmbeddings extends Embeddings implements SyntheticEmbeddingsParams {
36
- vectorSize: number;
37
- constructor(params?: SyntheticEmbeddingsParams);
38
- /**
39
- * Generates synthetic embeddings for a list of documents.
40
- * @param documents List of documents to generate embeddings for.
41
- * @returns A promise that resolves with a list of synthetic embeddings for each document.
42
- */
43
- embedDocuments(documents: string[]): Promise<number[][]>;
44
- /**
45
- * Generates a synthetic embedding for a document. The document is
46
- * converted into chunks, a numerical value is calculated for each chunk,
47
- * and an array of these values is returned as the embedding.
48
- * @param document The document to generate an embedding for.
49
- * @returns A promise that resolves with a synthetic embedding for the document.
50
- */
51
- embedQuery(document: string): Promise<number[]>;
52
- }
53
- export {};
1
+ export * from "@langchain/core/utils/testing";
@@ -1,89 +1,7 @@
1
- import { Embeddings } from "@langchain/core/embeddings";
2
- /**
3
- * A class that provides fake embeddings by overriding the embedDocuments
4
- * and embedQuery methods to return fixed values.
5
- */
6
- export class FakeEmbeddings extends Embeddings {
7
- constructor(params) {
8
- super(params ?? {});
9
- }
10
- /**
11
- * Generates fixed embeddings for a list of documents.
12
- * @param documents List of documents to generate embeddings for.
13
- * @returns A promise that resolves with a list of fixed embeddings for each document.
14
- */
15
- embedDocuments(documents) {
16
- return Promise.resolve(documents.map(() => [0.1, 0.2, 0.3, 0.4]));
17
- }
18
- /**
19
- * Generates a fixed embedding for a query.
20
- * @param _ The query to generate an embedding for.
21
- * @returns A promise that resolves with a fixed embedding for the query.
22
- */
23
- embedQuery(_) {
24
- return Promise.resolve([0.1, 0.2, 0.3, 0.4]);
25
- }
26
- }
27
- /**
28
- * A class that provides synthetic embeddings by overriding the
29
- * embedDocuments and embedQuery methods to generate embeddings based on
30
- * the input documents. The embeddings are generated by converting each
31
- * document into chunks, calculating a numerical value for each chunk, and
32
- * returning an array of these values as the embedding.
33
- */
34
- export class SyntheticEmbeddings extends Embeddings {
35
- constructor(params) {
36
- super(params ?? {});
37
- Object.defineProperty(this, "vectorSize", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: void 0
42
- });
43
- this.vectorSize = params?.vectorSize ?? 4;
44
- }
45
- /**
46
- * Generates synthetic embeddings for a list of documents.
47
- * @param documents List of documents to generate embeddings for.
48
- * @returns A promise that resolves with a list of synthetic embeddings for each document.
49
- */
50
- async embedDocuments(documents) {
51
- return Promise.all(documents.map((doc) => this.embedQuery(doc)));
52
- }
53
- /**
54
- * Generates a synthetic embedding for a document. The document is
55
- * converted into chunks, a numerical value is calculated for each chunk,
56
- * and an array of these values is returned as the embedding.
57
- * @param document The document to generate an embedding for.
58
- * @returns A promise that resolves with a synthetic embedding for the document.
59
- */
60
- async embedQuery(document) {
61
- let doc = document;
62
- // Only use the letters (and space) from the document, and make them lower case
63
- doc = doc.toLowerCase().replaceAll(/[^a-z ]/g, "");
64
- // Pad the document to make sure it has a divisible number of chunks
65
- const padMod = doc.length % this.vectorSize;
66
- const padGapSize = padMod === 0 ? 0 : this.vectorSize - padMod;
67
- const padSize = doc.length + padGapSize;
68
- doc = doc.padEnd(padSize, " ");
69
- // Break it into chunks
70
- const chunkSize = doc.length / this.vectorSize;
71
- const docChunk = [];
72
- for (let co = 0; co < doc.length; co += chunkSize) {
73
- docChunk.push(doc.slice(co, co + chunkSize));
74
- }
75
- // Turn each chunk into a number
76
- const ret = docChunk.map((s) => {
77
- let sum = 0;
78
- // Get a total value by adding the value of each character in the string
79
- for (let co = 0; co < s.length; co += 1) {
80
- sum += s === " " ? 0 : s.charCodeAt(co);
81
- }
82
- // Reduce this to a number between 0 and 25 inclusive
83
- // Then get the fractional number by dividing it by 26
84
- const ret = (sum % 26) / 26;
85
- return ret;
86
- });
87
- return ret;
88
- }
89
- }
1
+ import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
2
+ export * from "@langchain/core/utils/testing";
3
+ /* #__PURE__ */ logVersion010MigrationWarning({
4
+ oldEntrypointName: "embeddings/fake",
5
+ newEntrypointName: "utils/testing",
6
+ newPackageName: "@langchain/core",
7
+ });
@@ -32,7 +32,12 @@ class CustomFormatPromptTemplate extends prompts_1.PromptTemplate {
32
32
  if (this.partialVariables) {
33
33
  totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));
34
34
  }
35
- this.templateValidator(this.template, totalInputVariables);
35
+ if (typeof this.template === "string") {
36
+ this.templateValidator(this.template, totalInputVariables);
37
+ }
38
+ else {
39
+ throw new Error(`Must pass in string as template. Received: ${this.template}`);
40
+ }
36
41
  }
37
42
  }
38
43
  /**
@@ -62,7 +67,12 @@ class CustomFormatPromptTemplate extends prompts_1.PromptTemplate {
62
67
  */
63
68
  async format(values) {
64
69
  const allValues = await this.mergePartialAndUserVariables(values);
65
- return this.renderer(this.template, allValues);
70
+ if (typeof this.template === "string") {
71
+ return this.renderer(this.template, allValues);
72
+ }
73
+ else {
74
+ throw new Error(`Must pass in string as template. Received: ${this.template}`);
75
+ }
66
76
  }
67
77
  }
68
78
  exports.CustomFormatPromptTemplate = CustomFormatPromptTemplate;
@@ -29,7 +29,12 @@ export class CustomFormatPromptTemplate extends PromptTemplate {
29
29
  if (this.partialVariables) {
30
30
  totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));
31
31
  }
32
- this.templateValidator(this.template, totalInputVariables);
32
+ if (typeof this.template === "string") {
33
+ this.templateValidator(this.template, totalInputVariables);
34
+ }
35
+ else {
36
+ throw new Error(`Must pass in string as template. Received: ${this.template}`);
37
+ }
33
38
  }
34
39
  }
35
40
  /**
@@ -59,6 +64,11 @@ export class CustomFormatPromptTemplate extends PromptTemplate {
59
64
  */
60
65
  async format(values) {
61
66
  const allValues = await this.mergePartialAndUserVariables(values);
62
- return this.renderer(this.template, allValues);
67
+ if (typeof this.template === "string") {
68
+ return this.renderer(this.template, allValues);
69
+ }
70
+ else {
71
+ throw new Error(`Must pass in string as template. Received: ${this.template}`);
72
+ }
63
73
  }
64
74
  }