1 line
No EOL
28 KiB
JavaScript
1 line
No EOL
28 KiB
JavaScript
"use strict";(globalThis.webpackChunkopenrag_docs=globalThis.webpackChunkopenrag_docs||[]).push([[98],{1260:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>h,default:()=>x,frontMatter:()=>d,metadata:()=>s,toc:()=>p});const s=JSON.parse('{"id":"get-started/quickstart","title":"Quickstart","description":"Use this quickstart to install OpenRAG, and then try some of OpenRAG\'s core features.","source":"@site/docs/get-started/quickstart.mdx","sourceDirName":"get-started","slug":"/quickstart","permalink":"/quickstart","draft":false,"unlisted":false,"editUrl":"https://github.com/openrag/openrag/tree/main/docs/docs/get-started/quickstart.mdx","tags":[],"version":"current","frontMatter":{"title":"Quickstart","slug":"/quickstart"},"sidebar":"tutorialSidebar","previous":{"title":"About OpenRAG","permalink":"/"},"next":{"title":"Select an installation method","permalink":"/install-options"}}');var r=t(4848),i=t(8453),a=t(9179),o=(t(1470),t(9365),t(7224)),l=t(6149),c=t(4042);const d={title:"Quickstart",slug:"/quickstart"},h=void 0,u={},p=[{value:"Prerequisites",id:"prerequisites",level:2},...c.RM,...l.RM,{value:"Install OpenRAG",id:"install-openrag",level:2},{value:"Load and chat with documents",id:"chat-with-documents",level:2},{value:"Change the language model and chat settings",id:"change-components",level:2},{value:"Integrate OpenRAG into an application",id:"integrate-openrag-into-an-application",level:2},...o.RM,{value:"Next steps",id:"next-steps",level:2}];function g(e){const n={a:"a",code:"code",h2:"h2",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"Use this quickstart to install OpenRAG, and then try some of OpenRAG's core features."}),"\n",(0,r.jsx)(n.h2,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,r.jsx)(c.Ay,{}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Get an ",(0,r.jsx)(n.a,{href:"https://platform.openai.com/api-keys",children:"OpenAI API key"}),".\nThis quickstart uses OpenAI for simplicity.\nFor other providers, see the other ",(0,r.jsx)(n.a,{href:"/install-options",children:"installation methods"}),"."]}),"\n"]}),"\n",(0,r.jsx)(l.Ay,{}),"\n",(0,r.jsx)(n.h2,{id:"install-openrag",children:"Install OpenRAG"}),"\n",(0,r.jsxs)(n.p,{children:["For this quickstart, install OpenRAG with the automatic installer script and basic setup.\nThe script installs OpenRAG dependencies, including Docker or Podman, and then it installs and runs OpenRAG with ",(0,r.jsx)(n.a,{href:"https://docs.astral.sh/uv/guides/tools/#running-tools",children:(0,r.jsx)(n.code,{children:"uvx"})}),"."]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Create a directory for your OpenRAG installation, and then change to that directory:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"mkdir openrag-workspace\ncd openrag-workspace\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"https://docs.openr.ag/files/run_openrag_with_prereqs.sh",children:"Download the OpenRAG install script"}),", move it to your OpenRAG directory, and then run it:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"bash run_openrag_with_prereqs.sh\n"})}),"\n",(0,r.jsx)(n.p,{children:"Wait while the installer script prepares your environment and installs OpenRAG.\nYou might be prompted to install certain dependencies if they aren't already present in your environment."}),"\n",(0,r.jsxs)(n.p,{children:["The entire process can take a few minutes.\nOnce the environment is ready, the OpenRAG ",(0,r.jsx)(n.a,{href:"/tui",children:"Terminal User Interface (TUI)"})," starts."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"OpenRAG TUI Interface",src:t(3929).A+"",width:"653",height:"397"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["In the TUI, click ",(0,r.jsx)(n.strong,{children:"Basic Setup"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["For ",(0,r.jsx)(n.strong,{children:"Langflow Admin Password"}),", click ",(0,r.jsx)(n.strong,{children:"Generate Password"})," to create a Langflow administrator password and username."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Use the default values for all other fields."}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(n.strong,{children:"Save Configuration"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Your OpenRAG configuration and passwords are stored in an ",(0,r.jsxs)(n.a,{href:"/reference/configuration",children:["OpenRAG ",(0,r.jsx)(n.code,{children:".env"})," file"]})," file that is created automatically at ",(0,r.jsx)(n.code,{children:"~/.openrag/tui"}),".\nOpenRAG container definitions are stored in the ",(0,r.jsx)(n.code,{children:"docker-compose"})," files in the same directory."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(n.strong,{children:"Start OpenRAG"})," to start the OpenRAG services."]}),"\n",(0,r.jsx)(n.p,{children:"This process can take some time while OpenRAG pulls and runs the container images.\nIf all services start successfully, the TUI prints a confirmation message:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"Services started successfully\nCommand completed successfully\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(n.strong,{children:"Close"}),", and then click ",(0,r.jsx)(n.strong,{children:"Launch OpenRAG"})," to access the OpenRAG application and start the application onboarding process."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["For this quickstart, select the ",(0,r.jsx)(n.strong,{children:"OpenAI"})," model provider, enter your OpenAI API key, and then click ",(0,r.jsx)(n.strong,{children:"Complete"}),". Use the default settings for all other model options."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click through the overview slides for a brief introduction to OpenRAG, or click ",(0,r.jsx)(a.A,{name:"ArrowRight","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Skip overview"}),".\nYou can complete this quickstart without going through the overview.\nThe overview demonstrates some basic functionality that is covered in the next section and in other parts of the OpenRAG documentation."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"chat-with-documents",children:"Load and chat with documents"}),"\n",(0,r.jsxs)(n.p,{children:["Use the ",(0,r.jsxs)(n.a,{href:"/chat",children:["OpenRAG ",(0,r.jsx)(n.strong,{children:"Chat"})]})," to explore the documents in your OpenRAG database using natural language queries.\nSome documents are included by default to get you started, and you can load your own documents."]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["In OpenRAG, click ",(0,r.jsx)(a.A,{name:"MessageSquare","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Chat"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["For this quickstart, ask the agent what documents are available.\nFor example: ",(0,r.jsx)(n.code,{children:"What documents are available to you?"})]}),"\n",(0,r.jsx)(n.p,{children:"The agent responds with a summary of OpenRAG's default documents."}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["To verify the agent's response, click ",(0,r.jsx)(a.A,{name:"Library","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Knowledge"})," to view the documents stored in the OpenRAG OpenSearch database.\nYou can click a document to view the chunks of the document as they are stored in the database."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(n.strong,{children:"Add Knowledge"})," to add your own documents to your OpenRAG knowledge base."]}),"\n",(0,r.jsxs)(n.p,{children:["For this quickstart, use either the ",(0,r.jsx)(a.A,{name:"File","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"File"})," or ",(0,r.jsx)(a.A,{name:"Folder","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Folder"})," upload options to load documents from your local machine.\n",(0,r.jsx)(n.strong,{children:"Folder"})," uploads an entire directory.\nThe default directory is ",(0,r.jsx)(n.code,{children:"~/.openrag/documents"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["For information about the cloud storage provider options, see ",(0,r.jsx)(n.a,{href:"/ingestion#oauth-ingestion",children:"Ingest files with OAuth connectors"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Return to the ",(0,r.jsx)(n.strong,{children:"Chat"})," window, and then ask a question related to the documents that you just uploaded."]}),"\n",(0,r.jsx)(n.p,{children:"If the agent's response doesn't seem to reference your documents correctly, try the following:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(a.A,{name:"Gear","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Function Call: search_documents (tool_call)"})," to view the log of tool calls made by the agent. This is helpful for troubleshooting because it shows you how the agent used particular tools."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(a.A,{name:"Library","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Knowledge"})," to confirm that the documents are present in the OpenRAG OpenSearch database, and then click each document to see how the document was chunked.\nIf a document was chunked improperly, you might need to tweak the ingestion or modify and reupload the document."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Click ",(0,r.jsx)(a.A,{name:"Settings2","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Settings"})," to modify the knowledge ingestion settings."]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["For more information, see ",(0,r.jsx)(n.a,{href:"/knowledge",children:"Configure knowledge"})," and ",(0,r.jsx)(n.a,{href:"/ingestion",children:"Ingest knowledge"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"change-components",children:"Change the language model and chat settings"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["To change the knowledge ingestion settings, agent behavior, or language model, click ",(0,r.jsx)(a.A,{name:"Settings2","aria-hidden":"true"})," ",(0,r.jsx)(n.strong,{children:"Settings"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.strong,{children:"Settings"})," page provides quick access to commonly used parameters like the ",(0,r.jsx)(n.strong,{children:"Language model"})," and ",(0,r.jsx)(n.strong,{children:"Agent Instructions"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["For greater insight into the underlying ",(0,r.jsx)(n.a,{href:"/agents",children:"Langflow flow"})," that drives the OpenRAG chat, click ",(0,r.jsx)(n.strong,{children:"Edit in Langflow"})," and then click ",(0,r.jsx)(n.strong,{children:"Proceed"})," to launch the Langflow visual editor in a new browser window."]}),"\n",(0,r.jsxs)(n.p,{children:["If Langflow requests login information, enter the ",(0,r.jsx)(n.code,{children:"LANGFLOW_SUPERUSER"})," and ",(0,r.jsx)(n.code,{children:"LANGFLOW_SUPERUSER_PASSWORD"})," from the ",(0,r.jsx)(n.code,{children:".env"})," file at ",(0,r.jsx)(n.code,{children:"~/.openrag/tui"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.strong,{children:"OpenRAG OpenSearch Agent"})," flow opens in a new browser window."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"OpenRAG OpenSearch Agent flow",src:t(3982).A+"",width:"4084",height:"2176"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["For this quickstart, try changing the model.\nClick the ",(0,r.jsx)(n.strong,{children:"Language Model"})," component, and then change the ",(0,r.jsx)(n.strong,{children:"Model Name"})," to a different OpenAI model."]}),"\n",(0,r.jsxs)(n.p,{children:["After you edit a built-in flow, you can click ",(0,r.jsx)(n.strong,{children:"Restore flow"})," on the ",(0,r.jsx)(n.strong,{children:"Settings"})," page to revert the flow to its original state when you first installed OpenRAG."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Press ",(0,r.jsx)("kbd",{children:"Command"}),"+",(0,r.jsx)("kbd",{children:"S"})," (",(0,r.jsx)("kbd",{children:"Ctrl"}),"+",(0,r.jsx)("kbd",{children:"S"}),") to save your changes."]}),"\n",(0,r.jsx)(n.p,{children:"You can close the Langflow browser window, or leave it open if you want to continue experimenting with the flow editor."}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Switch to your OpenRAG browser window, and then click ",(0,r.jsx)(a.A,{name:"Plus","aria-hidden":"true"})," in the ",(0,r.jsx)(n.strong,{children:"Conversations"})," tab to start a new conversation.\nThis ensures that the chat doesn't persist any context from the previous conversation with the original model."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Ask the same question you asked in ",(0,r.jsx)(n.a,{href:"#chat-with-documents",children:"Load and chat with documents"})," to see how the response differs from the original model."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"integrate-openrag-into-an-application",children:"Integrate OpenRAG into an application"}),"\n",(0,r.jsxs)(n.p,{children:["Langflow in OpenRAG includes pre-built flows that you can integrate into your applications using the ",(0,r.jsx)(n.a,{href:"https://docs.langflow.org/api-reference-api-examples",children:"Langflow API"}),".\nYou can use these flows as-is or modify them to better suit your needs, as demonstrated in ",(0,r.jsx)(n.a,{href:"#change-components",children:"Change the language model and chat settings"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"You can send and receive requests with the Langflow API using Python, TypeScript, or curl."}),"\n",(0,r.jsx)(o.Ay,{}),"\n",(0,r.jsx)(n.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Reinstall OpenRAG with your preferred settings"}),": This quickstart used ",(0,r.jsx)(n.code,{children:"uvx"})," and a minimal setup to demonstrate OpenRAG's core functionality.\nIt is recommended that you ",(0,r.jsx)(n.a,{href:"/reinstall",children:"reinstall OpenRAG"})," with your preferred configuration and ",(0,r.jsx)(n.a,{href:"/install-options",children:"installation method"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Learn more about OpenRAG"}),": Explore OpenRAG and the OpenRAG documentation to learn more about its features and functionality."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Learn more about Langflow"}),": For a deep dive on the Langflow API and visual editor, see the ",(0,r.jsx)(n.a,{href:"https://docs.langflow.org/",children:"Langflow documentation"}),"."]}),"\n"]}),"\n"]})]})}function x(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},1470:(e,n,t)=>{t.d(n,{A:()=>b});var s=t(6540),r=t(4164),i=t(7559),a=t(3104),o=t(6347),l=t(205),c=t(7485),d=t(1682),h=t(679);function u(e){return s.Children.toArray(e).filter(e=>"\n"!==e).map(e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)})?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)(()=>{const e=n??function(e){return u(e).map(({props:{value:e,label:n,attributes:t,default:s}})=>({value:e,label:n,attributes:t,default:s}))}(t);return function(e){const n=(0,d.XI)(e,(e,n)=>e.value===n.value);if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map(e=>e.value).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e},[n,t])}function g({value:e,tabValues:n}){return n.some(n=>n.value===e)}function x({queryString:e=!1,groupId:n}){const t=(0,o.W6)(),r=function({queryString:e=!1,groupId:n}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:e,groupId:n});return[(0,c.aZ)(r),(0,s.useCallback)(e=>{if(!r)return;const n=new URLSearchParams(t.location.search);n.set(r,e),t.replace({...t.location,search:n.toString()})},[r,t])]}function j(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,i=p(e),[a,o]=(0,s.useState)(()=>function({defaultValue:e,tabValues:n}){if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!g({value:e,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${n.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}const t=n.find(e=>e.default)??n[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:i})),[c,d]=x({queryString:t,groupId:r}),[u,j]=function({groupId:e}){const n=function(e){return e?`docusaurus.tab.${e}`:null}(e),[t,r]=(0,h.Dv)(n);return[t,(0,s.useCallback)(e=>{n&&r.set(e)},[n,r])]}({groupId:r}),f=(()=>{const e=c??u;return g({value:e,tabValues:i})?e:null})();(0,l.A)(()=>{f&&o(f)},[f]);return{selectedValue:a,selectValue:(0,s.useCallback)(e=>{if(!g({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)},[d,j,i]),tabValues:i}}var f=t(2303);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var y=t(4848);function w({className:e,block:n,selectedValue:t,selectValue:s,tabValues:i}){const o=[],{blockElementScrollPositionUntilNextRender:l}=(0,a.a_)(),c=e=>{const n=e.currentTarget,r=o.indexOf(n),a=i[r].value;a!==t&&(l(n),s(a))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=o.indexOf(e.currentTarget)+1;n=o[t]??o[0];break}case"ArrowLeft":{const t=o.indexOf(e.currentTarget)-1;n=o[t]??o[o.length-1];break}}n?.focus()};return(0,y.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},e),children:i.map(({value:e,label:n,attributes:s})=>(0,y.jsx)("li",{role:"tab",tabIndex:t===e?0:-1,"aria-selected":t===e,ref:e=>{o.push(e)},onKeyDown:d,onClick:c,...s,className:(0,r.A)("tabs__item",m.tabItem,s?.className,{"tabs__item--active":t===e}),children:n??e},e))})}function A({lazy:e,children:n,selectedValue:t}){const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(e){const e=i.find(e=>e.props.value===t);return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,y.jsx)("div",{className:"margin-top--md",children:i.map((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==t}))})}function v(e){const n=j(e);return(0,y.jsxs)("div",{className:(0,r.A)(i.G.tabs.container,"tabs-container",m.tabList),children:[(0,y.jsx)(w,{...n,...e}),(0,y.jsx)(A,{...n,...e})]})}function b(e){const n=(0,f.A)();return(0,y.jsx)(v,{...e,children:u(e.children)},String(n))}},3929:(e,n,t)=>{t.d(n,{A:()=>s});const s=t.p+"assets/images/openrag_tui_dec_2025-c7022e66cc6675f25aced7b8acd8274d.png"},3982:(e,n,t)=>{t.d(n,{A:()=>s});const s=t.p+"assets/images/opensearch-agent-flow-f3b279e02425cd043002eb7749067108.png"},4042:(e,n,t)=>{t.d(n,{Ay:()=>o,RM:()=>i});var s=t(4848),r=t(8453);const i=[];function a(e){const n={a:"a",li:"li",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Install ",(0,s.jsx)(n.a,{href:"https://www.python.org/downloads/release/python-3100/",children:"Python"})," version 3.13 or later."]}),"\n"]})}function o(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(a,{...e})}):a(e)}},6149:(e,n,t)=>{t.d(n,{Ay:()=>o,RM:()=>i});var s=t(4848),r=t(8453);const i=[];function a(e){const n={a:"a",li:"li",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["For Microsoft Windows, you must use the Windows Subsystem for Linux (WSL).\nSee ",(0,s.jsx)(n.a,{href:"/install-windows",children:"Install OpenRAG on Windows"})," before proceeding."]}),"\n"]})}function o(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(a,{...e})}):a(e)}},7224:(e,n,t)=>{t.d(n,{Ay:()=>d,RM:()=>l});var s=t(4848),r=t(8453),i=t(9179),a=t(1470),o=t(9365);const l=[];function c(e){const n={a:"a",code:"code",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Open the ",(0,s.jsx)(n.strong,{children:"OpenRAG OpenSearch Agent"})," flow in the Langflow visual editor: Click ",(0,s.jsx)(i.A,{name:"Settings2","aria-hidden":"true"})," ",(0,s.jsx)(n.strong,{children:"Settings"}),", click ",(0,s.jsx)(n.strong,{children:"Edit in Langflow"}),", and then click ",(0,s.jsx)(n.strong,{children:"Proceed"}),"."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Optional: If you don't want to use the Langflow API key that is generated automatically when you install OpenRAG, you can create a ",(0,s.jsx)(n.a,{href:"https://docs.langflow.org/api-keys-and-authentication",children:"Langflow API key"}),".\nThis key doesn't grant access to OpenRAG; it is only for authenticating with the Langflow API."]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["In the Langflow visual editor, click your user icon in the header, and then select ",(0,s.jsx)(n.strong,{children:"Settings"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:["Click ",(0,s.jsx)(n.strong,{children:"Langflow API Keys"}),", and then click ",(0,s.jsx)(i.A,{name:"Plus","aria-hidden":"true"})," ",(0,s.jsx)(n.strong,{children:"Add New"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:["Name your key, and then click ",(0,s.jsx)(n.strong,{children:"Create API Key"}),"."]}),"\n",(0,s.jsx)(n.li,{children:"Copy the API key and store it securely."}),"\n",(0,s.jsxs)(n.li,{children:["Exit the Langflow ",(0,s.jsx)(n.strong,{children:"Settings"})," page to return to the visual editor."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Click ",(0,s.jsx)(n.strong,{children:"Share"}),", and then select ",(0,s.jsx)(n.strong,{children:"API access"})," to get pregenerated code snippets that call the Langflow API and run the flow."]}),"\n",(0,s.jsxs)(n.p,{children:["These code snippets construct API requests with your Langflow server URL (",(0,s.jsx)(n.code,{children:"LANGFLOW_SERVER_ADDRESS"}),"), the flow to run (",(0,s.jsx)(n.code,{children:"FLOW_ID"}),"), required headers (",(0,s.jsx)(n.code,{children:"LANGFLOW_API_KEY"}),", ",(0,s.jsx)(n.code,{children:"Content-Type"}),"), and a payload containing the required inputs to run the flow, including a default chat input message."]}),"\n",(0,s.jsx)(n.p,{children:"In production, you would modify the inputs to suit your application logic. For example, you could replace the default chat input message with dynamic user input."}),"\n",(0,s.jsxs)(a.A,{children:[(0,s.jsx)(o.A,{value:"python",label:"Python",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-python",children:'import requests\nimport os\nimport uuid\n\napi_key = \'LANGFLOW_API_KEY\'\nurl = "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" # The complete API endpoint URL for this flow\n\n# Request payload configuration\npayload = {\n "output_type": "chat",\n "input_type": "chat",\n "input_value": "hello world!"\n}\npayload["session_id"] = str(uuid.uuid4())\n\nheaders = {"x-api-key": api_key}\n\ntry:\n # Send API request\n response = requests.request("POST", url, json=payload, headers=headers)\n response.raise_for_status() # Raise exception for bad status codes\n\n # Print response\n print(response.text)\n\nexcept requests.exceptions.RequestException as e:\n print(f"Error making API request: {e}")\nexcept ValueError as e:\n print(f"Error parsing response: {e}")\n'})})}),(0,s.jsx)(o.A,{value:"typescript",label:"TypeScript",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:'const crypto = require(\'crypto\');\nconst apiKey = \'LANGFLOW_API_KEY\';\nconst payload = {\n "output_type": "chat",\n "input_type": "chat",\n "input_value": "hello world!"\n};\npayload.session_id = crypto.randomUUID();\n\nconst options = {\n method: \'POST\',\n headers: {\n \'Content-Type\': \'application/json\',\n "x-api-key": apiKey\n },\n body: JSON.stringify(payload)\n};\n\nfetch(\'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID\', options)\n .then(response => response.json())\n .then(response => console.warn(response))\n .catch(err => console.error(err));\n'})})}),(0,s.jsx)(o.A,{value:"curl",label:"curl",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'curl --request POST \\\n --url \'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID?stream=false\' \\\n --header \'Content-Type: application/json\' \\\n --header "x-api-key: LANGFLOW_API_KEY" \\\n --data \'{\n "output_type": "chat",\n "input_type": "chat",\n "input_value": "hello world!"\n }\'\n'})})})]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Copy your preferred snippet, and then run it:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Python"}),": Paste the snippet into a ",(0,s.jsx)(n.code,{children:".py"})," file, save it, and then run it with ",(0,s.jsx)(n.code,{children:"python filename.py"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"TypeScript"}),": Paste the snippet into a ",(0,s.jsx)(n.code,{children:".ts"})," file, save it, and then run it with ",(0,s.jsx)(n.code,{children:"ts-node filename.ts"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"curl"}),": Paste and run snippet directly in your terminal."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"If the request is successful, the response includes many details about the flow run, including the session ID, inputs, outputs, components, durations, and more."}),"\n",(0,s.jsxs)(n.p,{children:["In production, you won't pass the raw response to the user in its entirety.\nInstead, you extract and reformat relevant fields for different use cases, as demonstrated in the ",(0,s.jsx)(n.a,{href:"https://docs.langflow.org/get-started-quickstart#extract-data-from-the-response",children:"Langflow quickstart"}),".\nFor example, you could pass the chat output text to a front-end user-facing application, and store specific fields in logs and backend data stores for monitoring, chat history, or analytics.\nYou could also pass the output from one flow as input to another flow."]})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},9179:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(7856),r=t(4848);function i({name:e,...n}){const t=s[e];return t?(0,r.jsx)(t,{...n}):null}},9365:(e,n,t)=>{t.d(n,{A:()=>a});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var i=t(4848);function a({children:e,hidden:n,className:t}){return(0,i.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,t),hidden:n,children:e})}}}]); |