rhua-chatgpt-web 1.0.97 → 1.0.98

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 (45) hide show
  1. package/dist/{api_chain-D_v8rNtA.cjs → api_chain-CB8GWGIU.cjs} +1 -1
  2. package/dist/{api_chain-BJaZtSTm.js → api_chain-wgmc7e6E.js} +2 -2
  3. package/dist/{combine_docs_chain-Cfoezgfd.js → combine_docs_chain-C4dphi5e.js} +2 -2
  4. package/dist/{combine_docs_chain-C1f3G_BN.cjs → combine_docs_chain-DgONM3Mw.cjs} +1 -1
  5. package/dist/{few_shot-DH27sMBz.js → few_shot-CAlLA7_Y.js} +1 -1
  6. package/dist/{few_shot-BPneupSK.cjs → few_shot-D1R-zNl7.cjs} +1 -1
  7. package/dist/index-ASKx-pn3.js +4 -0
  8. package/dist/index-B-yz5nX2.js +4 -0
  9. package/dist/{index-bN-ZNO_p.js → index-BN7_2Vpx.js} +2 -2
  10. package/dist/{index-qjQr3vyf.js → index-BbYqG4Lp.js} +13 -12
  11. package/dist/{index-rssybcVY.cjs → index-BekrpxaM.cjs} +1 -1
  12. package/dist/{index-CJhHG6mv.js → index-Bg42RK-4.js} +2 -2
  13. package/dist/{index-37BE04rP.js → index-Bg5840_w.js} +1 -1
  14. package/dist/{index-Cspp3lVv.js → index-C1T2elxu.js} +1 -1
  15. package/dist/{index-CCTWqbpP.js → index-CI8OM2Jz.js} +1 -1
  16. package/dist/{index-D4GaYsPf.cjs → index-Cd_gRf5s.cjs} +1 -1
  17. package/dist/{index-B5-iEVAD.cjs → index-CfwXktuP.cjs} +1 -1
  18. package/dist/{index-CaBFHttR.cjs → index-CjSvTRsR.cjs} +1 -1
  19. package/dist/{index-B0IipW5x.cjs → index-CjmBLRKu.cjs} +2 -2
  20. package/dist/index-Ctbtl5KP.js +4 -0
  21. package/dist/index-Cuzto2LI.js +4 -0
  22. package/dist/{index-a9iFyefF.js → index-CymPiKxB.js} +1 -1
  23. package/dist/{index-BMyfK9Gk.cjs → index-D6StpCel.cjs} +1 -1
  24. package/dist/{index-nVDf9eQN.cjs → index-D8gIJjM_.cjs} +1 -1
  25. package/dist/{index-hlfJGExI.cjs → index-DMb9FQJU.cjs} +1 -1
  26. package/dist/{index-CdODFTYE.cjs → index-DWSafnCg.cjs} +1 -1
  27. package/dist/{index-CDeSKvVC.js → index-DrDcayhM.js} +1 -1
  28. package/dist/{index-BH_73y-8.cjs → index-Dt6MdEi3.cjs} +1 -1
  29. package/dist/{index-Cu4BHlkc.cjs → index-cTMOFBXD.cjs} +1 -1
  30. package/dist/{index-CP5oJqNx.cjs → index-r3AjaSlS.cjs} +1 -1
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-F4wjqs8S.js → index.es-67G0dUQ8.js} +11 -11
  33. package/dist/{index.es-aVSEwtwU.cjs → index.es-CtypdcdJ.cjs} +2 -2
  34. package/dist/index.esm.js +1 -1
  35. package/dist/{llm_chain-Bik7eUhN.js → llm_chain-AXaQuXMt.js} +1 -1
  36. package/dist/{llm_chain-CO5bVdNM.cjs → llm_chain-RoYoMcLp.cjs} +1 -1
  37. package/dist/{sequential_chain-aD5yMG3u.cjs → sequential_chain-9yzJVjdz.cjs} +1 -1
  38. package/dist/{sequential_chain-CMAU5dHB.js → sequential_chain-DVxvWiQQ.js} +1 -1
  39. package/dist/{vector_db_qa-DFJfK4iA.cjs → vector_db_qa-4lYMS_5X.cjs} +1 -1
  40. package/dist/{vector_db_qa-CHkKvOu-.js → vector_db_qa-Ca-yXUO_.js} +3 -3
  41. package/package.json +1 -1
  42. package/dist/index-BMuu-n_n.js +0 -4
  43. package/dist/index-C8gRr1kg.js +0 -4
  44. package/dist/index-DkV9Plub.js +0 -4
  45. package/dist/index-ddf_SGpJ.js +0 -4
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B0IipW5x.cjs"),i=require("./llm_chain-CO5bVdNM.cjs");require("zod");const t="You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\nAPI url:",a=new e.PromptTemplate({inputVariables:["api_docs","question"],template:t}),n=`${t} {api_url}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:`,s=new e.PromptTemplate({inputVariables:["api_docs","question","api_url","api_response"],template:n});class r extends e.BaseChain{get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"apiAnswerChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiRequestChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"question"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),this.apiRequestChain=e.apiRequestChain,this.apiAnswerChain=e.apiAnswerChain,this.apiDocs=e.apiDocs,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.headers=e.headers??this.headers}async _call(e,i){const t=e[this.inputKey],a=await this.apiRequestChain.predict({question:t,api_docs:this.apiDocs},null==i?void 0:i.getChild("request")),n=await fetch(a,{headers:this.headers}),s=await n.text(),r=await this.apiAnswerChain.predict({question:t,api_docs:this.apiDocs,api_url:a,api_response:s},null==i?void 0:i.getChild("response"));return{[this.outputKey]:r}}_chainType(){return"api_chain"}static async deserialize(e){const{api_request_chain:t,api_answer_chain:a,api_docs:n}=e;if(!t)throw new Error("LLMChain must have api_request_chain");if(!a)throw new Error("LLMChain must have api_answer_chain");if(!n)throw new Error("LLMChain must have api_docs");return new r({apiAnswerChain:await i.LLMChain.deserialize(a),apiRequestChain:await i.LLMChain.deserialize(t),apiDocs:n})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(e,t,n={}){const{apiUrlPrompt:r=a,apiResponsePrompt:o=s}=n,u=new i.LLMChain({prompt:r,llm:e});return new this({apiAnswerChain:new i.LLMChain({prompt:o,llm:e}),apiRequestChain:u,apiDocs:t,...n})}}exports.APIChain=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjmBLRKu.cjs"),i=require("./llm_chain-RoYoMcLp.cjs");require("zod");const t="You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\nAPI url:",a=new e.PromptTemplate({inputVariables:["api_docs","question"],template:t}),n=`${t} {api_url}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:`,s=new e.PromptTemplate({inputVariables:["api_docs","question","api_url","api_response"],template:n});class r extends e.BaseChain{get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"apiAnswerChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiRequestChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"question"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),this.apiRequestChain=e.apiRequestChain,this.apiAnswerChain=e.apiAnswerChain,this.apiDocs=e.apiDocs,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.headers=e.headers??this.headers}async _call(e,i){const t=e[this.inputKey],a=await this.apiRequestChain.predict({question:t,api_docs:this.apiDocs},null==i?void 0:i.getChild("request")),n=await fetch(a,{headers:this.headers}),s=await n.text(),r=await this.apiAnswerChain.predict({question:t,api_docs:this.apiDocs,api_url:a,api_response:s},null==i?void 0:i.getChild("response"));return{[this.outputKey]:r}}_chainType(){return"api_chain"}static async deserialize(e){const{api_request_chain:t,api_answer_chain:a,api_docs:n}=e;if(!t)throw new Error("LLMChain must have api_request_chain");if(!a)throw new Error("LLMChain must have api_answer_chain");if(!n)throw new Error("LLMChain must have api_docs");return new r({apiAnswerChain:await i.LLMChain.deserialize(a),apiRequestChain:await i.LLMChain.deserialize(t),apiDocs:n})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(e,t,n={}){const{apiUrlPrompt:r=a,apiResponsePrompt:o=s}=n,u=new i.LLMChain({prompt:r,llm:e});return new this({apiAnswerChain:new i.LLMChain({prompt:o,llm:e}),apiRequestChain:u,apiDocs:t,...n})}}exports.APIChain=r;
@@ -1,5 +1,5 @@
1
- import { P as PromptTemplate, i as BaseChain } from "./index-qjQr3vyf.js";
2
- import { LLMChain } from "./llm_chain-Bik7eUhN.js";
1
+ import { P as PromptTemplate, i as BaseChain } from "./index-BbYqG4Lp.js";
2
+ import { LLMChain } from "./llm_chain-AXaQuXMt.js";
3
3
  import "zod";
4
4
  const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
5
5
  {api_docs}
@@ -1,6 +1,6 @@
1
1
  import "zod";
2
- import { i as BaseChain, P as PromptTemplate } from "./index-qjQr3vyf.js";
3
- import { LLMChain } from "./llm_chain-Bik7eUhN.js";
2
+ import { i as BaseChain, P as PromptTemplate } from "./index-BbYqG4Lp.js";
3
+ import { LLMChain } from "./llm_chain-AXaQuXMt.js";
4
4
  class StuffDocumentsChain extends BaseChain {
5
5
  static lc_name() {
6
6
  return "StuffDocumentsChain";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-B0IipW5x.cjs"),t=require("./llm_chain-CO5bVdNM.cjs");class i extends e.BaseChain{static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(e=>e!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),this.llmChain=e.llmChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey}_prepInputs(e){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:t,...i}=e,n=t.map(({pageContent:e})=>e).join("\n\n");return{...i,[this.documentVariableName]:n}}async _call(e,t){return await this.llmChain.call(this._prepInputs(e),null==t?void 0:t.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");return new i({llmChain:await t.LLMChain.deserialize(e.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}}class n extends e.BaseChain{static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"returnIntermediateSteps",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"maxIterations",{enumerable:!0,configurable:!0,writable:!0,value:10}),Object.defineProperty(this,"ensureMapStep",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"combineDocumentChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmChain=e.llmChain,this.combineDocumentChain=e.combineDocumentChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.ensureMapStep=e.ensureMapStep??this.ensureMapStep,this.inputKey=e.inputKey??this.inputKey,this.maxTokens=e.maxTokens??this.maxTokens,this.maxIterations=e.maxIterations??this.maxIterations,this.returnIntermediateSteps=e.returnIntermediateSteps??!1}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e;let a=i,r=[];for(let o=0;o<this.maxIterations;o+=1){const e=a.map(e=>({[this.documentVariableName]:e.pageContent,...n}));if(0!==o||!this.ensureMapStep){const e=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...n}));if(await this.combineDocumentChain.llmChain._getNumTokens(e)<this.maxTokens)break}const i=await this.llmChain.apply(e,t?Array.from({length:e.length},(e,i)=>t.getChild(`map_${i+1}`)):void 0),{outputKey:s}=this.llmChain;this.returnIntermediateSteps&&(r=r.concat(i.map(e=>e[s]))),a=i.map(e=>({pageContent:e[s],metadata:{}}))}const s={[this.combineDocumentChain.inputKey]:a,...n},u=await this.combineDocumentChain.call(s,null==t?void 0:t.getChild("combine_documents"));return this.returnIntermediateSteps?{...u,intermediateSteps:r}:u}_chainType(){return"map_reduce_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");if(!e.combine_document_chain)throw new Error("Missing combine_document_chain");return new n({llmChain:await t.LLMChain.deserialize(e.llm_chain),combineDocumentChain:await i.deserialize(e.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}}class a extends e.BaseChain{static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new e.PromptTemplate({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(e=>e!==this.documentVariableName&&e!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output_text"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"initialResponseName",{enumerable:!0,configurable:!0,writable:!0,value:"existing_answer"}),Object.defineProperty(this,"refineLLMChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"documentPrompt",{enumerable:!0,configurable:!0,writable:!0,value:this.defaultDocumentPrompt}),this.llmChain=e.llmChain,this.refineLLMChain=e.refineLLMChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.documentPrompt=e.documentPrompt??this.documentPrompt,this.initialResponseName=e.initialResponseName??this.initialResponseName}async _constructInitialInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});return{...{[this.documentVariableName]:await this.documentPrompt.format({...n})},...t}}async _constructRefineInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});const a={[this.documentVariableName]:await this.documentPrompt.format({...n})};return{[this.initialResponseName]:t,...a}}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e,a=i,r=await this._constructInitialInputs(a[0],n);let s=await this.llmChain.predict({...r},null==t?void 0:t.getChild("answer"));for(let u=1;u<a.length;u+=1){const e={...await this._constructRefineInputs(a[u],s),...n};s=await this.refineLLMChain.predict({...e},null==t?void 0:t.getChild("refine"))}return{[this.outputKey]:s}}_chainType(){return"refine_documents_chain"}static async deserialize(e){const i=e.llm_chain;if(!i)throw new Error("Missing llm_chain");const n=e.refine_llm_chain;if(!n)throw new Error("Missing refine_llm_chain");return new a({llmChain:await t.LLMChain.deserialize(i),refineLLMChain:await t.LLMChain.deserialize(n)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}exports.MapReduceDocumentsChain=n,exports.RefineDocumentsChain=a,exports.StuffDocumentsChain=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-CjmBLRKu.cjs"),t=require("./llm_chain-RoYoMcLp.cjs");class i extends e.BaseChain{static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(e=>e!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),this.llmChain=e.llmChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey}_prepInputs(e){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:t,...i}=e,n=t.map(({pageContent:e})=>e).join("\n\n");return{...i,[this.documentVariableName]:n}}async _call(e,t){return await this.llmChain.call(this._prepInputs(e),null==t?void 0:t.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");return new i({llmChain:await t.LLMChain.deserialize(e.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}}class n extends e.BaseChain{static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"returnIntermediateSteps",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"maxIterations",{enumerable:!0,configurable:!0,writable:!0,value:10}),Object.defineProperty(this,"ensureMapStep",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"combineDocumentChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmChain=e.llmChain,this.combineDocumentChain=e.combineDocumentChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.ensureMapStep=e.ensureMapStep??this.ensureMapStep,this.inputKey=e.inputKey??this.inputKey,this.maxTokens=e.maxTokens??this.maxTokens,this.maxIterations=e.maxIterations??this.maxIterations,this.returnIntermediateSteps=e.returnIntermediateSteps??!1}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e;let a=i,r=[];for(let o=0;o<this.maxIterations;o+=1){const e=a.map(e=>({[this.documentVariableName]:e.pageContent,...n}));if(0!==o||!this.ensureMapStep){const e=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...n}));if(await this.combineDocumentChain.llmChain._getNumTokens(e)<this.maxTokens)break}const i=await this.llmChain.apply(e,t?Array.from({length:e.length},(e,i)=>t.getChild(`map_${i+1}`)):void 0),{outputKey:s}=this.llmChain;this.returnIntermediateSteps&&(r=r.concat(i.map(e=>e[s]))),a=i.map(e=>({pageContent:e[s],metadata:{}}))}const s={[this.combineDocumentChain.inputKey]:a,...n},u=await this.combineDocumentChain.call(s,null==t?void 0:t.getChild("combine_documents"));return this.returnIntermediateSteps?{...u,intermediateSteps:r}:u}_chainType(){return"map_reduce_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");if(!e.combine_document_chain)throw new Error("Missing combine_document_chain");return new n({llmChain:await t.LLMChain.deserialize(e.llm_chain),combineDocumentChain:await i.deserialize(e.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}}class a extends e.BaseChain{static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new e.PromptTemplate({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(e=>e!==this.documentVariableName&&e!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output_text"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"initialResponseName",{enumerable:!0,configurable:!0,writable:!0,value:"existing_answer"}),Object.defineProperty(this,"refineLLMChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"documentPrompt",{enumerable:!0,configurable:!0,writable:!0,value:this.defaultDocumentPrompt}),this.llmChain=e.llmChain,this.refineLLMChain=e.refineLLMChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.documentPrompt=e.documentPrompt??this.documentPrompt,this.initialResponseName=e.initialResponseName??this.initialResponseName}async _constructInitialInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});return{...{[this.documentVariableName]:await this.documentPrompt.format({...n})},...t}}async _constructRefineInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});const a={[this.documentVariableName]:await this.documentPrompt.format({...n})};return{[this.initialResponseName]:t,...a}}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e,a=i,r=await this._constructInitialInputs(a[0],n);let s=await this.llmChain.predict({...r},null==t?void 0:t.getChild("answer"));for(let u=1;u<a.length;u+=1){const e={...await this._constructRefineInputs(a[u],s),...n};s=await this.refineLLMChain.predict({...e},null==t?void 0:t.getChild("refine"))}return{[this.outputKey]:s}}_chainType(){return"refine_documents_chain"}static async deserialize(e){const i=e.llm_chain;if(!i)throw new Error("Missing llm_chain");const n=e.refine_llm_chain;if(!n)throw new Error("Missing refine_llm_chain");return new a({llmChain:await t.LLMChain.deserialize(i),refineLLMChain:await t.LLMChain.deserialize(n)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}exports.MapReduceDocumentsChain=n,exports.RefineDocumentsChain=a,exports.StuffDocumentsChain=i;
@@ -1,4 +1,4 @@
1
- import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-qjQr3vyf.js";
1
+ import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-BbYqG4Lp.js";
2
2
  import "zod";
3
3
  class FewShotPromptTemplate extends BaseStringPromptTemplate {
4
4
  constructor(input) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B0IipW5x.cjs");require("zod");class t extends e.BaseStringPromptTemplate{constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:"\n\n"}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,t),void 0!==this.examples&&void 0!==this.exampleSelector)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(void 0===this.examples&&void 0===this.exampleSelector)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),e.checkValidTemplate(this.prefix+this.suffix,this.templateFormat,t)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(void 0!==this.examples)return this.examples;if(void 0!==this.exampleSelector)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){const r=this.inputVariables.filter(t=>!(t in e)),a={...this.partialVariables??{},...e},i={...this,inputVariables:r,partialVariables:a};return new t(i)}async format(t){const r=await this.mergePartialAndUserVariables(t),a=await this.getExamples(r),i=await Promise.all(a.map(e=>this.examplePrompt.format(e))),l=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return e.renderTemplate(l,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(void 0!==this.outputParser)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){const{example_prompt:a}=r;if(!a)throw new Error("Missing example prompt");const i=await e.PromptTemplate.deserialize(a);let l;if(!Array.isArray(r.examples))throw new Error("Invalid examples format. Only list or string are supported.");return l=r.examples,new t({inputVariables:r.input_variables,examplePrompt:i,examples:l,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}}exports.FewShotPromptTemplate=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjmBLRKu.cjs");require("zod");class t extends e.BaseStringPromptTemplate{constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:"\n\n"}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,t),void 0!==this.examples&&void 0!==this.exampleSelector)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(void 0===this.examples&&void 0===this.exampleSelector)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),e.checkValidTemplate(this.prefix+this.suffix,this.templateFormat,t)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(void 0!==this.examples)return this.examples;if(void 0!==this.exampleSelector)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){const r=this.inputVariables.filter(t=>!(t in e)),a={...this.partialVariables??{},...e},i={...this,inputVariables:r,partialVariables:a};return new t(i)}async format(t){const r=await this.mergePartialAndUserVariables(t),a=await this.getExamples(r),i=await Promise.all(a.map(e=>this.examplePrompt.format(e))),l=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return e.renderTemplate(l,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(void 0!==this.outputParser)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){const{example_prompt:a}=r;if(!a)throw new Error("Missing example prompt");const i=await e.PromptTemplate.deserialize(a);let l;if(!Array.isArray(r.examples))throw new Error("Invalid examples format. Only list or string are supported.");return l=r.examples,new t({inputVariables:r.input_variables,examplePrompt:i,examples:l,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}}exports.FewShotPromptTemplate=t;
@@ -0,0 +1,4 @@
1
+ import { r } from "./index-BbYqG4Lp.js";
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { u } from "./index-BbYqG4Lp.js";
2
+ export {
3
+ u as unified
4
+ };
@@ -1,5 +1,5 @@
1
- import { m as minifyWhitespace, e as embedded, p as phrasing } from "./index-CCTWqbpP.js";
2
- import { v as visitParents, S as SKIP, w as whitespace } from "./index-qjQr3vyf.js";
1
+ import { m as minifyWhitespace, e as embedded, p as phrasing } from "./index-CI8OM2Jz.js";
2
+ import { v as visitParents, S as SKIP, w as whitespace } from "./index-BbYqG4Lp.js";
3
3
  const whitespaceSensitiveTagNames = [
4
4
  "pre",
5
5
  "script",
@@ -46490,7 +46490,7 @@ const BlockEdit = ({
46490
46490
  const initVueEditor = async () => {
46491
46491
  if (editorRef.current) {
46492
46492
  try {
46493
- const BlockNoteEditorModule = await import("./index.es-F4wjqs8S.js");
46493
+ const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
46494
46494
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
46495
46495
  const theme = {
46496
46496
  colors: {
@@ -46606,6 +46606,7 @@ const BlockEdit = ({
46606
46606
  const AgentWebIndex = ({
46607
46607
  baseUrl,
46608
46608
  token,
46609
+ appTypeOptions,
46609
46610
  loginOut,
46610
46611
  appClick,
46611
46612
  Add,
@@ -46621,7 +46622,6 @@ const AgentWebIndex = ({
46621
46622
  );
46622
46623
  const [incomingAgent, setIncomingAgent] = useState(null);
46623
46624
  useEffect(() => {
46624
- console.log("baseUrl00", baseUrl);
46625
46625
  if (baseUrl && baseUrl.agentCard) {
46626
46626
  const agentData = {
46627
46627
  id: baseUrl.agentCard.id,
@@ -46748,6 +46748,7 @@ const AgentWebIndex = ({
46748
46748
  {
46749
46749
  baseUrl,
46750
46750
  token,
46751
+ appTypeOptions,
46751
46752
  onOpenCard: handleOpenCard,
46752
46753
  onLogout: handleLogout,
46753
46754
  handleAdd,
@@ -47443,7 +47444,7 @@ const AiBlockEdit = ({
47443
47444
  const initVueEditor = async () => {
47444
47445
  if (editorRef.current) {
47445
47446
  try {
47446
- const BlockNoteEditorModule = await import("./index.es-F4wjqs8S.js");
47447
+ const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
47447
47448
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
47448
47449
  const theme = {
47449
47450
  colors: {
@@ -48369,7 +48370,7 @@ class BasePromptTemplate extends Runnable {
48369
48370
  return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
48370
48371
  }
48371
48372
  case "few_shot": {
48372
- const { FewShotPromptTemplate } = await import("./few_shot-DH27sMBz.js");
48373
+ const { FewShotPromptTemplate } = await import("./few_shot-CAlLA7_Y.js");
48373
48374
  return FewShotPromptTemplate.deserialize(data);
48374
48375
  }
48375
48376
  default:
@@ -49941,35 +49942,35 @@ class BaseChain extends BaseLangChain {
49941
49942
  static async deserialize(data, values = {}) {
49942
49943
  switch (data._type) {
49943
49944
  case "llm_chain": {
49944
- const { LLMChain } = await import("./llm_chain-Bik7eUhN.js");
49945
+ const { LLMChain } = await import("./llm_chain-AXaQuXMt.js");
49945
49946
  return LLMChain.deserialize(data);
49946
49947
  }
49947
49948
  case "sequential_chain": {
49948
- const { SequentialChain } = await import("./sequential_chain-CMAU5dHB.js");
49949
+ const { SequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49949
49950
  return SequentialChain.deserialize(data);
49950
49951
  }
49951
49952
  case "simple_sequential_chain": {
49952
- const { SimpleSequentialChain } = await import("./sequential_chain-CMAU5dHB.js");
49953
+ const { SimpleSequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49953
49954
  return SimpleSequentialChain.deserialize(data);
49954
49955
  }
49955
49956
  case "stuff_documents_chain": {
49956
- const { StuffDocumentsChain } = await import("./combine_docs_chain-Cfoezgfd.js");
49957
+ const { StuffDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49957
49958
  return StuffDocumentsChain.deserialize(data);
49958
49959
  }
49959
49960
  case "map_reduce_documents_chain": {
49960
- const { MapReduceDocumentsChain } = await import("./combine_docs_chain-Cfoezgfd.js");
49961
+ const { MapReduceDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49961
49962
  return MapReduceDocumentsChain.deserialize(data);
49962
49963
  }
49963
49964
  case "refine_documents_chain": {
49964
- const { RefineDocumentsChain } = await import("./combine_docs_chain-Cfoezgfd.js");
49965
+ const { RefineDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49965
49966
  return RefineDocumentsChain.deserialize(data);
49966
49967
  }
49967
49968
  case "vector_db_qa": {
49968
- const { VectorDBQAChain } = await import("./vector_db_qa-CHkKvOu-.js");
49969
+ const { VectorDBQAChain } = await import("./vector_db_qa-Ca-yXUO_.js");
49969
49970
  return VectorDBQAChain.deserialize(data, values);
49970
49971
  }
49971
49972
  case "api_chain": {
49972
- const { APIChain } = await import("./api_chain-BJaZtSTm.js");
49973
+ const { APIChain } = await import("./api_chain-wgmc7e6E.js");
49973
49974
  return APIChain.deserialize(data);
49974
49975
  }
49975
49976
  default:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B0IipW5x.cjs");exports.default=e.remarkRehype,exports.defaultFootnoteBackContent=e.defaultFootnoteBackContent,exports.defaultFootnoteBackLabel=e.defaultFootnoteBackLabel,exports.defaultHandlers=e.handlers;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjmBLRKu.cjs");exports.default=e.remarkRehype,exports.defaultFootnoteBackContent=e.defaultFootnoteBackContent,exports.defaultFootnoteBackLabel=e.defaultFootnoteBackLabel,exports.defaultHandlers=e.handlers;
@@ -1,5 +1,5 @@
1
- import { O as toText, Q as phrasing$2, T as structuredClone, w as whitespace, U as visit, W as EXIT, X as toString, S as SKIP, Y as position } from "./index-qjQr3vyf.js";
2
- import { m as minifyWhitespace, p as phrasing$1 } from "./index-CCTWqbpP.js";
1
+ import { O as toText, Q as phrasing$2, T as structuredClone, w as whitespace, U as visit, W as EXIT, X as toString, S as SKIP, Y as position } from "./index-BbYqG4Lp.js";
2
+ import { m as minifyWhitespace, p as phrasing$1 } from "./index-CI8OM2Jz.js";
3
3
  function rehypeMinifyWhitespace(options) {
4
4
  return function(tree) {
5
5
  minifyWhitespace(tree, options);
@@ -1,4 +1,4 @@
1
- import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-qjQr3vyf.js";
1
+ import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-BbYqG4Lp.js";
2
2
  import { z as zwitch } from "./index-BEZf1ZPW.js";
3
3
  const htmlVoidElements = [
4
4
  "area",
@@ -1,4 +1,4 @@
1
- import { c, d, b, h } from "./index-qjQr3vyf.js";
1
+ import { c, d, b, h } from "./index-BbYqG4Lp.js";
2
2
  export {
3
3
  c as default,
4
4
  d as defaultFootnoteBackContent,
@@ -1,4 +1,4 @@
1
- import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-qjQr3vyf.js";
1
+ import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-BbYqG4Lp.js";
2
2
  const embedded = convertElement(
3
3
  /**
4
4
  * @param element