langchain 0.0.15 → 0.0.17

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 (87) hide show
  1. package/dist/agents/agent_toolkits/index.d.ts +4 -3
  2. package/dist/agents/agent_toolkits/index.js +4 -3
  3. package/dist/agents/agent_toolkits/index.js.map +1 -1
  4. package/dist/agents/agent_toolkits/{json.d.ts → json/json.d.ts} +5 -5
  5. package/dist/agents/agent_toolkits/{json.js → json/json.js} +5 -5
  6. package/dist/agents/agent_toolkits/json/json.js.map +1 -0
  7. package/dist/agents/agent_toolkits/json/prompt.d.ts +2 -0
  8. package/dist/agents/agent_toolkits/json/prompt.js +25 -0
  9. package/dist/agents/agent_toolkits/json/prompt.js.map +1 -0
  10. package/dist/agents/agent_toolkits/{openapi.d.ts → openapi/openapi.d.ts} +6 -6
  11. package/dist/agents/agent_toolkits/{openapi.js → openapi/openapi.js} +6 -6
  12. package/dist/agents/agent_toolkits/openapi/openapi.js.map +1 -0
  13. package/dist/agents/agent_toolkits/openapi/prompt.d.ts +3 -0
  14. package/dist/agents/agent_toolkits/openapi/prompt.js +30 -0
  15. package/dist/agents/agent_toolkits/openapi/prompt.js.map +1 -0
  16. package/dist/agents/agent_toolkits/sql/prompt.d.ts +2 -0
  17. package/dist/agents/agent_toolkits/sql/prompt.js +18 -0
  18. package/dist/agents/agent_toolkits/sql/prompt.js.map +1 -0
  19. package/dist/agents/agent_toolkits/{sql.d.ts → sql/sql.d.ts} +5 -5
  20. package/dist/agents/agent_toolkits/{sql.js → sql/sql.js} +6 -6
  21. package/dist/agents/agent_toolkits/sql/sql.js.map +1 -0
  22. package/dist/agents/agent_toolkits/vectorstore/prompt.d.ts +2 -0
  23. package/dist/agents/agent_toolkits/vectorstore/prompt.js +9 -0
  24. package/dist/agents/agent_toolkits/vectorstore/prompt.js.map +1 -0
  25. package/dist/agents/agent_toolkits/vectorstore/vectorstore.d.ts +24 -0
  26. package/dist/agents/agent_toolkits/vectorstore/vectorstore.js +103 -0
  27. package/dist/agents/agent_toolkits/vectorstore/vectorstore.js.map +1 -0
  28. package/dist/agents/index.d.ts +1 -1
  29. package/dist/agents/index.js +1 -1
  30. package/dist/agents/index.js.map +1 -1
  31. package/dist/agents/tools/index.d.ts +1 -0
  32. package/dist/agents/tools/index.js +1 -0
  33. package/dist/agents/tools/index.js.map +1 -1
  34. package/dist/agents/tools/vectorstore.d.ts +19 -0
  35. package/dist/agents/tools/vectorstore.js +49 -0
  36. package/dist/agents/tools/vectorstore.js.map +1 -0
  37. package/dist/chains/combine_docs_chain.js +5 -3
  38. package/dist/chains/combine_docs_chain.js.map +1 -1
  39. package/dist/chains/llm_chain.js +1 -1
  40. package/dist/chains/llm_chain.js.map +1 -1
  41. package/dist/document_loaders/tests/{college_confidential.test.js → college_confidential.int.test.js} +1 -1
  42. package/dist/document_loaders/tests/college_confidential.int.test.js.map +1 -0
  43. package/dist/embeddings/index.d.ts +1 -0
  44. package/dist/embeddings/index.js +1 -0
  45. package/dist/embeddings/index.js.map +1 -1
  46. package/dist/prompts/base.d.ts +7 -1
  47. package/dist/prompts/base.js +22 -0
  48. package/dist/prompts/base.js.map +1 -1
  49. package/dist/prompts/few_shot.d.ts +3 -2
  50. package/dist/prompts/few_shot.js +18 -4
  51. package/dist/prompts/few_shot.js.map +1 -1
  52. package/dist/prompts/index.d.ts +1 -1
  53. package/dist/prompts/index.js.map +1 -1
  54. package/dist/prompts/prompt.d.ts +3 -2
  55. package/dist/prompts/prompt.js +17 -3
  56. package/dist/prompts/prompt.js.map +1 -1
  57. package/dist/prompts/tests/few_shot.test.d.ts +1 -0
  58. package/dist/prompts/tests/few_shot.test.js +63 -0
  59. package/dist/prompts/tests/few_shot.test.js.map +1 -0
  60. package/dist/prompts/tests/load.test.js +2 -2
  61. package/dist/prompts/tests/load.test.js.map +1 -1
  62. package/dist/prompts/tests/prompt.test.d.ts +1 -0
  63. package/dist/prompts/tests/prompt.test.js +38 -0
  64. package/dist/prompts/tests/prompt.test.js.map +1 -0
  65. package/dist/util/axios-fetch-adapter.js +150 -4
  66. package/dist/util/axios-fetch-adapter.js.map +1 -1
  67. package/dist/vectorstores/index.d.ts +1 -0
  68. package/dist/vectorstores/index.js +1 -0
  69. package/dist/vectorstores/index.js.map +1 -1
  70. package/dist/vectorstores/pinecone.d.ts +5 -4
  71. package/dist/vectorstores/pinecone.js +15 -7
  72. package/dist/vectorstores/pinecone.js.map +1 -1
  73. package/dist/vectorstores/tests/pinecone.int.test.d.ts +1 -0
  74. package/dist/vectorstores/tests/pinecone.int.test.js +41 -0
  75. package/dist/vectorstores/tests/pinecone.int.test.js.map +1 -0
  76. package/dist/vectorstores/tests/pinecone.test.d.ts +1 -0
  77. package/dist/vectorstores/tests/pinecone.test.js +34 -0
  78. package/dist/vectorstores/tests/pinecone.test.js.map +1 -0
  79. package/package.json +1 -1
  80. package/dist/agents/agent_toolkits/json.js.map +0 -1
  81. package/dist/agents/agent_toolkits/openapi.js.map +0 -1
  82. package/dist/agents/agent_toolkits/prompt.d.ts +0 -7
  83. package/dist/agents/agent_toolkits/prompt.js +0 -71
  84. package/dist/agents/agent_toolkits/prompt.js.map +0 -1
  85. package/dist/agents/agent_toolkits/sql.js.map +0 -1
  86. package/dist/document_loaders/tests/college_confidential.test.js.map +0 -1
  87. /package/dist/document_loaders/tests/{college_confidential.test.d.ts → college_confidential.int.test.d.ts} +0 -0
@@ -1,3 +1,4 @@
1
- export { JsonToolkit, createJsonAgent } from "./json.js";
2
- export { SqlToolkit, createSqlAgent } from "./sql.js";
3
- export { RequestsToolkit, OpenApiToolkit, createOpenApiAgent, } from "./openapi.js";
1
+ export { JsonToolkit, createJsonAgent } from "./json/json.js";
2
+ export { SqlToolkit, createSqlAgent } from "./sql/sql.js";
3
+ export { RequestsToolkit, OpenApiToolkit, createOpenApiAgent, } from "./openapi/openapi.js";
4
+ export { VectorStoreInfo, VectorStoreToolkit, VectorStoreRouterToolkit, createVectorStoreAgent, createVectorStoreRouterAgent, } from "./vectorstore/vectorstore.js";
@@ -1,4 +1,5 @@
1
- export { JsonToolkit, createJsonAgent } from "./json.js";
2
- export { SqlToolkit, createSqlAgent } from "./sql.js";
3
- export { RequestsToolkit, OpenApiToolkit, createOpenApiAgent, } from "./openapi.js";
1
+ export { JsonToolkit, createJsonAgent } from "./json/json.js";
2
+ export { SqlToolkit, createSqlAgent } from "./sql/sql.js";
3
+ export { RequestsToolkit, OpenApiToolkit, createOpenApiAgent, } from "./openapi/openapi.js";
4
+ export { VectorStoreToolkit, VectorStoreRouterToolkit, createVectorStoreAgent, createVectorStoreRouterAgent, } from "./vectorstore/vectorstore.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/agent_toolkits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/agent_toolkits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC"}
@@ -1,8 +1,8 @@
1
- import { BaseLLM } from "../../llms/index.js";
2
- import { JsonSpec, Tool } from "../tools/index.js";
3
- import { CreatePromptArgs } from "../mrkl/index.js";
4
- import { Toolkit } from "./base.js";
5
- import { AgentExecutor } from "../executor.js";
1
+ import { BaseLLM } from "../../../llms/index.js";
2
+ import { JsonSpec, Tool } from "../../tools/index.js";
3
+ import { CreatePromptArgs } from "../../mrkl/index.js";
4
+ import { Toolkit } from "../base.js";
5
+ import { AgentExecutor } from "../../executor.js";
6
6
  export declare class JsonToolkit extends Toolkit {
7
7
  jsonSpec: JsonSpec;
8
8
  tools: Tool[];
@@ -1,9 +1,9 @@
1
- import { JsonGetValueTool, JsonListKeysTool, } from "../tools/index.js";
1
+ import { JsonGetValueTool, JsonListKeysTool, } from "../../tools/index.js";
2
2
  import { JSON_PREFIX, JSON_SUFFIX } from "./prompt.js";
3
- import { LLMChain } from "../../chains/index.js";
4
- import { ZeroShotAgent } from "../mrkl/index.js";
5
- import { Toolkit } from "./base.js";
6
- import { AgentExecutor } from "../executor.js";
3
+ import { LLMChain } from "../../../chains/index.js";
4
+ import { ZeroShotAgent } from "../../mrkl/index.js";
5
+ import { Toolkit } from "../base.js";
6
+ import { AgentExecutor } from "../../executor.js";
7
7
  export class JsonToolkit extends Toolkit {
8
8
  constructor(jsonSpec) {
9
9
  super();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/json/json.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAGtC,YAAmB,QAAkB;QACnC,KAAK,EAAE,CAAC;;;;;mBADS;;QAFnB;;;;;WAAc;QAIZ,IAAI,CAAC,KAAK,GAAG;YACX,IAAI,gBAAgB,CAAC,QAAQ,CAAC;YAC9B,IAAI,gBAAgB,CAAC,QAAQ,CAAC;SAC/B,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,eAAe,CAC7B,GAAY,EACZ,OAAoB,EACpB,IAAuB;IAEvB,MAAM,EACJ,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,WAAW,EACpB,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAC/C,GAAG,IAAI,IAAI,EAAE,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE;QAC/C,MAAM;QACN,MAAM;QACN,cAAc;KACf,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC;QAC9B,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KACvC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,iBAAiB,CAAC;QACrC,KAAK;QACL,KAAK;QACL,uBAAuB,EAAE,IAAI;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const JSON_PREFIX = "You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the following tools which help you learn more about the JSON you are interacting with.\nOnly use the below tools. Only use the information returned by the below tools to construct your final answer.\nDo not make up any information that is not contained in the JSON.\nYour input to the tools should be in the form of in json pointer syntax (e.g. /key1/0/key2).\nYou must escape a slash in a key with a ~1, and escape a tilde with a ~0.\nFor example, to access the key /foo, you would use /~1foo\nYou should only use keys that you know for a fact exist. You must validate that a key exists by seeing it previously when calling 'json_list_keys'.\nIf you have not seen a key in one of those responses, you cannot use it.\nYou should only add one key at a time to the path. You cannot add multiple keys at once.\nIf you encounter a null or undefined value, go back to the previous key, look at the available keys, and try again.\n\nIf the question does not seem to be related to the JSON, just return \"I don't know\" as the answer.\nAlways begin your interaction with the 'json_list_keys' with an empty string as the input to see what keys exist in the JSON.\n\nNote that sometimes the value at a given path is large. In this case, you will get an error \"Value is a large dictionary, should explore its keys directly\".\nIn this case, you should ALWAYS follow up by using the 'json_list_keys' tool to see what keys exist at that path.\nDo not simply refer the user to the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.";
2
+ export declare const JSON_SUFFIX = "Begin!\"\n\nQuestion: {input}\nThought: I should look at the keys that exist to see what I can query. I should use the 'json_list_keys' tool with an empty string as the input.\n{agent_scratchpad}";
@@ -0,0 +1,25 @@
1
+ export const JSON_PREFIX = `You are an agent designed to interact with JSON.
2
+ Your goal is to return a final answer by interacting with the JSON.
3
+ You have access to the following tools which help you learn more about the JSON you are interacting with.
4
+ Only use the below tools. Only use the information returned by the below tools to construct your final answer.
5
+ Do not make up any information that is not contained in the JSON.
6
+ Your input to the tools should be in the form of in json pointer syntax (e.g. /key1/0/key2).
7
+ You must escape a slash in a key with a ~1, and escape a tilde with a ~0.
8
+ For example, to access the key /foo, you would use /~1foo
9
+ You should only use keys that you know for a fact exist. You must validate that a key exists by seeing it previously when calling 'json_list_keys'.
10
+ If you have not seen a key in one of those responses, you cannot use it.
11
+ You should only add one key at a time to the path. You cannot add multiple keys at once.
12
+ If you encounter a null or undefined value, go back to the previous key, look at the available keys, and try again.
13
+
14
+ If the question does not seem to be related to the JSON, just return "I don't know" as the answer.
15
+ Always begin your interaction with the 'json_list_keys' with an empty string as the input to see what keys exist in the JSON.
16
+
17
+ Note that sometimes the value at a given path is large. In this case, you will get an error "Value is a large dictionary, should explore its keys directly".
18
+ In this case, you should ALWAYS follow up by using the 'json_list_keys' tool to see what keys exist at that path.
19
+ Do not simply refer the user to the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.`;
20
+ export const JSON_SUFFIX = `Begin!"
21
+
22
+ Question: {input}
23
+ Thought: I should look at the keys that exist to see what I can query. I should use the 'json_list_keys' tool with an empty string as the input.
24
+ {agent_scratchpad}`;
25
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/json/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;mKAkBwI,CAAC;AAEpK,MAAM,CAAC,MAAM,WAAW,GAAG;;;;mBAIR,CAAC"}
@@ -1,9 +1,9 @@
1
- import { BaseLLM } from "../../llms/index.js";
2
- import { JsonSpec, Tool } from "../tools/index.js";
3
- import { AgentExecutor } from "../executor.js";
4
- import { CreatePromptArgs } from "../mrkl/index.js";
5
- import { Toolkit } from "./base.js";
6
- import { Headers } from "../tools/requests.js";
1
+ import { BaseLLM } from "../../../llms/index.js";
2
+ import { JsonSpec, Tool } from "../../tools/index.js";
3
+ import { AgentExecutor } from "../../executor.js";
4
+ import { CreatePromptArgs } from "../../mrkl/index.js";
5
+ import { Toolkit } from "../base.js";
6
+ import { Headers } from "../../tools/requests.js";
7
7
  export declare class RequestsToolkit extends Toolkit {
8
8
  tools: Tool[];
9
9
  constructor(headers?: Headers);
@@ -1,10 +1,10 @@
1
- import { DynamicTool, RequestsGetTool, RequestsPostTool, } from "../tools/index.js";
2
- import { AgentExecutor } from "../executor.js";
1
+ import { DynamicTool, RequestsGetTool, RequestsPostTool, } from "../../tools/index.js";
2
+ import { AgentExecutor } from "../../executor.js";
3
3
  import { OPENAPI_PREFIX, OPENAPI_SUFFIX, JSON_EXPLORER_DESCRIPTION, } from "./prompt.js";
4
- import { LLMChain } from "../../chains/index.js";
5
- import { ZeroShotAgent } from "../mrkl/index.js";
6
- import { Toolkit } from "./base.js";
7
- import { createJsonAgent, JsonToolkit } from "./json.js";
4
+ import { LLMChain } from "../../../chains/index.js";
5
+ import { ZeroShotAgent } from "../../mrkl/index.js";
6
+ import { Toolkit } from "../base.js";
7
+ import { createJsonAgent, JsonToolkit } from "../json/json.js";
8
8
  export class RequestsToolkit extends Toolkit {
9
9
  constructor(headers) {
10
10
  super();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/openapi/openapi.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAEX,eAAe,EACf,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,OAAO,eAAgB,SAAQ,OAAO;IAG1C,YAAY,OAAiB;QAC3B,KAAK,EAAE,CAAC;QAHV;;;;;WAAc;QAIZ,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,eAAe;IACjD,YAAY,QAAkB,EAAE,GAAY,EAAE,OAAiB;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,EAAE,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,IAAI,WAAW,CAAC;gBACd,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,KAAK,EAAE,KAAa,EAAE,EAAE;oBAC5B,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;oBAC/C,OAAO,MAAM,CAAC,MAAgB,CAAC;gBACjC,CAAC;gBACD,WAAW,EAAE,yBAAyB;aACvC,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAChC,GAAY,EACZ,cAA8B,EAC9B,IAAuB;IAEvB,MAAM,EACJ,MAAM,GAAG,cAAc,EACvB,MAAM,GAAG,cAAc,EACvB,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAC/C,GAAG,IAAI,IAAI,EAAE,CAAC;IAEf,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC;IACjC,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE;QAC/C,MAAM;QACN,MAAM;QACN,cAAc;KACf,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC;QACzB,MAAM;QACN,GAAG;KACJ,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;IAC9E,OAAO,aAAa,CAAC,iBAAiB,CAAC;QACrC,KAAK;QACL,KAAK;QACL,uBAAuB,EAAE,IAAI;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const OPENAPI_PREFIX = "You are an agent designed to answer questions by making web requests to an API given the OpenAPI spec.\n\nIf the question does not seem related to the API, return I don't know. Do not make up an answer.\nOnly use information provided by the tools to construct your response.\n\nTo find information in the OpenAPI spec, use the 'json_explorer' tool. The input to this tool is a question about the API.\n\nTake the following steps:\nFirst, find the base URL needed to make the request.\n\nSecond, find the relevant paths needed to answer the question. Take note that, sometimes, you might need to make more than one request to more than one path to answer the question.\n\nThird, find the required parameters needed to make the request. For GET requests, these are usually URL parameters and for POST requests, these are request body parameters.\n\nFourth, make the requests needed to answer the question. Ensure that you are sending the correct parameters to the request by checking which parameters are required. For parameters with a fixed set of values, please use the spec to look at which values are allowed.\n\nUse the exact parameter names as listed in the spec, do not make up any names or abbreviate the names of parameters.\nIf you get a not found error, ensure that you are using a path that actually exists in the spec.";
2
+ export declare const OPENAPI_SUFFIX = "Begin!\"\n\nQuestion: {input}\nThought: I should explore the spec to find the base url for the API.\n{agent_scratchpad}";
3
+ export declare const JSON_EXPLORER_DESCRIPTION = "\nCan be used to answer questions about the openapi spec for the API. Always use this tool before trying to make a request. \nExample inputs to this tool: \n 'What are the required query parameters for a GET request to the /bar endpoint?'\n 'What are the required parameters in the request body for a POST request to the /foo endpoint?'\nAlways give this tool a specific question.";
@@ -0,0 +1,30 @@
1
+ export const OPENAPI_PREFIX = `You are an agent designed to answer questions by making web requests to an API given the OpenAPI spec.
2
+
3
+ If the question does not seem related to the API, return I don't know. Do not make up an answer.
4
+ Only use information provided by the tools to construct your response.
5
+
6
+ To find information in the OpenAPI spec, use the 'json_explorer' tool. The input to this tool is a question about the API.
7
+
8
+ Take the following steps:
9
+ First, find the base URL needed to make the request.
10
+
11
+ Second, find the relevant paths needed to answer the question. Take note that, sometimes, you might need to make more than one request to more than one path to answer the question.
12
+
13
+ Third, find the required parameters needed to make the request. For GET requests, these are usually URL parameters and for POST requests, these are request body parameters.
14
+
15
+ Fourth, make the requests needed to answer the question. Ensure that you are sending the correct parameters to the request by checking which parameters are required. For parameters with a fixed set of values, please use the spec to look at which values are allowed.
16
+
17
+ Use the exact parameter names as listed in the spec, do not make up any names or abbreviate the names of parameters.
18
+ If you get a not found error, ensure that you are using a path that actually exists in the spec.`;
19
+ export const OPENAPI_SUFFIX = `Begin!"
20
+
21
+ Question: {input}
22
+ Thought: I should explore the spec to find the base url for the API.
23
+ {agent_scratchpad}`;
24
+ export const JSON_EXPLORER_DESCRIPTION = `
25
+ Can be used to answer questions about the openapi spec for the API. Always use this tool before trying to make a request.
26
+ Example inputs to this tool:
27
+ 'What are the required query parameters for a GET request to the /bar endpoint?'
28
+ 'What are the required parameters in the request body for a POST request to the /foo endpoint?'
29
+ Always give this tool a specific question.`;
30
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/openapi/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;iGAiBmE,CAAC;AAElG,MAAM,CAAC,MAAM,cAAc,GAAG;;;;mBAIX,CAAC;AACpB,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;2CAKE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SQL_PREFIX = "You are an agent designed to interact with a SQL database.\nGiven an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.\nUnless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results using the LIMIT clause.\nYou can order the results by a relevant column to return the most interesting examples in the database.\nNever query for all the columns from a specific table, only ask for a the few relevant columns given the question.\nYou have access to tools for interacting with the database.\nOnly use the below tools. Only use the information returned by the below tools to construct your final answer.\nYou MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return \"I don't know\" as the answer.";
2
+ export declare const SQL_SUFFIX = "Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the database to see what I can query.\n{agent_scratchpad}";
@@ -0,0 +1,18 @@
1
+ export const SQL_PREFIX = `You are an agent designed to interact with a SQL database.
2
+ Given an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.
3
+ Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results using the LIMIT clause.
4
+ You can order the results by a relevant column to return the most interesting examples in the database.
5
+ Never query for all the columns from a specific table, only ask for a the few relevant columns given the question.
6
+ You have access to tools for interacting with the database.
7
+ Only use the below tools. Only use the information returned by the below tools to construct your final answer.
8
+ You MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again.
9
+
10
+ DO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.
11
+
12
+ If the question does not seem related to the database, just return "I don't know" as the answer.`;
13
+ export const SQL_SUFFIX = `Begin!
14
+
15
+ Question: {input}
16
+ Thought: I should look at the tables in the database to see what I can query.
17
+ {agent_scratchpad}`;
18
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/sql/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;iGAWuE,CAAC;AAElG,MAAM,CAAC,MAAM,UAAU,GAAG;;;;mBAIP,CAAC"}
@@ -1,8 +1,8 @@
1
- import { Tool, SqlDatabase } from "../tools/index.js";
2
- import { Toolkit } from "./base.js";
3
- import { BaseLLM } from "../../llms/index.js";
4
- import { CreatePromptArgs } from "../mrkl/index.js";
5
- import { AgentExecutor } from "../executor.js";
1
+ import { Tool, SqlDatabase } from "../../tools/index.js";
2
+ import { Toolkit } from "../base.js";
3
+ import { BaseLLM } from "../../../llms/index.js";
4
+ import { CreatePromptArgs } from "../../mrkl/index.js";
5
+ import { AgentExecutor } from "../../executor.js";
6
6
  type SqlCreatePromptArgs = {
7
7
  /** Number of results to return. */
8
8
  topK?: number;
@@ -1,10 +1,10 @@
1
- import { InfoSqlTool, ListTablesSqlTool, QueryCheckerTool, QuerySqlTool, } from "../tools/index.js";
2
- import { Toolkit } from "./base.js";
1
+ import { InfoSqlTool, ListTablesSqlTool, QueryCheckerTool, QuerySqlTool, } from "../../tools/index.js";
2
+ import { Toolkit } from "../base.js";
3
3
  import { SQL_PREFIX, SQL_SUFFIX } from "./prompt.js";
4
- import { interpolateFString } from "../../prompts/template.js";
5
- import { LLMChain } from "../../chains/index.js";
6
- import { ZeroShotAgent } from "../mrkl/index.js";
7
- import { AgentExecutor } from "../executor.js";
4
+ import { interpolateFString } from "../../../prompts/template.js";
5
+ import { LLMChain } from "../../../chains/index.js";
6
+ import { ZeroShotAgent } from "../../mrkl/index.js";
7
+ import { AgentExecutor } from "../../executor.js";
8
8
  export class SqlToolkit extends Toolkit {
9
9
  constructor(db) {
10
10
  super();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/sql/sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOlD,MAAM,OAAO,UAAW,SAAQ,OAAO;IAOrC,YAAY,EAAe;QACzB,KAAK,EAAE,CAAC;QAPV;;;;;WAAc;QAEd;;;;;WAAgB;QAEhB;;;;mBAAU,QAAQ;WAAC;QAIjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACX,IAAI,YAAY,CAAC,EAAE,CAAC;YACpB,IAAI,WAAW,CAAC,EAAE,CAAC;YACnB,IAAI,iBAAiB,CAAC,EAAE,CAAC;YACzB,IAAI,gBAAgB,EAAE;SACvB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,cAAc,CAC5B,GAAY,EACZ,OAAmB,EACnB,IAA0B;IAE1B,MAAM,EACJ,MAAM,GAAG,UAAU,EACnB,MAAM,GAAG,UAAU,EACnB,cAAc,GAAG,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAC9C,IAAI,GAAG,EAAE,GACV,GAAG,IAAI,IAAI,EAAE,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,MAAM,eAAe,GAAG,kBAAkB,CAAC,MAAM,EAAE;QACjD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE;QAC/C,MAAM,EAAE,eAAe;QACvB,MAAM;QACN,cAAc;KACf,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC;QAC9B,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KACvC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,iBAAiB,CAAC;QACrC,KAAK;QACL,KAAK;QACL,uBAAuB,EAAE,IAAI;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const VECTOR_PREFIX = "You are an agent designed to answer questions about sets of documents.\nYou have access to tools for interacting with the documents, and the inputs to the tools are questions.\nSometimes, you will be asked to provide sources for your questions, in which case you should use the appropriate tool to do so.\nIf the question does not seem relevant to any of the tools provided, just return \"I don't know\" as the answer.";
2
+ export declare const VECTOR_ROUTER_PREFIX = "You are an agent designed to answer questions.\nYou have access to tools for interacting with different sources, and the inputs to the tools are questions.\nYour main task is to decide which of the tools is relevant for answering question at hand.\nFor complex questions, you can break the question down into sub questions and use tools to answers the sub questions.";
@@ -0,0 +1,9 @@
1
+ export const VECTOR_PREFIX = `You are an agent designed to answer questions about sets of documents.
2
+ You have access to tools for interacting with the documents, and the inputs to the tools are questions.
3
+ Sometimes, you will be asked to provide sources for your questions, in which case you should use the appropriate tool to do so.
4
+ If the question does not seem relevant to any of the tools provided, just return "I don't know" as the answer.`;
5
+ export const VECTOR_ROUTER_PREFIX = `You are an agent designed to answer questions.
6
+ You have access to tools for interacting with different sources, and the inputs to the tools are questions.
7
+ Your main task is to decide which of the tools is relevant for answering question at hand.
8
+ For complex questions, you can break the question down into sub questions and use tools to answers the sub questions.`;
9
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/vectorstore/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;+GAGkF,CAAC;AAEhH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;sHAGkF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Tool } from "../../tools/index.js";
2
+ import { VectorStore } from "../../../vectorstores/index.js";
3
+ import { Toolkit } from "../base.js";
4
+ import { BaseLLM } from "../../../llms/index.js";
5
+ import { CreatePromptArgs } from "../../mrkl/index.js";
6
+ import { AgentExecutor } from "../../executor.js";
7
+ export interface VectorStoreInfo {
8
+ vectorStore: VectorStore;
9
+ name: string;
10
+ description: string;
11
+ }
12
+ export declare class VectorStoreToolkit extends Toolkit {
13
+ tools: Tool[];
14
+ llm: BaseLLM;
15
+ constructor(vectorStoreInfo: VectorStoreInfo, llm: BaseLLM);
16
+ }
17
+ export declare class VectorStoreRouterToolkit extends Toolkit {
18
+ tools: Tool[];
19
+ vectorStoreInfos: VectorStoreInfo[];
20
+ llm: BaseLLM;
21
+ constructor(vectorStoreInfos: VectorStoreInfo[], llm: BaseLLM);
22
+ }
23
+ export declare function createVectorStoreAgent(llm: BaseLLM, toolkit: VectorStoreToolkit, args?: CreatePromptArgs): AgentExecutor;
24
+ export declare function createVectorStoreRouterAgent(llm: BaseLLM, toolkit: VectorStoreRouterToolkit, args?: CreatePromptArgs): AgentExecutor;
@@ -0,0 +1,103 @@
1
+ import { VectorStoreQATool } from "../../tools/index.js";
2
+ import { Toolkit } from "../base.js";
3
+ import { ZeroShotAgent } from "../../mrkl/index.js";
4
+ import { VECTOR_PREFIX, VECTOR_ROUTER_PREFIX } from "./prompt.js";
5
+ import { SUFFIX } from "../../mrkl/prompt.js";
6
+ import { LLMChain } from "../../../chains/index.js";
7
+ import { AgentExecutor } from "../../executor.js";
8
+ export class VectorStoreToolkit extends Toolkit {
9
+ constructor(vectorStoreInfo, llm) {
10
+ super();
11
+ Object.defineProperty(this, "tools", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: void 0
16
+ });
17
+ Object.defineProperty(this, "llm", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ const description = VectorStoreQATool.getDescription(vectorStoreInfo.name, vectorStoreInfo.description);
24
+ this.llm = llm;
25
+ this.tools = [
26
+ new VectorStoreQATool(vectorStoreInfo.name, description, {
27
+ vectorStore: vectorStoreInfo.vectorStore,
28
+ llm: this.llm,
29
+ }),
30
+ ];
31
+ }
32
+ }
33
+ export class VectorStoreRouterToolkit extends Toolkit {
34
+ constructor(vectorStoreInfos, llm) {
35
+ super();
36
+ Object.defineProperty(this, "tools", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: void 0
41
+ });
42
+ Object.defineProperty(this, "vectorStoreInfos", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: void 0
47
+ });
48
+ Object.defineProperty(this, "llm", {
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ value: void 0
53
+ });
54
+ this.llm = llm;
55
+ this.vectorStoreInfos = vectorStoreInfos;
56
+ this.tools = vectorStoreInfos.map((vectorStoreInfo) => {
57
+ const description = VectorStoreQATool.getDescription(vectorStoreInfo.name, vectorStoreInfo.description);
58
+ return new VectorStoreQATool(vectorStoreInfo.name, description, {
59
+ vectorStore: vectorStoreInfo.vectorStore,
60
+ llm: this.llm,
61
+ });
62
+ });
63
+ }
64
+ }
65
+ export function createVectorStoreAgent(llm, toolkit, args) {
66
+ const { prefix = VECTOR_PREFIX, suffix = SUFFIX, inputVariables = ["input", "agent_scratchpad"], } = args ?? {};
67
+ const { tools } = toolkit;
68
+ const prompt = ZeroShotAgent.createPrompt(tools, {
69
+ prefix,
70
+ suffix,
71
+ inputVariables,
72
+ });
73
+ const chain = new LLMChain({ prompt, llm });
74
+ const agent = new ZeroShotAgent({
75
+ llmChain: chain,
76
+ allowedTools: tools.map((t) => t.name),
77
+ });
78
+ return AgentExecutor.fromAgentAndTools({
79
+ agent,
80
+ tools,
81
+ returnIntermediateSteps: true,
82
+ });
83
+ }
84
+ export function createVectorStoreRouterAgent(llm, toolkit, args) {
85
+ const { prefix = VECTOR_ROUTER_PREFIX, suffix = SUFFIX, inputVariables = ["input", "agent_scratchpad"], } = args ?? {};
86
+ const { tools } = toolkit;
87
+ const prompt = ZeroShotAgent.createPrompt(tools, {
88
+ prefix,
89
+ suffix,
90
+ inputVariables,
91
+ });
92
+ const chain = new LLMChain({ prompt, llm });
93
+ const agent = new ZeroShotAgent({
94
+ llmChain: chain,
95
+ allowedTools: tools.map((t) => t.name),
96
+ });
97
+ return AgentExecutor.fromAgentAndTools({
98
+ agent,
99
+ tools,
100
+ returnIntermediateSteps: true,
101
+ });
102
+ }
103
+ //# sourceMappingURL=vectorstore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorstore.js","sourceRoot":"","sources":["../../../../src/agents/agent_toolkits/vectorstore/vect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CAAC;IACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE;QAC/C,MAAM;QACN,MAAM;QACN,cAAc;KACf,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC;QAC9B,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KACvC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,iBAAiB,CAAC;QACrC,KAAK;QACL,KAAK;QACL,uBAAuB,EAAE,IAAI;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -5,4 +5,4 @@ export { ZeroShotAgent, SerializedZeroShotAgent } from "./mrkl/index.js";
5
5
  export { Tool } from "./tools/index.js";
6
6
  export { initializeAgentExecutor } from "./initialize.js";
7
7
  export { loadAgent } from "./load.js";
8
- export { SqlToolkit, JsonToolkit, RequestsToolkit, OpenApiToolkit, createSqlAgent, createJsonAgent, createOpenApiAgent, } from "./agent_toolkits/index.js";
8
+ export { SqlToolkit, JsonToolkit, RequestsToolkit, OpenApiToolkit, VectorStoreInfo, VectorStoreToolkit, VectorStoreRouterToolkit, createSqlAgent, createJsonAgent, createOpenApiAgent, createVectorStoreAgent, } from "./agent_toolkits/index.js";
@@ -4,5 +4,5 @@ export { ZeroShotAgent } from "./mrkl/index.js";
4
4
  export { Tool } from "./tools/index.js";
5
5
  export { initializeAgentExecutor } from "./initialize.js";
6
6
  export { loadAgent } from "./load.js";
7
- export { SqlToolkit, JsonToolkit, RequestsToolkit, OpenApiToolkit, createSqlAgent, createJsonAgent, createOpenApiAgent, } from "./agent_toolkits/index.js";
7
+ export { SqlToolkit, JsonToolkit, RequestsToolkit, OpenApiToolkit, VectorStoreToolkit, VectorStoreRouterToolkit, createSqlAgent, createJsonAgent, createOpenApiAgent, createVectorStoreAgent, } from "./agent_toolkits/index.js";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,EAAe,gBAAgB,EAAc,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,EAAe,gBAAgB,EAAc,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,cAAc,EAEd,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC"}
@@ -9,3 +9,4 @@ export { ChainTool } from "./chain.js";
9
9
  export { SqlDatabase, QuerySqlTool, InfoSqlTool, ListTablesSqlTool, QueryCheckerTool, } from "./sql.js";
10
10
  export { JsonSpec, JsonListKeysTool, JsonGetValueTool, JsonObject, Json, } from "./json.js";
11
11
  export { RequestsGetTool, RequestsPostTool } from "./requests.js";
12
+ export { VectorStoreQATool } from "./vectorstore.js";
@@ -9,4 +9,5 @@ export { ChainTool } from "./chain.js";
9
9
  export { SqlDatabase, QuerySqlTool, InfoSqlTool, ListTablesSqlTool, QueryCheckerTool, } from "./sql.js";
10
10
  export { JsonSpec, JsonListKeysTool, JsonGetValueTool, } from "./json.js";
11
11
  export { RequestsGetTool, RequestsPostTool } from "./requests.js";
12
+ export { VectorStoreQATool } from "./vectorstore.js";
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { VectorStore } from "../../vectorstores/index.js";
2
+ import { BaseLLM } from "../../llms/index.js";
3
+ import { VectorDBQAChain } from "../../chains/index.js";
4
+ import { Tool } from "./base.js";
5
+ interface VectorStoreTool {
6
+ vectorStore: VectorStore;
7
+ llm: BaseLLM;
8
+ }
9
+ export declare class VectorStoreQATool extends Tool implements VectorStoreTool {
10
+ vectorStore: VectorStore;
11
+ llm: BaseLLM;
12
+ name: string;
13
+ description: string;
14
+ chain: VectorDBQAChain;
15
+ constructor(name: string, description: string, fields: VectorStoreTool);
16
+ static getDescription(name: string, description: string): string;
17
+ call(input: string): Promise<string>;
18
+ }
19
+ export {};
@@ -0,0 +1,49 @@
1
+ import { VectorDBQAChain } from "../../chains/index.js";
2
+ import { Tool } from "./base.js";
3
+ export class VectorStoreQATool extends Tool {
4
+ constructor(name, description, fields) {
5
+ super();
6
+ Object.defineProperty(this, "vectorStore", {
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true,
10
+ value: void 0
11
+ });
12
+ Object.defineProperty(this, "llm", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ Object.defineProperty(this, "name", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
24
+ Object.defineProperty(this, "description", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: void 0
29
+ });
30
+ Object.defineProperty(this, "chain", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: void 0
35
+ });
36
+ this.name = name;
37
+ this.description = description;
38
+ this.vectorStore = fields.vectorStore;
39
+ this.llm = fields.llm;
40
+ this.chain = VectorDBQAChain.fromLLM(this.llm, this.vectorStore);
41
+ }
42
+ static getDescription(name, description) {
43
+ return `Useful for when you need to answer questions about ${name}. Whenever you need information about ${description} you should ALWAYS use this. Input should be a fully formed question.`;
44
+ }
45
+ async call(input) {
46
+ return this.chain.run(input);
47
+ }
48
+ }
49
+ //# sourceMappingURL=vectorstore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorstore.js","sourceRoot":"","sources":["../../../src/agents/tools/vectorstore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,MAAM,OAAO,iBAAkB,SAAQ,IAAI;IAWzC,YAAY,IAAY,EAAE,WAAmB,EAAE,MAAuB;QACpE,KAAK,EAAE,CAAC;QAXV;;;;;WAAyB;QAEzB;;;;;WAAa;QAEb;;;;;WAAa;QAEb;;;;;WAAoB;QAEpB;;;;;WAAuB;QAIrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,IAAY,EAAE,WAAmB;QACrD,OAAO,sDAAsD,IAAI,yCAAyC,WAAW,uEAAuE,CAAC;IAC/L,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF"}
@@ -143,9 +143,11 @@ export class MapReduceDocumentsChain extends BaseChain {
143
143
  [this.documentVariableName]: d.pageContent,
144
144
  ...rest,
145
145
  }));
146
- const length = inputs
147
- .map((i) => this.llmChain.llm.getNumTokens(this.llmChain.prompt.format(i)))
148
- .reduce((a, b) => a + b, 0);
146
+ const promises = inputs.map(async (i) => {
147
+ const prompt = await this.llmChain.prompt.format(i);
148
+ return this.llmChain.llm.getNumTokens(prompt);
149
+ });
150
+ const length = await Promise.all(promises).then((results) => results.reduce((a, b) => a + b, 0));
149
151
  if (length < this.maxTokens) {
150
152
  break;
151
153
  }
@@ -1 +1 @@
1
- {"version":3,"file":"combine_docs_chain.js","sourceRoot":"","sources":["../../src/chains/combine_docs_chain.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,QAAQ,GAGT,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAiBzD;;;;GAIG;AACH,MAAM,OAAO,mBACX,SAAQ,SAAS;IAWjB,IAAI,SAAS;QACX,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,C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,CAAC,SAAS,EAAE;YACpC,sBAAsB,EAAE,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE;SAC9D,CAAC;IACJ,CAAC;CACF"}
@@ -48,7 +48,7 @@ export class LLMChain extends BaseChain {
48
48
  if ("stop" in values && Array.isArray(values.stop)) {
49
49
  stop = values.stop;
50
50
  }
51
- const formattedString = this.prompt.format(values);
51
+ const formattedString = await this.prompt.format(values);
52
52
  const llmResult = await this.llm.call(formattedString, stop);
53
53
  const result = { [this.outputKey]: llmResult };
54
54
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"llm_chain.js","sourceRoot":"","sources":["../../src/chains/llm_chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAc,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAElB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAoBzD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IAOrC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACpC,CAAC;IAED,YAAY,MAKX;QACC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAhBvB;;;;;WAA2B;QAE3B;;;;;WAAa;QAEb;;;;mBAAY,MAAM;WAAC;QAajB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAmB;QAC7B,IAAI,IAAI,CAAC;QACT,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C;SAC/D,CAAC,CAAC;IACL,CAAC;IAED,SAAS;QACP,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;YACxB,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;SAChC,CAAC;IACJ,CAAC;CACF;AAED,mCAAmC;AACnC,MAAM,eAAe,GAAG;;;;;IAKpB,CAAC;AAEL,MAAM,aAAa,GAAG,IAAI,cAAc,CAAC;IACvC,QAAQ,EAAE,eAAe;IACzB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IAC7C,YAAY,MAKX;QACC,KAAK,CAAC;YACJ,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,aAAa;YACtC,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,UAAU;SAC1C,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;IACpD,CAAC;CACF"}
@@ -4,4 +4,4 @@ test("Test College confidential loader", async () => {
4
4
  const loader = new CollegeConfidentialLoader("https://www.collegeconfidential.com/colleges/brown-university/");
5
5
  await loader.load();
6
6
  }, 10000);
7
- //# sourceMappingURL=college_confidential.test.js.map
7
+ //# sourceMappingURL=college_confidential.int.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"college_confidential.int.test.js","sourceRoot":"","sources":["../../../src/document_loaders/tests/college_confidential.int.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,IAAI,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;IAClD,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAC1C,gEAAgE,CACjE,CAAC;IACF,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC,EAAE,KAAK,CAAC,CAAC"}