|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286 |
-
- <!doctype html>
- <html lang="en" class="no-js">
- <head>
-
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
-
-
-
-
- <link rel="prev" href="../llama.native.llamatokendataarraynative/">
-
-
- <link rel="next" href="../llama.native.safellamacontexthandle/">
-
- <link rel="icon" href="../../assets/images/favicon.png">
- <meta name="generator" content="mkdocs-1.4.3, mkdocs-material-9.1.16">
-
-
-
- <title>llama.native.nativeapi - LLamaSharp Documentation</title>
-
-
-
- <link rel="stylesheet" href="../../assets/stylesheets/main.26e3688c.min.css">
-
-
-
-
-
-
-
-
-
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
- <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
-
-
-
- <script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
-
-
-
-
-
-
- </head>
-
-
- <body dir="ltr">
-
-
-
- <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
-
- <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
- <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
- <label class="md-overlay" for="__drawer"></label>
- <div data-md-component="skip">
-
-
- <a href="#nativeapi" class="md-skip">
- Skip to content
- </a>
-
- </div>
- <div data-md-component="announce">
-
- </div>
-
- <div data-md-color-scheme="default" data-md-component="outdated" hidden>
-
- </div>
-
-
-
-
-
-
- <header class="md-header md-header--shadow" data-md-component="header">
- <nav class="md-header__inner md-grid" aria-label="Header">
- <a href="../.." title="LLamaSharp Documentation" class="md-header__button md-logo" aria-label="LLamaSharp Documentation" data-md-component="logo">
-
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>
-
- </a>
- <label class="md-header__button md-icon" for="__drawer">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
- </label>
- <div class="md-header__title" data-md-component="header-title">
- <div class="md-header__ellipsis">
- <div class="md-header__topic">
- <span class="md-ellipsis">
- LLamaSharp Documentation
- </span>
- </div>
- <div class="md-header__topic" data-md-component="header-topic">
- <span class="md-ellipsis">
-
- llama.native.nativeapi
-
- </span>
- </div>
- </div>
- </div>
-
-
-
- <label class="md-header__button md-icon" for="__search">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
- </label>
- <div class="md-search" data-md-component="search" role="dialog">
- <label class="md-search__overlay" for="__search"></label>
- <div class="md-search__inner" role="search">
- <form class="md-search__form" name="search">
- <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
- <label class="md-search__icon md-icon" for="__search">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
- </label>
- <nav class="md-search__options" aria-label="Search">
-
- <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
- </button>
- </nav>
-
- </form>
- <div class="md-search__output">
- <div class="md-search__scrollwrap" data-md-scrollfix>
- <div class="md-search-result" data-md-component="search-result">
- <div class="md-search-result__meta">
- Initializing search
- </div>
- <ol class="md-search-result__list" role="presentation"></ol>
- </div>
- </div>
- </div>
- </div>
- </div>
-
-
- </nav>
-
- </header>
-
- <div class="md-container" data-md-component="container">
-
-
-
-
-
-
- <main class="md-main" data-md-component="main">
- <div class="md-main__inner md-grid">
-
-
-
- <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
-
-
- <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
- <label class="md-nav__title" for="__drawer">
- <a href="../.." title="LLamaSharp Documentation" class="md-nav__button md-logo" aria-label="LLamaSharp Documentation" data-md-component="logo">
-
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>
-
- </a>
- LLamaSharp Documentation
- </label>
-
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../.." class="md-nav__link">
- Overview
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../GetStarted/" class="md-nav__link">
- Get Started
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Architecture/" class="md-nav__link">
- Architecture
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Tricks/" class="md-nav__link">
- Tricks for FAQ
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../ContributingGuide/" class="md-nav__link">
- Contributing Guide
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
-
-
-
- <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
- LLamaModel
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_6">
- <span class="md-nav__icon md-icon"></span>
- LLamaModel
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaModel/parameters/" class="md-nav__link">
- Model Parameters
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaModel/tokenization/" class="md-nav__link">
- Tokenization
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaModel/embeddings/" class="md-nav__link">
- Get Embeddings
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaModel/quantization/" class="md-nav__link">
- Quantization
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaModel/save-load-state/" class="md-nav__link">
- Save/Load State
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
-
-
-
- <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
- LLamaExecutors
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_7">
- <span class="md-nav__icon md-icon"></span>
- LLamaExecutors
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaExecutors/parameters/" class="md-nav__link">
- Inference Parameters
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaExecutors/text-to-text-apis/" class="md-nav__link">
- Text-to-Text APIs
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaExecutors/save-load-state/" class="md-nav__link">
- Save/Load State
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../LLamaExecutors/differences/" class="md-nav__link">
- Differences of Executors
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
-
-
-
- <label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
- ChatSession
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_8">
- <span class="md-nav__icon md-icon"></span>
- ChatSession
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../ChatSession/basic-usages/" class="md-nav__link">
- Basic Usages
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../ChatSession/transforms/" class="md-nav__link">
- Transoforms
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../ChatSession/save-load-session/" class="md-nav__link">
- Save/Load Session
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
-
-
-
- <label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
- Non-English Usages
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_9">
- <span class="md-nav__icon md-icon"></span>
- Non-English Usages
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../NonEnglishUsage/Chinese/" class="md-nav__link">
- Chinese
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
-
-
-
- <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
- High-level Applications
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_10">
- <span class="md-nav__icon md-icon"></span>
- High-level Applications
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../HighLevelApps/bot-sharp/" class="md-nav__link">
- BotSharp
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_11" >
-
-
-
- <label class="md-nav__link" for="__nav_11" id="__nav_11_label" tabindex="0">
- More
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_11_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_11">
- <span class="md-nav__icon md-icon"></span>
- More
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../More/log/" class="md-nav__link">
- Logger
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_12" >
-
-
-
- <label class="md-nav__link" for="__nav_12" id="__nav_12_label" tabindex="0">
- Examples
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_12_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_12">
- <span class="md-nav__icon md-icon"></span>
- Examples
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/ChatSessionStripRoleName/" class="md-nav__link">
- Chat session 1
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/ChatSessionWithRoleName/" class="md-nav__link">
- Chat session 2
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/GetEmbeddings/" class="md-nav__link">
- Get embeddings
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/InstructModeExecute/" class="md-nav__link">
- Instruct executor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/InteractiveModeExecute/" class="md-nav__link">
- Interactive executor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/StatelessModeExecute/" class="md-nav__link">
- Stateless exeutor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/LoadAndSaveSession/" class="md-nav__link">
- Load/Save session
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/LoadAndSaveState/" class="md-nav__link">
- Load/Save state
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../../Examples/QuantizeModel/" class="md-nav__link">
- Quantize model
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--active md-nav__item--nested">
-
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_13" checked>
-
-
-
- <label class="md-nav__link" for="__nav_13" id="__nav_13_label" tabindex="0">
- API Reference
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_13_label" aria-expanded="true">
- <label class="md-nav__title" for="__nav_13">
- <span class="md-nav__icon md-icon"></span>
- API Reference
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../" class="md-nav__link">
- index
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.abstractions.ihistorytransform/" class="md-nav__link">
- llama.abstractions.ihistorytransform
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.abstractions.illamaexecutor/" class="md-nav__link">
- llama.abstractions.illamaexecutor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.abstractions.itextstreamtransform/" class="md-nav__link">
- llama.abstractions.itextstreamtransform
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.abstractions.itexttransform/" class="md-nav__link">
- llama.abstractions.itexttransform
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.chatsession/" class="md-nav__link">
- llama.chatsession
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.authorrole/" class="md-nav__link">
- llama.common.authorrole
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.chathistory/" class="md-nav__link">
- llama.common.chathistory
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.fixedsizequeue-1/" class="md-nav__link">
- llama.common.fixedsizequeue-1
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.illamalogger/" class="md-nav__link">
- llama.common.illamalogger
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.inferenceparams/" class="md-nav__link">
- llama.common.inferenceparams
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.llamadefaultlogger/" class="md-nav__link">
- llama.common.llamadefaultlogger
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.mirostatetype/" class="md-nav__link">
- llama.common.mirostatetype
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.common.modelparams/" class="md-nav__link">
- llama.common.modelparams
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.exceptions.runtimeerror/" class="md-nav__link">
- llama.exceptions.runtimeerror
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.extensions.dictionaryextension/" class="md-nav__link">
- llama.extensions.dictionaryextension
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.instructexecutor/" class="md-nav__link">
- llama.instructexecutor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.interactiveexecutor/" class="md-nav__link">
- llama.interactiveexecutor
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.llamaembedder/" class="md-nav__link">
- llama.llamaembedder
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.llamamodel/" class="md-nav__link">
- llama.llamamodel
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.llamaquantizer/" class="md-nav__link">
- llama.llamaquantizer
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.llamatransforms/" class="md-nav__link">
- llama.llamatransforms
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.llamacontextparams/" class="md-nav__link">
- llama.native.llamacontextparams
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.llamaftype/" class="md-nav__link">
- llama.native.llamaftype
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.llamatokendata/" class="md-nav__link">
- llama.native.llamatokendata
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.llamatokendataarray/" class="md-nav__link">
- llama.native.llamatokendataarray
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.llamatokendataarraynative/" class="md-nav__link">
- llama.native.llamatokendataarraynative
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--active">
-
- <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
-
-
-
-
-
- <label class="md-nav__link md-nav__link--active" for="__toc">
- llama.native.nativeapi
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <a href="./" class="md-nav__link md-nav__link--active">
- llama.native.nativeapi
- </a>
-
-
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#constructors" class="md-nav__link">
- Constructors
- </a>
-
- <nav class="md-nav" aria-label="Constructors">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#nativeapi_1" class="md-nav__link">
- NativeApi()
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#methods" class="md-nav__link">
- Methods
- </a>
-
- <nav class="md-nav" aria-label="Methods">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#llama_print_timingssafellamacontexthandle" class="md-nav__link">
- llama_print_timings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_print_timings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_reset_timingssafellamacontexthandle" class="md-nav__link">
- llama_reset_timings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_reset_timings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_1" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_print_system_info" class="md-nav__link">
- llama_print_system_info()
- </a>
-
- <nav class="md-nav" aria-label="llama_print_system_info()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_model_quantizestring-string-llamaftype-int32" class="md-nav__link">
- llama_model_quantize(String, String, LLamaFtype, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_model_quantize(String, String, LLamaFtype, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_2" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_1" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_repetition_penaltysafellamacontexthandle-intptr-int32-uint64-single" class="md-nav__link">
- llama_sample_repetition_penalty(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_repetition_penalty(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_3" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-intptr-int32-uint64-single-single" class="md-nav__link">
- llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_4" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_softmaxsafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_softmax(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_softmax(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_5" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_top_ksafellamacontexthandle-intptr-int32-uint64" class="md-nav__link">
- llama_sample_top_k(SafeLLamaContextHandle, IntPtr, Int32, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_top_k(SafeLLamaContextHandle, IntPtr, Int32, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_6" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_top_psafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_top_p(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_top_p(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_7" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_tail_freesafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_tail_free(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_tail_free(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_8" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_typicalsafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_typical(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_typical(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_9" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_temperaturesafellamacontexthandle-intptr-single" class="md-nav__link">
- llama_sample_temperature(SafeLLamaContextHandle, IntPtr, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_temperature(SafeLLamaContextHandle, IntPtr, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_10" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_mirostatsafellamacontexthandle-intptr-single-single-int32-single" class="md-nav__link">
- llama_sample_token_mirostat(SafeLLamaContextHandle, IntPtr, Single, Single, Int32, Single*)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_mirostat(SafeLLamaContextHandle, IntPtr, Single, Single, Int32, Single*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_11" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_2" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_mirostat_v2safellamacontexthandle-intptr-single-single-single" class="md-nav__link">
- llama_sample_token_mirostat_v2(SafeLLamaContextHandle, IntPtr, Single, Single, Single*)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_mirostat_v2(SafeLLamaContextHandle, IntPtr, Single, Single, Single*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_12" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_3" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_greedysafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_token_greedy(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_greedy(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_13" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_4" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_tokensafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_token(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_14" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_5" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_empty_call" class="md-nav__link">
- llama_empty_call()
- </a>
-
- <nav class="md-nav" aria-label="llama_empty_call()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_6" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_context_default_params" class="md-nav__link">
- llama_context_default_params()
- </a>
-
- <nav class="md-nav" aria-label="llama_context_default_params()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_7" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_mmap_supported" class="md-nav__link">
- llama_mmap_supported()
- </a>
-
- <nav class="md-nav" aria-label="llama_mmap_supported()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_8" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_mlock_supported" class="md-nav__link">
- llama_mlock_supported()
- </a>
-
- <nav class="md-nav" aria-label="llama_mlock_supported()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_9" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_init_from_filestring-llamacontextparams" class="md-nav__link">
- llama_init_from_file(String, LLamaContextParams)
- </a>
-
- <nav class="md-nav" aria-label="llama_init_from_file(String, LLamaContextParams)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_15" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_10" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_init_backend" class="md-nav__link">
- llama_init_backend()
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_freeintptr" class="md-nav__link">
- llama_free(IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_free(IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_16" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_apply_lora_from_filesafellamacontexthandle-string-string-int32" class="md-nav__link">
- llama_apply_lora_from_file(SafeLLamaContextHandle, String, String, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_apply_lora_from_file(SafeLLamaContextHandle, String, String, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_17" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_11" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_kv_cache_token_countsafellamacontexthandle" class="md-nav__link">
- llama_get_kv_cache_token_count(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_kv_cache_token_count(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_18" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_12" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_set_rng_seedsafellamacontexthandle-int32" class="md-nav__link">
- llama_set_rng_seed(SafeLLamaContextHandle, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_set_rng_seed(SafeLLamaContextHandle, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_19" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_state_sizesafellamacontexthandle" class="md-nav__link">
- llama_get_state_size(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_state_size(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_20" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_13" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_copy_state_datasafellamacontexthandle-byte" class="md-nav__link">
- llama_copy_state_data(SafeLLamaContextHandle, Byte[])
- </a>
-
- <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte[])">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_21" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_14" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_set_state_datasafellamacontexthandle-byte" class="md-nav__link">
- llama_set_state_data(SafeLLamaContextHandle, Byte[])
- </a>
-
- <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte[])">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_22" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_15" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64" class="md-nav__link">
- llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)
- </a>
-
- <nav class="md-nav" aria-label="llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_23" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_16" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_save_session_filesafellamacontexthandle-string-int32-uint64" class="md-nav__link">
- llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_24" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_17" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_evalsafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
- llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_25" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_18" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
- llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_26" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_19" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean" class="md-nav__link">
- llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)
- </a>
-
- <nav class="md-nav" aria-label="llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_27" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_20" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_tokenize_nativesafellamacontexthandle-sbyte-int32-int32-boolean" class="md-nav__link">
- llama_tokenize_native(SafeLLamaContextHandle, SByte[], Int32[], Int32, Boolean)
- </a>
-
- <nav class="md-nav" aria-label="llama_tokenize_native(SafeLLamaContextHandle, SByte[], Int32[], Int32, Boolean)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_28" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_21" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_vocabsafellamacontexthandle" class="md-nav__link">
- llama_n_vocab(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_vocab(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_29" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_22" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_ctxsafellamacontexthandle" class="md-nav__link">
- llama_n_ctx(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_ctx(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_30" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_23" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_embdsafellamacontexthandle" class="md-nav__link">
- llama_n_embd(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_embd(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_31" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_24" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_logitssafellamacontexthandle" class="md-nav__link">
- llama_get_logits(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_logits(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_32" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_25" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_embeddingssafellamacontexthandle" class="md-nav__link">
- llama_get_embeddings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_embeddings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_33" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_26" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_to_strsafellamacontexthandle-int32" class="md-nav__link">
- llama_token_to_str(SafeLLamaContextHandle, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_token_to_str(SafeLLamaContextHandle, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_34" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_27" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_bos" class="md-nav__link">
- llama_token_bos()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_bos()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_28" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_eos" class="md-nav__link">
- llama_token_eos()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_eos()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_29" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_nl" class="md-nav__link">
- llama_token_nl()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_nl()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_30" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
-
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.safellamacontexthandle/" class="md-nav__link">
- llama.native.safellamacontexthandle
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.native.safellamahandlebase/" class="md-nav__link">
- llama.native.safellamahandlebase
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletion/" class="md-nav__link">
- llama.oldversion.chatcompletion
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletionchoice/" class="md-nav__link">
- llama.oldversion.chatcompletionchoice
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletionchunk/" class="md-nav__link">
- llama.oldversion.chatcompletionchunk
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletionchunkchoice/" class="md-nav__link">
- llama.oldversion.chatcompletionchunkchoice
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletionchunkdelta/" class="md-nav__link">
- llama.oldversion.chatcompletionchunkdelta
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatcompletionmessage/" class="md-nav__link">
- llama.oldversion.chatcompletionmessage
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatmessagerecord/" class="md-nav__link">
- llama.oldversion.chatmessagerecord
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatrole/" class="md-nav__link">
- llama.oldversion.chatrole
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.chatsession-1/" class="md-nav__link">
- llama.oldversion.chatsession-1
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.completion/" class="md-nav__link">
- llama.oldversion.completion
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.completionchoice/" class="md-nav__link">
- llama.oldversion.completionchoice
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.completionchunk/" class="md-nav__link">
- llama.oldversion.completionchunk
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.completionlogprobs/" class="md-nav__link">
- llama.oldversion.completionlogprobs
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.completionusage/" class="md-nav__link">
- llama.oldversion.completionusage
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.embedding/" class="md-nav__link">
- llama.oldversion.embedding
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.embeddingdata/" class="md-nav__link">
- llama.oldversion.embeddingdata
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.embeddingusage/" class="md-nav__link">
- llama.oldversion.embeddingusage
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.ichatmodel/" class="md-nav__link">
- llama.oldversion.ichatmodel
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.llamaembedder/" class="md-nav__link">
- llama.oldversion.llamaembedder
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.llamamodel/" class="md-nav__link">
- llama.oldversion.llamamodel
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.oldversion.llamaparams/" class="md-nav__link">
- llama.oldversion.llamaparams
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.resettablellamamodel/" class="md-nav__link">
- llama.resettablellamamodel
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.statefulexecutorbase/" class="md-nav__link">
- llama.statefulexecutorbase
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../llama.statelessexecutor/" class="md-nav__link">
- llama.statelessexecutor
- </a>
- </li>
-
-
-
-
- </ul>
- </nav>
- </li>
-
-
-
- </ul>
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#constructors" class="md-nav__link">
- Constructors
- </a>
-
- <nav class="md-nav" aria-label="Constructors">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#nativeapi_1" class="md-nav__link">
- NativeApi()
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#methods" class="md-nav__link">
- Methods
- </a>
-
- <nav class="md-nav" aria-label="Methods">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#llama_print_timingssafellamacontexthandle" class="md-nav__link">
- llama_print_timings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_print_timings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_reset_timingssafellamacontexthandle" class="md-nav__link">
- llama_reset_timings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_reset_timings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_1" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_print_system_info" class="md-nav__link">
- llama_print_system_info()
- </a>
-
- <nav class="md-nav" aria-label="llama_print_system_info()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_model_quantizestring-string-llamaftype-int32" class="md-nav__link">
- llama_model_quantize(String, String, LLamaFtype, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_model_quantize(String, String, LLamaFtype, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_2" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_1" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_repetition_penaltysafellamacontexthandle-intptr-int32-uint64-single" class="md-nav__link">
- llama_sample_repetition_penalty(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_repetition_penalty(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_3" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-intptr-int32-uint64-single-single" class="md-nav__link">
- llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_4" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_softmaxsafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_softmax(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_softmax(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_5" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_top_ksafellamacontexthandle-intptr-int32-uint64" class="md-nav__link">
- llama_sample_top_k(SafeLLamaContextHandle, IntPtr, Int32, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_top_k(SafeLLamaContextHandle, IntPtr, Int32, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_6" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_top_psafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_top_p(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_top_p(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_7" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_tail_freesafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_tail_free(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_tail_free(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_8" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_typicalsafellamacontexthandle-intptr-single-uint64" class="md-nav__link">
- llama_sample_typical(SafeLLamaContextHandle, IntPtr, Single, UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_typical(SafeLLamaContextHandle, IntPtr, Single, UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_9" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_temperaturesafellamacontexthandle-intptr-single" class="md-nav__link">
- llama_sample_temperature(SafeLLamaContextHandle, IntPtr, Single)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_temperature(SafeLLamaContextHandle, IntPtr, Single)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_10" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_mirostatsafellamacontexthandle-intptr-single-single-int32-single" class="md-nav__link">
- llama_sample_token_mirostat(SafeLLamaContextHandle, IntPtr, Single, Single, Int32, Single*)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_mirostat(SafeLLamaContextHandle, IntPtr, Single, Single, Int32, Single*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_11" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_2" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_mirostat_v2safellamacontexthandle-intptr-single-single-single" class="md-nav__link">
- llama_sample_token_mirostat_v2(SafeLLamaContextHandle, IntPtr, Single, Single, Single*)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_mirostat_v2(SafeLLamaContextHandle, IntPtr, Single, Single, Single*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_12" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_3" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_token_greedysafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_token_greedy(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token_greedy(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_13" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_4" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_sample_tokensafellamacontexthandle-intptr" class="md-nav__link">
- llama_sample_token(SafeLLamaContextHandle, IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_sample_token(SafeLLamaContextHandle, IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_14" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_5" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_empty_call" class="md-nav__link">
- llama_empty_call()
- </a>
-
- <nav class="md-nav" aria-label="llama_empty_call()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_6" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_context_default_params" class="md-nav__link">
- llama_context_default_params()
- </a>
-
- <nav class="md-nav" aria-label="llama_context_default_params()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_7" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_mmap_supported" class="md-nav__link">
- llama_mmap_supported()
- </a>
-
- <nav class="md-nav" aria-label="llama_mmap_supported()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_8" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_mlock_supported" class="md-nav__link">
- llama_mlock_supported()
- </a>
-
- <nav class="md-nav" aria-label="llama_mlock_supported()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_9" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_init_from_filestring-llamacontextparams" class="md-nav__link">
- llama_init_from_file(String, LLamaContextParams)
- </a>
-
- <nav class="md-nav" aria-label="llama_init_from_file(String, LLamaContextParams)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_15" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_10" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_init_backend" class="md-nav__link">
- llama_init_backend()
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_freeintptr" class="md-nav__link">
- llama_free(IntPtr)
- </a>
-
- <nav class="md-nav" aria-label="llama_free(IntPtr)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_16" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_apply_lora_from_filesafellamacontexthandle-string-string-int32" class="md-nav__link">
- llama_apply_lora_from_file(SafeLLamaContextHandle, String, String, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_apply_lora_from_file(SafeLLamaContextHandle, String, String, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_17" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_11" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_kv_cache_token_countsafellamacontexthandle" class="md-nav__link">
- llama_get_kv_cache_token_count(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_kv_cache_token_count(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_18" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_12" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_set_rng_seedsafellamacontexthandle-int32" class="md-nav__link">
- llama_set_rng_seed(SafeLLamaContextHandle, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_set_rng_seed(SafeLLamaContextHandle, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_19" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_state_sizesafellamacontexthandle" class="md-nav__link">
- llama_get_state_size(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_state_size(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_20" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_13" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_copy_state_datasafellamacontexthandle-byte" class="md-nav__link">
- llama_copy_state_data(SafeLLamaContextHandle, Byte[])
- </a>
-
- <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte[])">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_21" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_14" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_set_state_datasafellamacontexthandle-byte" class="md-nav__link">
- llama_set_state_data(SafeLLamaContextHandle, Byte[])
- </a>
-
- <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte[])">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_22" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_15" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64" class="md-nav__link">
- llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)
- </a>
-
- <nav class="md-nav" aria-label="llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_23" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_16" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_save_session_filesafellamacontexthandle-string-int32-uint64" class="md-nav__link">
- llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)
- </a>
-
- <nav class="md-nav" aria-label="llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_24" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_17" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_evalsafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
- llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_25" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_18" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
- llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_26" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_19" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean" class="md-nav__link">
- llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)
- </a>
-
- <nav class="md-nav" aria-label="llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_27" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_20" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_tokenize_nativesafellamacontexthandle-sbyte-int32-int32-boolean" class="md-nav__link">
- llama_tokenize_native(SafeLLamaContextHandle, SByte[], Int32[], Int32, Boolean)
- </a>
-
- <nav class="md-nav" aria-label="llama_tokenize_native(SafeLLamaContextHandle, SByte[], Int32[], Int32, Boolean)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_28" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_21" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_vocabsafellamacontexthandle" class="md-nav__link">
- llama_n_vocab(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_vocab(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_29" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_22" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_ctxsafellamacontexthandle" class="md-nav__link">
- llama_n_ctx(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_ctx(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_30" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_23" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_n_embdsafellamacontexthandle" class="md-nav__link">
- llama_n_embd(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_n_embd(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_31" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_24" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_logitssafellamacontexthandle" class="md-nav__link">
- llama_get_logits(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_logits(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_32" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_25" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_get_embeddingssafellamacontexthandle" class="md-nav__link">
- llama_get_embeddings(SafeLLamaContextHandle)
- </a>
-
- <nav class="md-nav" aria-label="llama_get_embeddings(SafeLLamaContextHandle)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_33" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_26" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_to_strsafellamacontexthandle-int32" class="md-nav__link">
- llama_token_to_str(SafeLLamaContextHandle, Int32)
- </a>
-
- <nav class="md-nav" aria-label="llama_token_to_str(SafeLLamaContextHandle, Int32)">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#parameters_34" class="md-nav__link">
- Parameters
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#returns_27" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_bos" class="md-nav__link">
- llama_token_bos()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_bos()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_28" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_eos" class="md-nav__link">
- llama_token_eos()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_eos()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_29" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#llama_token_nl" class="md-nav__link">
- llama_token_nl()
- </a>
-
- <nav class="md-nav" aria-label="llama_token_nl()">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#returns_30" class="md-nav__link">
- Returns
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
-
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-content" data-md-component="content">
- <article class="md-content__inner md-typeset">
-
-
-
-
- <h1 id="nativeapi">NativeApi</h1>
- <p>Namespace: LLama.Native</p>
- <pre><code class="language-csharp">public class NativeApi
- </code></pre>
- <p>Inheritance <a href="https://docs.microsoft.com/en-us/dotnet/api/system.object">Object</a> → <a href="./">NativeApi</a></p>
- <h2 id="constructors">Constructors</h2>
- <h3 id="nativeapi_1"><strong>NativeApi()</strong></h3>
- <pre><code class="language-csharp">public NativeApi()
- </code></pre>
- <h2 id="methods">Methods</h2>
- <h3 id="llama_print_timingssafellamacontexthandle"><strong>llama_print_timings(SafeLLamaContextHandle)</strong></h3>
- <pre><code class="language-csharp">public static void llama_print_timings(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h3 id="llama_reset_timingssafellamacontexthandle"><strong>llama_reset_timings(SafeLLamaContextHandle)</strong></h3>
- <pre><code class="language-csharp">public static void llama_reset_timings(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_1">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h3 id="llama_print_system_info"><strong>llama_print_system_info()</strong></h3>
- <p>Print system information</p>
- <pre><code class="language-csharp">public static IntPtr llama_print_system_info()
- </code></pre>
- <h4 id="returns">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
- <h3 id="llama_model_quantizestring-string-llamaftype-int32"><strong>llama_model_quantize(String, String, LLamaFtype, Int32)</strong></h3>
- <pre><code class="language-csharp">public static int llama_model_quantize(string fname_inp, string fname_out, LLamaFtype ftype, int nthread)
- </code></pre>
- <h4 id="parameters_2">Parameters</h4>
- <p><code>fname_inp</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>fname_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>ftype</code> <a href="../llama.native.llamaftype/">LLamaFtype</a><br></p>
- <p><code>nthread</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h4 id="returns_1">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_sample_repetition_penaltysafellamacontexthandle-intptr-int32-uint64-single"><strong>llama_sample_repetition_penalty(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single)</strong></h3>
- <p>Repetition penalty described in CTRL academic paper https://arxiv.org/abs/1909.05858, with negative logit fix.</p>
- <pre><code class="language-csharp">public static void llama_sample_repetition_penalty(SafeLLamaContextHandle ctx, IntPtr candidates, Int32[] last_tokens, ulong last_tokens_size, float penalty)
- </code></pre>
- <h4 id="parameters_3">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>last_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>last_tokens_size</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <p><code>penalty</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <h3 id="llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-intptr-int32-uint64-single-single"><strong>llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, IntPtr, Int32[], UInt64, Single, Single)</strong></h3>
- <p>Frequency and presence penalties described in OpenAI API https://platform.openai.com/docs/api-reference/parameter-details.</p>
- <pre><code class="language-csharp">public static void llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle ctx, IntPtr candidates, Int32[] last_tokens, ulong last_tokens_size, float alpha_frequency, float alpha_presence)
- </code></pre>
- <h4 id="parameters_4">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>last_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>last_tokens_size</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <p><code>alpha_frequency</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <p><code>alpha_presence</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <h3 id="llama_sample_softmaxsafellamacontexthandle-intptr"><strong>llama_sample_softmax(SafeLLamaContextHandle, IntPtr)</strong></h3>
- <p>Sorts candidate tokens by their logits in descending order and calculate probabilities based on logits.</p>
- <pre><code class="language-csharp">public static void llama_sample_softmax(SafeLLamaContextHandle ctx, IntPtr candidates)
- </code></pre>
- <h4 id="parameters_5">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <h3 id="llama_sample_top_ksafellamacontexthandle-intptr-int32-uint64"><strong>llama_sample_top_k(SafeLLamaContextHandle, IntPtr, Int32, UInt64)</strong></h3>
- <p>Top-K sampling described in academic paper "The Curious Case of Neural Text Degeneration" https://arxiv.org/abs/1904.09751</p>
- <pre><code class="language-csharp">public static void llama_sample_top_k(SafeLLamaContextHandle ctx, IntPtr candidates, int k, ulong min_keep)
- </code></pre>
- <h4 id="parameters_6">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>k</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_sample_top_psafellamacontexthandle-intptr-single-uint64"><strong>llama_sample_top_p(SafeLLamaContextHandle, IntPtr, Single, UInt64)</strong></h3>
- <p>Nucleus sampling described in academic paper "The Curious Case of Neural Text Degeneration" https://arxiv.org/abs/1904.09751</p>
- <pre><code class="language-csharp">public static void llama_sample_top_p(SafeLLamaContextHandle ctx, IntPtr candidates, float p, ulong min_keep)
- </code></pre>
- <h4 id="parameters_7">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>p</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_sample_tail_freesafellamacontexthandle-intptr-single-uint64"><strong>llama_sample_tail_free(SafeLLamaContextHandle, IntPtr, Single, UInt64)</strong></h3>
- <p>Tail Free Sampling described in https://www.trentonbricken.com/Tail-Free-Sampling/.</p>
- <pre><code class="language-csharp">public static void llama_sample_tail_free(SafeLLamaContextHandle ctx, IntPtr candidates, float z, ulong min_keep)
- </code></pre>
- <h4 id="parameters_8">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>z</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_sample_typicalsafellamacontexthandle-intptr-single-uint64"><strong>llama_sample_typical(SafeLLamaContextHandle, IntPtr, Single, UInt64)</strong></h3>
- <p>Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666.</p>
- <pre><code class="language-csharp">public static void llama_sample_typical(SafeLLamaContextHandle ctx, IntPtr candidates, float p, ulong min_keep)
- </code></pre>
- <h4 id="parameters_9">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <p><code>p</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_sample_temperaturesafellamacontexthandle-intptr-single"><strong>llama_sample_temperature(SafeLLamaContextHandle, IntPtr, Single)</strong></h3>
- <pre><code class="language-csharp">public static void llama_sample_temperature(SafeLLamaContextHandle ctx, IntPtr candidates, float temp)
- </code></pre>
- <h4 id="parameters_10">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
- <p><code>temp</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
- <h3 id="llama_sample_token_mirostatsafellamacontexthandle-intptr-single-single-int32-single"><strong>llama_sample_token_mirostat(SafeLLamaContextHandle, IntPtr, Single, Single, Int32, Single*)</strong></h3>
- <p>Mirostat 1.0 algorithm described in the paper https://arxiv.org/abs/2007.14966. Uses tokens instead of words.</p>
- <pre><code class="language-csharp">public static int llama_sample_token_mirostat(SafeLLamaContextHandle ctx, IntPtr candidates, float tau, float eta, int m, Single* mu)
- </code></pre>
- <h4 id="parameters_11">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- A vector of <code>llama_token_data</code> containing the candidate tokens, their probabilities (p), and log-odds (logit) for the current position in the generated text.</p>
- <p><code>tau</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
- The target cross-entropy (or surprise) value you want to achieve for the generated text. A higher value corresponds to more surprising or less predictable text, while a lower value corresponds to less surprising or more predictable text.</p>
- <p><code>eta</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
- The learning rate used to update <code>mu</code> based on the error between the target and observed surprisal of the sampled word. A larger learning rate will cause <code>mu</code> to be updated more quickly, while a smaller learning rate will result in slower updates.</p>
- <p><code>m</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
- The number of tokens considered in the estimation of <code>s_hat</code>. This is an arbitrary value that is used to calculate <code>s_hat</code>, which in turn helps to calculate the value of <code>k</code>. In the paper, they use <code>m = 100</code>, but you can experiment with different values to see how it affects the performance of the algorithm.</p>
- <p><code>mu</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br>
- Maximum cross-entropy. This value is initialized to be twice the target cross-entropy (<code>2 * tau</code>) and is updated in the algorithm based on the error between the target and observed surprisal.</p>
- <h4 id="returns_2">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_sample_token_mirostat_v2safellamacontexthandle-intptr-single-single-single"><strong>llama_sample_token_mirostat_v2(SafeLLamaContextHandle, IntPtr, Single, Single, Single*)</strong></h3>
- <p>Mirostat 2.0 algorithm described in the paper https://arxiv.org/abs/2007.14966. Uses tokens instead of words.</p>
- <pre><code class="language-csharp">public static int llama_sample_token_mirostat_v2(SafeLLamaContextHandle ctx, IntPtr candidates, float tau, float eta, Single* mu)
- </code></pre>
- <h4 id="parameters_12">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- A vector of <code>llama_token_data</code> containing the candidate tokens, their probabilities (p), and log-odds (logit) for the current position in the generated text.</p>
- <p><code>tau</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
- The target cross-entropy (or surprise) value you want to achieve for the generated text. A higher value corresponds to more surprising or less predictable text, while a lower value corresponds to less surprising or more predictable text.</p>
- <p><code>eta</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
- The learning rate used to update <code>mu</code> based on the error between the target and observed surprisal of the sampled word. A larger learning rate will cause <code>mu</code> to be updated more quickly, while a smaller learning rate will result in slower updates.</p>
- <p><code>mu</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br>
- Maximum cross-entropy. This value is initialized to be twice the target cross-entropy (<code>2 * tau</code>) and is updated in the algorithm based on the error between the target and observed surprisal.</p>
- <h4 id="returns_3">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_sample_token_greedysafellamacontexthandle-intptr"><strong>llama_sample_token_greedy(SafeLLamaContextHandle, IntPtr)</strong></h3>
- <p>Selects the token with the highest probability.</p>
- <pre><code class="language-csharp">public static int llama_sample_token_greedy(SafeLLamaContextHandle ctx, IntPtr candidates)
- </code></pre>
- <h4 id="parameters_13">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <h4 id="returns_4">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_sample_tokensafellamacontexthandle-intptr"><strong>llama_sample_token(SafeLLamaContextHandle, IntPtr)</strong></h3>
- <p>Randomly selects a token from the candidates based on their probabilities.</p>
- <pre><code class="language-csharp">public static int llama_sample_token(SafeLLamaContextHandle ctx, IntPtr candidates)
- </code></pre>
- <h4 id="parameters_14">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>candidates</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to LLamaTokenDataArray</p>
- <h4 id="returns_5">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_empty_call"><strong>llama_empty_call()</strong></h3>
- <pre><code class="language-csharp">public static bool llama_empty_call()
- </code></pre>
- <h4 id="returns_6">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h3 id="llama_context_default_params"><strong>llama_context_default_params()</strong></h3>
- <pre><code class="language-csharp">public static LLamaContextParams llama_context_default_params()
- </code></pre>
- <h4 id="returns_7">Returns</h4>
- <p><a href="../llama.native.llamacontextparams/">LLamaContextParams</a><br></p>
- <h3 id="llama_mmap_supported"><strong>llama_mmap_supported()</strong></h3>
- <pre><code class="language-csharp">public static bool llama_mmap_supported()
- </code></pre>
- <h4 id="returns_8">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h3 id="llama_mlock_supported"><strong>llama_mlock_supported()</strong></h3>
- <pre><code class="language-csharp">public static bool llama_mlock_supported()
- </code></pre>
- <h4 id="returns_9">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h3 id="llama_init_from_filestring-llamacontextparams"><strong>llama_init_from_file(String, LLamaContextParams)</strong></h3>
- <p>Various functions for loading a ggml llama model.
- Allocate (almost) all memory needed for the model.
- Return NULL on failure</p>
- <pre><code class="language-csharp">public static IntPtr llama_init_from_file(string path_model, LLamaContextParams params_)
- </code></pre>
- <h4 id="parameters_15">Parameters</h4>
- <p><code>path_model</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>params_</code> <a href="../llama.native.llamacontextparams/">LLamaContextParams</a><br></p>
- <h4 id="returns_10">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
- <h3 id="llama_init_backend"><strong>llama_init_backend()</strong></h3>
- <p>not great API - very likely to change.
- Initialize the llama + ggml backend
- Call once at the start of the program</p>
- <pre><code class="language-csharp">public static void llama_init_backend()
- </code></pre>
- <h3 id="llama_freeintptr"><strong>llama_free(IntPtr)</strong></h3>
- <p>Frees all allocated memory</p>
- <pre><code class="language-csharp">public static void llama_free(IntPtr ctx)
- </code></pre>
- <h4 id="parameters_16">Parameters</h4>
- <p><code>ctx</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
- <h3 id="llama_apply_lora_from_filesafellamacontexthandle-string-string-int32"><strong>llama_apply_lora_from_file(SafeLLamaContextHandle, String, String, Int32)</strong></h3>
- <p>Apply a LoRA adapter to a loaded model
- path_base_model is the path to a higher quality model to use as a base for
- the layers modified by the adapter. Can be NULL to use the current loaded model.
- The model needs to be reloaded before applying a new adapter, otherwise the adapter
- will be applied on top of the previous one</p>
- <pre><code class="language-csharp">public static int llama_apply_lora_from_file(SafeLLamaContextHandle ctx, string path_lora, string path_base_model, int n_threads)
- </code></pre>
- <h4 id="parameters_17">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>path_lora</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>path_base_model</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h4 id="returns_11">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
- Returns 0 on success</p>
- <h3 id="llama_get_kv_cache_token_countsafellamacontexthandle"><strong>llama_get_kv_cache_token_count(SafeLLamaContextHandle)</strong></h3>
- <p>Returns the number of tokens in the KV cache</p>
- <pre><code class="language-csharp">public static int llama_get_kv_cache_token_count(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_18">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_12">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_set_rng_seedsafellamacontexthandle-int32"><strong>llama_set_rng_seed(SafeLLamaContextHandle, Int32)</strong></h3>
- <p>Sets the current rng seed.</p>
- <pre><code class="language-csharp">public static void llama_set_rng_seed(SafeLLamaContextHandle ctx, int seed)
- </code></pre>
- <h4 id="parameters_19">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>seed</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_get_state_sizesafellamacontexthandle"><strong>llama_get_state_size(SafeLLamaContextHandle)</strong></h3>
- <p>Returns the maximum size in bytes of the state (rng, logits, embedding
- and kv_cache) - will often be smaller after compacting tokens</p>
- <pre><code class="language-csharp">public static ulong llama_get_state_size(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_20">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_13">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_copy_state_datasafellamacontexthandle-byte"><strong>llama_copy_state_data(SafeLLamaContextHandle, Byte[])</strong></h3>
- <p>Copies the state to the specified destination address.
- Destination needs to have allocated enough memory.
- Returns the number of bytes copied</p>
- <pre><code class="language-csharp">public static ulong llama_copy_state_data(SafeLLamaContextHandle ctx, Byte[] dest)
- </code></pre>
- <h4 id="parameters_21">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>dest</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte">Byte[]</a><br></p>
- <h4 id="returns_14">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_set_state_datasafellamacontexthandle-byte"><strong>llama_set_state_data(SafeLLamaContextHandle, Byte[])</strong></h3>
- <p>Set the state reading from the specified address
- Returns the number of bytes read</p>
- <pre><code class="language-csharp">public static ulong llama_set_state_data(SafeLLamaContextHandle ctx, Byte[] src)
- </code></pre>
- <h4 id="parameters_22">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>src</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte">Byte[]</a><br></p>
- <h4 id="returns_15">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h3 id="llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64"><strong>llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)</strong></h3>
- <p>Load session file</p>
- <pre><code class="language-csharp">public static bool llama_load_session_file(SafeLLamaContextHandle ctx, string path_session, Int32[] tokens_out, ulong n_token_capacity, UInt64* n_token_count_out)
- </code></pre>
- <h4 id="parameters_23">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>path_session</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>tokens_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>n_token_capacity</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <p><code>n_token_count_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64*">UInt64*</a><br></p>
- <h4 id="returns_16">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h3 id="llama_save_session_filesafellamacontexthandle-string-int32-uint64"><strong>llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)</strong></h3>
- <p>Save session file</p>
- <pre><code class="language-csharp">public static bool llama_save_session_file(SafeLLamaContextHandle ctx, string path_session, Int32[] tokens, ulong n_token_count)
- </code></pre>
- <h4 id="parameters_24">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>path_session</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>n_token_count</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
- <h4 id="returns_17">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h3 id="llama_evalsafellamacontexthandle-int32-int32-int32-int32"><strong>llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)</strong></h3>
- <p>Run the llama inference to obtain the logits and probabilities for the next token.
- tokens + n_tokens is the provided batch of new tokens to process
- n_past is the number of tokens to use from previous eval calls</p>
- <pre><code class="language-csharp">public static int llama_eval(SafeLLamaContextHandle ctx, Int32[] tokens, int n_tokens, int n_past, int n_threads)
- </code></pre>
- <h4 id="parameters_25">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>n_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>n_past</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h4 id="returns_18">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
- Returns 0 on success</p>
- <h3 id="llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32"><strong>llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)</strong></h3>
- <pre><code class="language-csharp">public static int llama_eval_with_pointer(SafeLLamaContextHandle ctx, Int32* tokens, int n_tokens, int n_past, int n_threads)
- </code></pre>
- <h4 id="parameters_26">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
- <p><code>n_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>n_past</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h4 id="returns_19">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean"><strong>llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)</strong></h3>
- <p>Convert the provided text into tokens.
- The tokens pointer must be large enough to hold the resulting tokens.
- Returns the number of tokens on success, no more than n_max_tokens
- Returns a negative number on failure - the number of tokens that would have been returned</p>
- <pre><code class="language-csharp">public static int llama_tokenize(SafeLLamaContextHandle ctx, string text, Encoding encoding, Int32[] tokens, int n_max_tokens, bool add_bos)
- </code></pre>
- <h4 id="parameters_27">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>text</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
- <p><code>encoding</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding">Encoding</a><br></p>
- <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>n_max_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>add_bos</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h4 id="returns_20">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_tokenize_nativesafellamacontexthandle-sbyte-int32-int32-boolean"><strong>llama_tokenize_native(SafeLLamaContextHandle, SByte[], Int32[], Int32, Boolean)</strong></h3>
- <pre><code class="language-csharp">public static int llama_tokenize_native(SafeLLamaContextHandle ctx, SByte[] text, Int32[] tokens, int n_max_tokens, bool add_bos)
- </code></pre>
- <h4 id="parameters_28">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>text</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.sbyte">SByte[]</a><br></p>
- <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
- <p><code>n_max_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <p><code>add_bos</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
- <h4 id="returns_21">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_n_vocabsafellamacontexthandle"><strong>llama_n_vocab(SafeLLamaContextHandle)</strong></h3>
- <pre><code class="language-csharp">public static int llama_n_vocab(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_29">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_22">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_n_ctxsafellamacontexthandle"><strong>llama_n_ctx(SafeLLamaContextHandle)</strong></h3>
- <pre><code class="language-csharp">public static int llama_n_ctx(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_30">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_23">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_n_embdsafellamacontexthandle"><strong>llama_n_embd(SafeLLamaContextHandle)</strong></h3>
- <pre><code class="language-csharp">public static int llama_n_embd(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_31">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_24">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_get_logitssafellamacontexthandle"><strong>llama_get_logits(SafeLLamaContextHandle)</strong></h3>
- <p>Token logits obtained from the last call to llama_eval()
- The logits for the last token are stored in the last row
- Can be mutated in order to change the probabilities of the next token
- Rows: n_tokens
- Cols: n_vocab</p>
- <pre><code class="language-csharp">public static Single* llama_get_logits(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_32">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_25">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br></p>
- <h3 id="llama_get_embeddingssafellamacontexthandle"><strong>llama_get_embeddings(SafeLLamaContextHandle)</strong></h3>
- <p>Get the embeddings for the input
- shape: [n_embd] (1-dimensional)</p>
- <pre><code class="language-csharp">public static Single* llama_get_embeddings(SafeLLamaContextHandle ctx)
- </code></pre>
- <h4 id="parameters_33">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <h4 id="returns_26">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br></p>
- <h3 id="llama_token_to_strsafellamacontexthandle-int32"><strong>llama_token_to_str(SafeLLamaContextHandle, Int32)</strong></h3>
- <p>Token Id -> String. Uses the vocabulary in the provided context</p>
- <pre><code class="language-csharp">public static IntPtr llama_token_to_str(SafeLLamaContextHandle ctx, int token)
- </code></pre>
- <h4 id="parameters_34">Parameters</h4>
- <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
- <p><code>token</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h4 id="returns_27">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
- Pointer to a string.</p>
- <h3 id="llama_token_bos"><strong>llama_token_bos()</strong></h3>
- <pre><code class="language-csharp">public static int llama_token_bos()
- </code></pre>
- <h4 id="returns_28">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_token_eos"><strong>llama_token_eos()</strong></h3>
- <pre><code class="language-csharp">public static int llama_token_eos()
- </code></pre>
- <h4 id="returns_29">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
- <h3 id="llama_token_nl"><strong>llama_token_nl()</strong></h3>
- <pre><code class="language-csharp">public static int llama_token_nl()
- </code></pre>
- <h4 id="returns_30">Returns</h4>
- <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
-
-
-
-
-
-
- </article>
- </div>
-
-
- </div>
-
- </main>
-
- <footer class="md-footer">
-
- <div class="md-footer-meta md-typeset">
- <div class="md-footer-meta__inner md-grid">
- <div class="md-copyright">
-
-
- Made with
- <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
- Material for MkDocs
- </a>
-
- </div>
-
- </div>
- </div>
- </footer>
-
- </div>
- <div class="md-dialog" data-md-component="dialog">
- <div class="md-dialog__inner md-typeset"></div>
- </div>
-
- <script id="__config" type="application/json">{"base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
-
-
- <script src="../../assets/javascripts/bundle.a51614de.min.js"></script>
-
-
- </body>
- </html>
|