1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7156],{57437:(e,t,i)=>{i.r(t),i.d(t,{contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var n=i(74848),s=i(28453);const r={},l="completion",a={type:"api",id:"completion",title:"completion",description:"",slug:"/completion",frontMatter:{},api:{tags:["v1"],operationId:"completion",requestBody:{content:{"application/json":{schema:{type:"object",properties:{language:{type:"string",description:"Language identifier, full list is maintained at\nhttps://code.visualstudio.com/docs/languages/identifiers",example:"python",nullable:!0},segments:{nullable:!0,type:"object",required:["prefix"],properties:{prefix:{type:"string",description:"Content that appears before the cursor in the editor window."},suffix:{type:"string",description:"Content that appears after the cursor in the editor window.",nullable:!0},filepath:{type:"string",description:"The relative path of the file that is being edited.\n- When [Segments::git_url] is set, this is the path of the file in the git repository.\n- When [Segments::git_url] is empty, this is the path of the file in the workspace.",nullable:!0},git_url:{type:"string",description:"The remote URL of the current git repository.\nLeave this empty if the file is not in a git repository,\nor the git repository does not have a remote URL.",nullable:!0},declarations:{type:"array",items:{type:"object",description:"A snippet of declaration code that is relevant to the current completion request.",required:["filepath","body"],properties:{filepath:{type:"string",description:"Filepath of the file where the snippet is from.\n- When the file belongs to the same workspace as the current file,\nthis is a relative filepath, use the same rule as [Segments::filepath].\n- When the file located outside the workspace, such as in a dependency package,\nthis is a file URI with an absolute filepath."},body:{type:"string",description:"Body of the snippet."}}},description:"The relevant declaration code snippets provided by the editor's LSP,\ncontain declarations of symbols extracted from [Segments::prefix].",nullable:!0},relevant_snippets_from_changed_files:{type:"array",items:{type:"object",required:["filepath","body","score"],properties:{filepath:{type:"string"},body:{type:"string"},score:{type:"number",format:"float"}}},description:"The relevant code snippets extracted from recently edited files.\nThese snippets are selected from candidates found within code chunks\nbased on the edited location.\nThe current editing file is excluded from the search candidates.\n\nWhen provided alongside [Segments::declarations], the snippets have\nalready been deduplicated to ensure no duplication with entries\nin [Segments::declarations].\n\nSorted in descending order of [Snippet::score].",nullable:!0},clipboard:{type:"string",description:"Clipboard content when requesting code completion.",nullable:!0}}},user:{type:"string",description:"A unique identifier representing your end-user, which can help Tabby to monitor & generating\nreports.",nullable:!0},temperature:{type:"number",format:"float",description:'The temperature parameter for the model, used to tune variance and "creativity" of the model output',nullable:!0},seed:{type:"integer",format:"int64",description:"The seed used for randomly selecting tokens",nullable:!0,minimum:0}},example:{language:"python",segments:{prefix:"def fib(n):\n ",suffix:"\n return fib(n - 1) + fib(n - 2)"}}}}},required:!0},responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",required:["id","choices"],properties:{id:{type:"string"},choices:{type:"array",items:{type:"object",required:["index","text"],properties:{index:{type:"integer",format:"int32",minimum:0},text:{type:"string"}}}}},example:{choices:[{index:0,text:"string"}],id:"string"}}}}},400:{description:"Bad Request"}},security:[{token:[]}],description:"completion",method:"post",path:"/v1/completions",parameters:[],servers:[{url:"https://playground.app.tabbyml.com",description:"Playground server"}],securitySchemes:{token:{type:"http",scheme:"bearer",bearerFormat:"token"}},jsonRequestBodyExample:{language:"python",segments:{prefix:"def fib(n):\n ",suffix:"\n return fib(n - 1) + fib(n - 2)"}},info:{title:"Tabby Server",description:"\n[](https://github.com/TabbyML/tabby)\n[](https://links.tabbyml.com/join-slack)\n\nInstall following IDE / Editor extensions to get started with [Tabby](https://github.com/TabbyML/tabby).\n* [VSCode Extension](https://github.com/TabbyML/tabby/tree/main/clients/vscode) \u2013 Install from the [marketplace](https://marketplace.visualstudio.com/items?itemName=TabbyML.vscode-tabby), or [open-vsx.org](https://
1open-vsx.org/extension/TabbyML/vscode-tabby)\n* [VIM Extension](https://github.com/TabbyML/tabby/tree/main/clients/vim)\n* [IntelliJ Platform Plugin](https://github.com/TabbyML/tabby/tree/main/clients/intellij) \u2013 Install from the [marketplace](https://plugins.jetbrains.com/plugin/22379-tabby)\n",contact:{name:"TabbyML Team"},license:{name:"Apache 2.0",url:"https://github.com/TabbyML/tabby/blob/main/LICENSE"},version:"0.17.0"},postman:{name:"completion",description:{type:"text/plain"},url:{path:["v1","completions"],host:["{{baseUrl}}"],query:[],variable:[]},header:[{key:"Content-Type",value:"application/json"}],method:"POST",body:{mode:"raw",raw:'{\n "language": "<string>",\n "segments": {\n "prefix": "<string>",\n "suffix": "<string>",\n "filepath": "<string>",\n "git_url": "<string>",\n "declarations": [\n {\n "filepath": "<string>",\n "body": "<string>"\n },\n {\n "filepath": "<string>",\n "body": "<string>"\n }\n ],\n "relevant_snippets_from_changed_files": [\n {\n "filepath": "<string>",\n "body": "<string>",\n "score": "<float>"\n },\n {\n "filepath": "<string>",\n "body": "<string>",\n "score": "<float>"\n }\n ],\n "clipboard": "<string>"\n },\n "user": "<string>",\n "temperature": "<float>",\n "seed": "<long>"\n}'},auth:{type:"bearer",bearer:[{type:"any",value:"<Bearer Token>",key:"token"}]}}},source:"@site/static/openapi.json",sourceDirName:".",permalink:"/api/completion",previous:{title:"chat_completions",permalink:"/api/chat-completions"},next:{title:"event",permalink:"/api/event"}},d=[];function o(e){const t={a:"a",h1:"h1",li:"li",p:"p",ul:"ul",...(0,s.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"completion",children:"completion"}),"\n",(0,n.jsx)(t.p,{children:"completion"}),"\n",(0,n.jsxs)("table",{style:{display:"table",width:"100%"},children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:(0,n.jsxs)("th",{style:{textAlign:"left"},children:[(0,n.jsx)("span",{children:"Request Body "}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"}),(0,n.jsx)("div",{})]})})}),(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"language"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsxs)(t.p,{children:["Language identifier, full list is maintained at\n",(0,n.jsx)(t.a,{href:"https://code.visualstudio.com/docs/languages/identifiers",children:"https://code.visualstudio.com/docs/languages/identifiers"})]})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"segments"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" object"}),(0,n.jsx)("table",{style:{display:"table",width:"100%",marginTop:"var(--ifm-table-cell-padding)",marginBottom:"0px"},children:(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"prefix"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"Content that appears before the cursor in the editor window."})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"suffix"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"Content that appears after the cursor in the editor window."})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"filepath"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsxs)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:[(0,n.jsx)(t.p,{children:"The relative path of the file that is being edited."}),(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"When [Segments::git_url] is set, this is the path of the file in the git repository."}),"\n",(0,n.jsx)(t.li,{children:"When [Segments::git_url] is empty, this is the path of the file in the workspace."}),"\n"]})]})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"git_url"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"The remote URL of the current git repository.\nLeave this empty if the file is not in a git repository,\nor the git repository does not have a remote URL."})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"declarations"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" object[]"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"The relevant declaration code snippets provided by the editor's LSP,\ncontain declarations of symbols extracted from [Segments::prefix]."})}),(0,n.jsx)("table",{style:{display:"table",width:"100%",marginTop:"var(--ifm-table-cell-padding)",marginBottom:"0px"},children:(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"filepath"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"}),(0,n.jsxs)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:[(0,n.jsx)(t.p,{children:"Filepath of the file where the snippet is from."}),(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"When the file belongs to the same workspace as the current file,\nthis is a relative filepath, use the same rule as [Segments::filepath]."}),"\n",(0,n.jsx)(t.li,{children:"When the file located outside the workspace, such as in a dependency package,\nthis is a file URI with an absolute filepath."}),"\n"]})]})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"body"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"Body of the snippet."})})]})})]})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"relevant_snippets_from_changed_files"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" object[]"}),(0,n.jsxs)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:[(0,n.jsx)(t.p,{children:"The relevant code snippets extracted from recently edited files.\nThese snippets are selected from candidates found within code chunks\nbased on the edited location.\nThe current editing file is excluded from the search candidates."}),(0,n.jsx)(t.p,{children:"When provided alongside [Segments::declarations], the snippets have\nalready been deduplicated to ensure no duplication with entries\nin [Segments::declarations]."}),(0,n.jsx)(t.p,{children:"Sorted in descending order of [Snippet::score]."})]}),(0,n.jsx)("table",{style:{display:"table",width:"100%",marginTop:"var(--ifm-table-cell-padding)",marginBottom:"0px"},children:(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"filepath"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"body"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"score"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" float"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-required)"},children:" REQUIRED"})]})})]})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"clipboard"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"Clipboard content when requesting code completion."})})]})})]})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"user"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"A unique identifier representing your end-user, which can help Tabby to monitor & generating\nreports."})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"temperature"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" float"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:'The temperature parameter for the model, used to tune variance and "creativity" of the model output'})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"seed"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" int64"}),(0,n.jsx)("div",{style:{marginTop:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)(t.p,{children:"The seed used for randomly selecting tokens"})})]})})]})]}),"\n",(0,n.jsxs)("table",{style:{display:"table",width:"100%"},children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:(0,n.jsx)("th",{style:{textAlign:"left"},children:"Responses"})})}),(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{marginRight:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)("code",{children:"200"})}),(0,n.jsx)("div",{children:(0,n.jsx)(t.p,{children:"Success"})})]}),(0,n.jsx)("div",{children:(0,n.jsxs)("table",{style:{display:"table",width:"100%",marginTop:"var(--ifm-table-cell-padding)",marginBottom:"0px"},children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:(0,n.jsxs)("th",{style:{textAlign:"left"},children:[(0,n.jsx)("span",{children:"Schema "}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" \u2014 "}),(0,n.jsx)("strong",{style:{fontSize:"var(--ifm-code-font-size)",color:"var(--openapi-optional)"},children:" OPTIONAL"}),(0,n.jsx)("div",{})]})})}),(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"id"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"choices"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" object[]"}),(0,n.jsx)("table",{style:{display:"table",width:"100%",marginTop:"var(--ifm-table-cell-padding)",marginBottom:"0px"},children:(0,n.jsxs)("tbody",{children:[(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"index"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" int32"})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsx)("code",{children:"text"}),(0,n.jsx)("span",{style:{opacity:"0.6"},children:" string"})]})})]})})]})})]})]})})]})}),(0,n.jsx)("tr",{children:(0,n.jsxs)("td",{children:[(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{marginRight:"var(--ifm-table-cell-padding)"},children:(0,n.jsx)("code",{children:"400"})}),(0,n.jsx)("div",{children:(0,n.jsx)(t.p,{children:"Bad Request"})})]}),(0,n.jsx)("div",{})]})})]})]})]})}function c(e){void 0===e&&(e={});const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(o,{...e})}):o(e)}},28453:(e,t,i)=>{i.d(t,{R:()=>l,x:()=>a});var n=i(96540);const s={},r=n.createContext(s);function l(e){const t=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),n.createElement(r.Provider,{value:t},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.