1"use strict";(self.webpackChunkbranchly_documentation=self.webpackChunkbranchly_documentation||[]).push([[985],{2396:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>r,default:()=>p,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var i=s(4848),t=s(8453);const o={title:"Prompting Guide",sidebar_position:3,slug:"/prompting-guide",keywords:["prompting","guide"]},r=void 0,a={id:"Guides/prompting-guide",title:"Prompting Guide",description:"Introduction",source:"@site/docs/Guides/prompting-guide.md",sourceDirName:"Guides",slug:"/prompting-guide",permalink:"/docs/prompting-guide",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{title:"Prompting Guide",sidebar_position:3,slug:"/prompting-guide",keywords:["prompting","guide"]},sidebar:"tutorialSidebar",previous:{title:"Custom Styling of User Interfaces via CSS",permalink:"/docs/custom-styling"}},l={},c=[{value:"<strong>Introduction</strong>",id:"12125411cd9e80f99751fb2649dc6f61",level:2},{value:"<strong>Best Practices</strong>",id:"12125411cd9e80df906dc806400efaef",level:2},{value:"Further resources",id:"12125411cd9e800dbf99e76731472fcf",level:2}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"12125411cd9e80f99751fb2649dc6f61",children:(0,i.jsx)(n.strong,{children:"Introduction"})}),"\n",(0,i.jsx)(n.p,{children:"Prompts are an integral part of the branchly platform, as we use generative AI extensively. Prompts are used for the following functions:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"System Prompts:"}),"\xa0Defined by branchly to guide interactions across all customers."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Prompt Persona & Output Instructions:"}),"\xa0Pre-configured or customizable by users to tailor responses to their use cases. This persona is used at multiple points during our AI process: for\xa0reformulating answers, for customizing responses, and during automatic evaluation of sessions."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Tool Names and Descriptions:"}),"\xa0Used across all tools to define when it should be used and how."]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Think of defining your prompt persona as creating a manual for a new employee unfamiliar with your business. Effective prompts should be broad enough to cover necessary ground while being specific enough to provide clear guidance."}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["A good guideline is: Descriptions should be as ",(0,i.jsx)(n.strong,{children:"broad as necessary"})," and ",(0,i.jsx)(n.strong,{children:"as specific as possible"}),"."]})}),"\n",(0,i.jsx)(n.h2,{id:"12125411cd9e80df906dc806400efaef",children:(0,i.jsx)(n.strong,{children:"Best Practices"})}),"\n",(0,i.jsx)(n.p,{children:"Effective prompt engineering is crucial for maximizing the potential of language models. By crafting well-structured prompts, you can ensure more accurate, efficient, and meaningful\xa0outputs, enhancing user experience and achieving desired outcomes."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Tone of voice:"}),'\xa0Prompts shape response style, behavior, and context. Ensure clarity and relevance. For example, specify the tone: "Respond in a professional manner suitable for a business audience."']}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Be Direct:"}),"\xa0Use language like \u201cyou must\u201d or \u201cyour task is to \u2026\u201d or \u201cyour role is.\u201d This aligns with the principle of using affirmative directives, which helps in achieving better results."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Meaning and Clarity:"}),"\xa0Consider the specific intent and meaning of your prompt to ensure it aligns with your goals. Use direct language and be straight to the point. Avoid repetition. Be direct and explicit when instructing what the AI should and shouldn\u2019t do."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Formatting and\xa0Spelling:"}),"\xa0Adhere to basic markdown formatting rules and check spelling. Errors can significantly reduce prompt effectiveness. Use bullet points."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Leverage LLMs:"}),"\xa0Use large language models to refine and improve your prompts. This can be very beneficial to describe instructions in a simple and easy-to-understand manner."]}
1),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Language:"}),"\xa0Use English for system prompts for consistency, as branchly defines its system prompts in English, which performs the best. However, you can give specific examples in your language as needed, if you are not satisfied with a more general description."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Give in-context examples:"}),'\xa0Provide specific examples to guide the model\'s responses. This helps in setting clear expectations and gives guidance on how to follow. Example: "Here are two examples of effective summaries. Use a similar format."']}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Tool Names and Tool Descriptions:"}),"\xa0Treat the combination of tool names and tool descriptions as standalone prompts. Clearly specify when and how to use each tool. The tool descriptions should be so specific that they do not overlap with any other tool description!","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Example:"})}),"\n",(0,i.jsx)(n.p,{children:"Imagine you have two different sources for event information, one internal page (part of the knowledge base) and one external\xa0page which you want the AI agent to access dynamically."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Weekend Events:"}),"\xa0Sourced from an external website's event calendar.","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Good: A good tool name would be ",(0,i.jsx)(n.code,{children:"get_upcoming_weekend_events"})," with a description of \u201cUse this tool to access current\xa0events\xa0for the upcoming weekend.\u201d"]}),"\n",(0,i.jsxs)(n.li,{children:["Bad: ",(0,i.jsx)(n.code,{children:"events"})," with description: \u201cUse this tool for event information\u201d. This is bad because it does not capture that it is only relevant for events on the upcoming weekend, but for all events. This can lead to issues, as the \u201cnormal events\u201d are part of the knowledge base and thereby a different tool."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Normal Events:"}),"\xa0Sourced from your website, regularly crawled for updates. No specific description needed, if you are specific about the weekend events."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"No default instructions:"}),"\xa0There is no need to include default instructions like \u201clist of sources at the end\u201d or \u201canswer only based on context provided,\u201d as these are inherent to our AI process."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Highlight Importance:"}),"\xa0For especially sensitive topics, you can give a notice to the LLM that this is especially important. E.g., \u201cThis is important!\u201d"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Don\u2019t Overdo It:"}),"\xa0Don\u2019t put\xa0too much context and information inside a prompt. If it is static information that you need to include, consider adding the content to the knowledge base directly or in your data sources directly (i.e., your website)."]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"By following these best practices, you can create prompts that effectively leverage the capabilities of language models, leading to better interactions and results."}),"\n",(0,i.jsx)(n.h2,{id:"12125411cd9e800dbf99e76731472fcf",children:"Further resources"}),"\n",(0,i.jsx)(n.p,{children:"Here is a collection of helpful articles:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://www.prompthub.us/blog/what-we-can-learn-from-openai-perplexity-tldraw-and-vercels-system-prompts",children:"https://www.prompthub.us/blog/what-we-can-learn-from-openai-perplexity-tldraw-and-vercels-system-prompts"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://www.prompthub.us/blog/prompt-engineering-principles-for-2024",children:"https://www.prompthub.us/blog/prompt-engineering-principles-for-2024"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://platform.openai.com/docs/guides/prompt-engineering",children:"https://platform.openai.com/docs/guides/prompt-engineering"})}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>r,x:()=>a});var i=s(6540);const t={},o=i.createContext(t);function r(e){const n=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:r(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.