You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 164 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736
  1. <!doctype html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <link rel="prev" href="../llama.native.llamatokendataarraynative/">
  7. <link rel="next" href="../llama.native.safellamacontexthandle/">
  8. <link rel="icon" href="../../assets/images/favicon.png">
  9. <meta name="generator" content="mkdocs-1.4.3, mkdocs-material-9.1.16">
  10. <title>llama.native.nativeapi - LLamaSharp Documentation</title>
  11. <link rel="stylesheet" href="../../assets/stylesheets/main.26e3688c.min.css">
  12. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  13. <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">
  14. <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  15. <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>
  16. </head>
  17. <body dir="ltr">
  18. <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>
  19. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  20. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  21. <label class="md-overlay" for="__drawer"></label>
  22. <div data-md-component="skip">
  23. <a href="#nativeapi" class="md-skip">
  24. Skip to content
  25. </a>
  26. </div>
  27. <div data-md-component="announce">
  28. </div>
  29. <div data-md-color-scheme="default" data-md-component="outdated" hidden>
  30. </div>
  31. <header class="md-header md-header--shadow" data-md-component="header">
  32. <nav class="md-header__inner md-grid" aria-label="Header">
  33. <a href="../.." title="LLamaSharp Documentation" class="md-header__button md-logo" aria-label="LLamaSharp Documentation" data-md-component="logo">
  34. <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>
  35. </a>
  36. <label class="md-header__button md-icon" for="__drawer">
  37. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
  38. </label>
  39. <div class="md-header__title" data-md-component="header-title">
  40. <div class="md-header__ellipsis">
  41. <div class="md-header__topic">
  42. <span class="md-ellipsis">
  43. LLamaSharp Documentation
  44. </span>
  45. </div>
  46. <div class="md-header__topic" data-md-component="header-topic">
  47. <span class="md-ellipsis">
  48. llama.native.nativeapi
  49. </span>
  50. </div>
  51. </div>
  52. </div>
  53. <label class="md-header__button md-icon" for="__search">
  54. <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>
  55. </label>
  56. <div class="md-search" data-md-component="search" role="dialog">
  57. <label class="md-search__overlay" for="__search"></label>
  58. <div class="md-search__inner" role="search">
  59. <form class="md-search__form" name="search">
  60. <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>
  61. <label class="md-search__icon md-icon" for="__search">
  62. <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>
  63. <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>
  64. </label>
  65. <nav class="md-search__options" aria-label="Search">
  66. <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
  67. <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>
  68. </button>
  69. </nav>
  70. </form>
  71. <div class="md-search__output">
  72. <div class="md-search__scrollwrap" data-md-scrollfix>
  73. <div class="md-search-result" data-md-component="search-result">
  74. <div class="md-search-result__meta">
  75. Initializing search
  76. </div>
  77. <ol class="md-search-result__list" role="presentation"></ol>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </nav>
  84. </header>
  85. <div class="md-container" data-md-component="container">
  86. <main class="md-main" data-md-component="main">
  87. <div class="md-main__inner md-grid">
  88. <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
  89. <div class="md-sidebar__scrollwrap">
  90. <div class="md-sidebar__inner">
  91. <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  92. <label class="md-nav__title" for="__drawer">
  93. <a href="../.." title="LLamaSharp Documentation" class="md-nav__button md-logo" aria-label="LLamaSharp Documentation" data-md-component="logo">
  94. <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>
  95. </a>
  96. LLamaSharp Documentation
  97. </label>
  98. <ul class="md-nav__list" data-md-scrollfix>
  99. <li class="md-nav__item">
  100. <a href="../.." class="md-nav__link">
  101. Overview
  102. </a>
  103. </li>
  104. <li class="md-nav__item">
  105. <a href="../../GetStarted/" class="md-nav__link">
  106. Get Started
  107. </a>
  108. </li>
  109. <li class="md-nav__item">
  110. <a href="../../Architecture/" class="md-nav__link">
  111. Architecture
  112. </a>
  113. </li>
  114. <li class="md-nav__item">
  115. <a href="../../Tricks/" class="md-nav__link">
  116. Tricks for FAQ
  117. </a>
  118. </li>
  119. <li class="md-nav__item">
  120. <a href="../../ContributingGuide/" class="md-nav__link">
  121. Contributing Guide
  122. </a>
  123. </li>
  124. <li class="md-nav__item md-nav__item--nested">
  125. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
  126. <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
  127. LLamaContext
  128. <span class="md-nav__icon md-icon"></span>
  129. </label>
  130. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
  131. <label class="md-nav__title" for="__nav_6">
  132. <span class="md-nav__icon md-icon"></span>
  133. LLamaContext
  134. </label>
  135. <ul class="md-nav__list" data-md-scrollfix>
  136. <li class="md-nav__item">
  137. <a href="../../LLamaContext/parameters.md" class="md-nav__link">
  138. Context Parameters
  139. </a>
  140. </li>
  141. <li class="md-nav__item">
  142. <a href="../../LLamaContext/tokenization.md" class="md-nav__link">
  143. Tokenization
  144. </a>
  145. </li>
  146. <li class="md-nav__item">
  147. <a href="../../LLamaContext/embeddings.md" class="md-nav__link">
  148. Get Embeddings
  149. </a>
  150. </li>
  151. <li class="md-nav__item">
  152. <a href="../../LLamaContext/quantization.md" class="md-nav__link">
  153. Quantization
  154. </a>
  155. </li>
  156. <li class="md-nav__item">
  157. <a href="../../LLamaContext/save-load-state.md" class="md-nav__link">
  158. Save/Load State
  159. </a>
  160. </li>
  161. </ul>
  162. </nav>
  163. </li>
  164. <li class="md-nav__item md-nav__item--nested">
  165. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
  166. <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
  167. LLamaExecutors
  168. <span class="md-nav__icon md-icon"></span>
  169. </label>
  170. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
  171. <label class="md-nav__title" for="__nav_7">
  172. <span class="md-nav__icon md-icon"></span>
  173. LLamaExecutors
  174. </label>
  175. <ul class="md-nav__list" data-md-scrollfix>
  176. <li class="md-nav__item">
  177. <a href="../../LLamaExecutors/parameters/" class="md-nav__link">
  178. Inference Parameters
  179. </a>
  180. </li>
  181. <li class="md-nav__item">
  182. <a href="../../LLamaExecutors/text-to-text-apis/" class="md-nav__link">
  183. Text-to-Text APIs
  184. </a>
  185. </li>
  186. <li class="md-nav__item">
  187. <a href="../../LLamaExecutors/save-load-state/" class="md-nav__link">
  188. Save/Load State
  189. </a>
  190. </li>
  191. <li class="md-nav__item">
  192. <a href="../../LLamaExecutors/differences/" class="md-nav__link">
  193. Differences of Executors
  194. </a>
  195. </li>
  196. </ul>
  197. </nav>
  198. </li>
  199. <li class="md-nav__item md-nav__item--nested">
  200. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
  201. <label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
  202. ChatSession
  203. <span class="md-nav__icon md-icon"></span>
  204. </label>
  205. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
  206. <label class="md-nav__title" for="__nav_8">
  207. <span class="md-nav__icon md-icon"></span>
  208. ChatSession
  209. </label>
  210. <ul class="md-nav__list" data-md-scrollfix>
  211. <li class="md-nav__item">
  212. <a href="../../ChatSession/basic-usages/" class="md-nav__link">
  213. Basic Usages
  214. </a>
  215. </li>
  216. <li class="md-nav__item">
  217. <a href="../../ChatSession/transforms/" class="md-nav__link">
  218. Transoforms
  219. </a>
  220. </li>
  221. <li class="md-nav__item">
  222. <a href="../../ChatSession/save-load-session/" class="md-nav__link">
  223. Save/Load Session
  224. </a>
  225. </li>
  226. </ul>
  227. </nav>
  228. </li>
  229. <li class="md-nav__item md-nav__item--nested">
  230. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
  231. <label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
  232. Non-English Usages
  233. <span class="md-nav__icon md-icon"></span>
  234. </label>
  235. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
  236. <label class="md-nav__title" for="__nav_9">
  237. <span class="md-nav__icon md-icon"></span>
  238. Non-English Usages
  239. </label>
  240. <ul class="md-nav__list" data-md-scrollfix>
  241. <li class="md-nav__item">
  242. <a href="../../NonEnglishUsage/Chinese/" class="md-nav__link">
  243. Chinese
  244. </a>
  245. </li>
  246. </ul>
  247. </nav>
  248. </li>
  249. <li class="md-nav__item md-nav__item--nested">
  250. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
  251. <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
  252. High-level Applications
  253. <span class="md-nav__icon md-icon"></span>
  254. </label>
  255. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
  256. <label class="md-nav__title" for="__nav_10">
  257. <span class="md-nav__icon md-icon"></span>
  258. High-level Applications
  259. </label>
  260. <ul class="md-nav__list" data-md-scrollfix>
  261. <li class="md-nav__item">
  262. <a href="../../HighLevelApps/bot-sharp/" class="md-nav__link">
  263. BotSharp
  264. </a>
  265. </li>
  266. <li class="md-nav__item">
  267. <a href="../../HighLevelApps/semantic-kernel/" class="md-nav__link">
  268. semantic-kernel
  269. </a>
  270. </li>
  271. </ul>
  272. </nav>
  273. </li>
  274. <li class="md-nav__item md-nav__item--nested">
  275. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_11" >
  276. <label class="md-nav__link" for="__nav_11" id="__nav_11_label" tabindex="0">
  277. More
  278. <span class="md-nav__icon md-icon"></span>
  279. </label>
  280. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_11_label" aria-expanded="false">
  281. <label class="md-nav__title" for="__nav_11">
  282. <span class="md-nav__icon md-icon"></span>
  283. More
  284. </label>
  285. <ul class="md-nav__list" data-md-scrollfix>
  286. <li class="md-nav__item">
  287. <a href="../../More/log/" class="md-nav__link">
  288. Logger
  289. </a>
  290. </li>
  291. </ul>
  292. </nav>
  293. </li>
  294. <li class="md-nav__item md-nav__item--nested">
  295. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_12" >
  296. <label class="md-nav__link" for="__nav_12" id="__nav_12_label" tabindex="0">
  297. Examples
  298. <span class="md-nav__icon md-icon"></span>
  299. </label>
  300. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_12_label" aria-expanded="false">
  301. <label class="md-nav__title" for="__nav_12">
  302. <span class="md-nav__icon md-icon"></span>
  303. Examples
  304. </label>
  305. <ul class="md-nav__list" data-md-scrollfix>
  306. <li class="md-nav__item">
  307. <a href="../../Examples/ChatSessionStripRoleName/" class="md-nav__link">
  308. Chat session 1
  309. </a>
  310. </li>
  311. <li class="md-nav__item">
  312. <a href="../../Examples/ChatSessionWithRoleName/" class="md-nav__link">
  313. Chat session 2
  314. </a>
  315. </li>
  316. <li class="md-nav__item">
  317. <a href="../../Examples/GetEmbeddings/" class="md-nav__link">
  318. Get embeddings
  319. </a>
  320. </li>
  321. <li class="md-nav__item">
  322. <a href="../../Examples/InstructModeExecute/" class="md-nav__link">
  323. Instruct executor
  324. </a>
  325. </li>
  326. <li class="md-nav__item">
  327. <a href="../../Examples/InteractiveModeExecute/" class="md-nav__link">
  328. Interactive executor
  329. </a>
  330. </li>
  331. <li class="md-nav__item">
  332. <a href="../../Examples/StatelessModeExecute/" class="md-nav__link">
  333. Stateless exeutor
  334. </a>
  335. </li>
  336. <li class="md-nav__item">
  337. <a href="../../Examples/LoadAndSaveSession/" class="md-nav__link">
  338. Load/Save session
  339. </a>
  340. </li>
  341. <li class="md-nav__item">
  342. <a href="../../Examples/LoadAndSaveState/" class="md-nav__link">
  343. Load/Save state
  344. </a>
  345. </li>
  346. <li class="md-nav__item">
  347. <a href="../../Examples/QuantizeModel/" class="md-nav__link">
  348. Quantize model
  349. </a>
  350. </li>
  351. </ul>
  352. </nav>
  353. </li>
  354. <li class="md-nav__item md-nav__item--active md-nav__item--nested">
  355. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_13" checked>
  356. <label class="md-nav__link" for="__nav_13" id="__nav_13_label" tabindex="0">
  357. API Reference
  358. <span class="md-nav__icon md-icon"></span>
  359. </label>
  360. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_13_label" aria-expanded="true">
  361. <label class="md-nav__title" for="__nav_13">
  362. <span class="md-nav__icon md-icon"></span>
  363. API Reference
  364. </label>
  365. <ul class="md-nav__list" data-md-scrollfix>
  366. <li class="md-nav__item">
  367. <a href="../" class="md-nav__link">
  368. index
  369. </a>
  370. </li>
  371. <li class="md-nav__item">
  372. <a href="../llama.abstractions.ihistorytransform/" class="md-nav__link">
  373. llama.abstractions.ihistorytransform
  374. </a>
  375. </li>
  376. <li class="md-nav__item">
  377. <a href="../llama.abstractions.iinferenceparams/" class="md-nav__link">
  378. llama.abstractions.iinferenceparams
  379. </a>
  380. </li>
  381. <li class="md-nav__item">
  382. <a href="../llama.abstractions.illamaexecutor/" class="md-nav__link">
  383. llama.abstractions.illamaexecutor
  384. </a>
  385. </li>
  386. <li class="md-nav__item">
  387. <a href="../llama.abstractions.imodelparams/" class="md-nav__link">
  388. llama.abstractions.imodelparams
  389. </a>
  390. </li>
  391. <li class="md-nav__item">
  392. <a href="../llama.abstractions.itextstreamtransform/" class="md-nav__link">
  393. llama.abstractions.itextstreamtransform
  394. </a>
  395. </li>
  396. <li class="md-nav__item">
  397. <a href="../llama.abstractions.itexttransform/" class="md-nav__link">
  398. llama.abstractions.itexttransform
  399. </a>
  400. </li>
  401. <li class="md-nav__item">
  402. <a href="../llama.chatsession/" class="md-nav__link">
  403. llama.chatsession
  404. </a>
  405. </li>
  406. <li class="md-nav__item">
  407. <a href="../llama.common.authorrole/" class="md-nav__link">
  408. llama.common.authorrole
  409. </a>
  410. </li>
  411. <li class="md-nav__item">
  412. <a href="../llama.common.chathistory/" class="md-nav__link">
  413. llama.common.chathistory
  414. </a>
  415. </li>
  416. <li class="md-nav__item">
  417. <a href="../llama.common.fixedsizequeue-1/" class="md-nav__link">
  418. llama.common.fixedsizequeue-1
  419. </a>
  420. </li>
  421. <li class="md-nav__item">
  422. <a href="../llama.common.illamalogger/" class="md-nav__link">
  423. llama.common.illamalogger
  424. </a>
  425. </li>
  426. <li class="md-nav__item">
  427. <a href="../llama.common.inferenceparams/" class="md-nav__link">
  428. llama.common.inferenceparams
  429. </a>
  430. </li>
  431. <li class="md-nav__item">
  432. <a href="../llama.common.llamadefaultlogger/" class="md-nav__link">
  433. llama.common.llamadefaultlogger
  434. </a>
  435. </li>
  436. <li class="md-nav__item">
  437. <a href="../llama.common.mirostattype/" class="md-nav__link">
  438. llama.common.mirostattype
  439. </a>
  440. </li>
  441. <li class="md-nav__item">
  442. <a href="../llama.common.modelparams/" class="md-nav__link">
  443. llama.common.modelparams
  444. </a>
  445. </li>
  446. <li class="md-nav__item">
  447. <a href="../llama.exceptions.grammarexpectedname/" class="md-nav__link">
  448. llama.exceptions.grammarexpectedname
  449. </a>
  450. </li>
  451. <li class="md-nav__item">
  452. <a href="../llama.exceptions.grammarexpectednext/" class="md-nav__link">
  453. llama.exceptions.grammarexpectednext
  454. </a>
  455. </li>
  456. <li class="md-nav__item">
  457. <a href="../llama.exceptions.grammarexpectedprevious/" class="md-nav__link">
  458. llama.exceptions.grammarexpectedprevious
  459. </a>
  460. </li>
  461. <li class="md-nav__item">
  462. <a href="../llama.exceptions.grammarformatexception/" class="md-nav__link">
  463. llama.exceptions.grammarformatexception
  464. </a>
  465. </li>
  466. <li class="md-nav__item">
  467. <a href="../llama.exceptions.grammarunexpectedcharaltelement/" class="md-nav__link">
  468. llama.exceptions.grammarunexpectedcharaltelement
  469. </a>
  470. </li>
  471. <li class="md-nav__item">
  472. <a href="../llama.exceptions.grammarunexpectedcharrngelement/" class="md-nav__link">
  473. llama.exceptions.grammarunexpectedcharrngelement
  474. </a>
  475. </li>
  476. <li class="md-nav__item">
  477. <a href="../llama.exceptions.grammarunexpectedendelement/" class="md-nav__link">
  478. llama.exceptions.grammarunexpectedendelement
  479. </a>
  480. </li>
  481. <li class="md-nav__item">
  482. <a href="../llama.exceptions.grammarunexpectedendofinput/" class="md-nav__link">
  483. llama.exceptions.grammarunexpectedendofinput
  484. </a>
  485. </li>
  486. <li class="md-nav__item">
  487. <a href="../llama.exceptions.grammarunexpectedhexcharscount/" class="md-nav__link">
  488. llama.exceptions.grammarunexpectedhexcharscount
  489. </a>
  490. </li>
  491. <li class="md-nav__item">
  492. <a href="../llama.exceptions.grammarunknownescapecharacter/" class="md-nav__link">
  493. llama.exceptions.grammarunknownescapecharacter
  494. </a>
  495. </li>
  496. <li class="md-nav__item">
  497. <a href="../llama.exceptions.runtimeerror/" class="md-nav__link">
  498. llama.exceptions.runtimeerror
  499. </a>
  500. </li>
  501. <li class="md-nav__item">
  502. <a href="../llama.extensions.imodelparamsextensions/" class="md-nav__link">
  503. llama.extensions.imodelparamsextensions
  504. </a>
  505. </li>
  506. <li class="md-nav__item">
  507. <a href="../llama.extensions.keyvaluepairextensions/" class="md-nav__link">
  508. llama.extensions.keyvaluepairextensions
  509. </a>
  510. </li>
  511. <li class="md-nav__item">
  512. <a href="../llama.grammars.grammar/" class="md-nav__link">
  513. llama.grammars.grammar
  514. </a>
  515. </li>
  516. <li class="md-nav__item">
  517. <a href="../llama.grammars.grammarrule/" class="md-nav__link">
  518. llama.grammars.grammarrule
  519. </a>
  520. </li>
  521. <li class="md-nav__item">
  522. <a href="../llama.instructexecutor/" class="md-nav__link">
  523. llama.instructexecutor
  524. </a>
  525. </li>
  526. <li class="md-nav__item">
  527. <a href="../llama.interactiveexecutor/" class="md-nav__link">
  528. llama.interactiveexecutor
  529. </a>
  530. </li>
  531. <li class="md-nav__item">
  532. <a href="../llama.llamacontext/" class="md-nav__link">
  533. llama.llamacontext
  534. </a>
  535. </li>
  536. <li class="md-nav__item">
  537. <a href="../llama.llamaembedder/" class="md-nav__link">
  538. llama.llamaembedder
  539. </a>
  540. </li>
  541. <li class="md-nav__item">
  542. <a href="../llama.llamaquantizer/" class="md-nav__link">
  543. llama.llamaquantizer
  544. </a>
  545. </li>
  546. <li class="md-nav__item">
  547. <a href="../llama.llamatransforms/" class="md-nav__link">
  548. llama.llamatransforms
  549. </a>
  550. </li>
  551. <li class="md-nav__item">
  552. <a href="../llama.llamaweights/" class="md-nav__link">
  553. llama.llamaweights
  554. </a>
  555. </li>
  556. <li class="md-nav__item">
  557. <a href="../llama.native.llamacontextparams/" class="md-nav__link">
  558. llama.native.llamacontextparams
  559. </a>
  560. </li>
  561. <li class="md-nav__item">
  562. <a href="../llama.native.llamaftype/" class="md-nav__link">
  563. llama.native.llamaftype
  564. </a>
  565. </li>
  566. <li class="md-nav__item">
  567. <a href="../llama.native.llamagrammarelement/" class="md-nav__link">
  568. llama.native.llamagrammarelement
  569. </a>
  570. </li>
  571. <li class="md-nav__item">
  572. <a href="../llama.native.llamagrammarelementtype/" class="md-nav__link">
  573. llama.native.llamagrammarelementtype
  574. </a>
  575. </li>
  576. <li class="md-nav__item">
  577. <a href="../llama.native.llamamodelquantizeparams/" class="md-nav__link">
  578. llama.native.llamamodelquantizeparams
  579. </a>
  580. </li>
  581. <li class="md-nav__item">
  582. <a href="../llama.native.llamatokendata/" class="md-nav__link">
  583. llama.native.llamatokendata
  584. </a>
  585. </li>
  586. <li class="md-nav__item">
  587. <a href="../llama.native.llamatokendataarray/" class="md-nav__link">
  588. llama.native.llamatokendataarray
  589. </a>
  590. </li>
  591. <li class="md-nav__item">
  592. <a href="../llama.native.llamatokendataarraynative/" class="md-nav__link">
  593. llama.native.llamatokendataarraynative
  594. </a>
  595. </li>
  596. <li class="md-nav__item md-nav__item--active">
  597. <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
  598. <label class="md-nav__link md-nav__link--active" for="__toc">
  599. llama.native.nativeapi
  600. <span class="md-nav__icon md-icon"></span>
  601. </label>
  602. <a href="./" class="md-nav__link md-nav__link--active">
  603. llama.native.nativeapi
  604. </a>
  605. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  606. <label class="md-nav__title" for="__toc">
  607. <span class="md-nav__icon md-icon"></span>
  608. Table of contents
  609. </label>
  610. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  611. <li class="md-nav__item">
  612. <a href="#constructors" class="md-nav__link">
  613. Constructors
  614. </a>
  615. <nav class="md-nav" aria-label="Constructors">
  616. <ul class="md-nav__list">
  617. <li class="md-nav__item">
  618. <a href="#nativeapi_1" class="md-nav__link">
  619. NativeApi()
  620. </a>
  621. </li>
  622. </ul>
  623. </nav>
  624. </li>
  625. <li class="md-nav__item">
  626. <a href="#methods" class="md-nav__link">
  627. Methods
  628. </a>
  629. <nav class="md-nav" aria-label="Methods">
  630. <ul class="md-nav__list">
  631. <li class="md-nav__item">
  632. <a href="#llama_sample_token_mirostatsafellamacontexthandle-llamatokendataarraynative-single-single-int32-single" class="md-nav__link">
  633. llama_sample_token_mirostat(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Int32, Single&amp;)
  634. </a>
  635. <nav class="md-nav" aria-label="llama_sample_token_mirostat(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, Single, Int32, Single&)">
  636. <ul class="md-nav__list">
  637. <li class="md-nav__item">
  638. <a href="#parameters" class="md-nav__link">
  639. Parameters
  640. </a>
  641. </li>
  642. <li class="md-nav__item">
  643. <a href="#returns" class="md-nav__link">
  644. Returns
  645. </a>
  646. </li>
  647. </ul>
  648. </nav>
  649. </li>
  650. <li class="md-nav__item">
  651. <a href="#llama_sample_token_mirostat_v2safellamacontexthandle-llamatokendataarraynative-single-single-single" class="md-nav__link">
  652. llama_sample_token_mirostat_v2(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Single&amp;)
  653. </a>
  654. <nav class="md-nav" aria-label="llama_sample_token_mirostat_v2(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, Single, Single&)">
  655. <ul class="md-nav__list">
  656. <li class="md-nav__item">
  657. <a href="#parameters_1" class="md-nav__link">
  658. Parameters
  659. </a>
  660. </li>
  661. <li class="md-nav__item">
  662. <a href="#returns_1" class="md-nav__link">
  663. Returns
  664. </a>
  665. </li>
  666. </ul>
  667. </nav>
  668. </li>
  669. <li class="md-nav__item">
  670. <a href="#llama_sample_token_greedysafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  671. llama_sample_token_greedy(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  672. </a>
  673. <nav class="md-nav" aria-label="llama_sample_token_greedy(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  674. <ul class="md-nav__list">
  675. <li class="md-nav__item">
  676. <a href="#parameters_2" class="md-nav__link">
  677. Parameters
  678. </a>
  679. </li>
  680. <li class="md-nav__item">
  681. <a href="#returns_2" class="md-nav__link">
  682. Returns
  683. </a>
  684. </li>
  685. </ul>
  686. </nav>
  687. </li>
  688. <li class="md-nav__item">
  689. <a href="#llama_sample_tokensafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  690. llama_sample_token(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  691. </a>
  692. <nav class="md-nav" aria-label="llama_sample_token(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  693. <ul class="md-nav__list">
  694. <li class="md-nav__item">
  695. <a href="#parameters_3" class="md-nav__link">
  696. Parameters
  697. </a>
  698. </li>
  699. <li class="md-nav__item">
  700. <a href="#returns_3" class="md-nav__link">
  701. Returns
  702. </a>
  703. </li>
  704. </ul>
  705. </nav>
  706. </li>
  707. <li class="md-nav__item">
  708. <a href="#llama_token_to_strsafellamacontexthandle-int32" class="md-nav__link">
  709. llama_token_to_str(SafeLLamaContextHandle, Int32)
  710. </a>
  711. <nav class="md-nav" aria-label="llama_token_to_str(SafeLLamaContextHandle, Int32)">
  712. <ul class="md-nav__list">
  713. <li class="md-nav__item">
  714. <a href="#parameters_4" class="md-nav__link">
  715. Parameters
  716. </a>
  717. </li>
  718. <li class="md-nav__item">
  719. <a href="#returns_4" class="md-nav__link">
  720. Returns
  721. </a>
  722. </li>
  723. </ul>
  724. </nav>
  725. </li>
  726. <li class="md-nav__item">
  727. <a href="#llama_token_bossafellamacontexthandle" class="md-nav__link">
  728. llama_token_bos(SafeLLamaContextHandle)
  729. </a>
  730. <nav class="md-nav" aria-label="llama_token_bos(SafeLLamaContextHandle)">
  731. <ul class="md-nav__list">
  732. <li class="md-nav__item">
  733. <a href="#parameters_5" class="md-nav__link">
  734. Parameters
  735. </a>
  736. </li>
  737. <li class="md-nav__item">
  738. <a href="#returns_5" class="md-nav__link">
  739. Returns
  740. </a>
  741. </li>
  742. </ul>
  743. </nav>
  744. </li>
  745. <li class="md-nav__item">
  746. <a href="#llama_token_eossafellamacontexthandle" class="md-nav__link">
  747. llama_token_eos(SafeLLamaContextHandle)
  748. </a>
  749. <nav class="md-nav" aria-label="llama_token_eos(SafeLLamaContextHandle)">
  750. <ul class="md-nav__list">
  751. <li class="md-nav__item">
  752. <a href="#parameters_6" class="md-nav__link">
  753. Parameters
  754. </a>
  755. </li>
  756. <li class="md-nav__item">
  757. <a href="#returns_6" class="md-nav__link">
  758. Returns
  759. </a>
  760. </li>
  761. </ul>
  762. </nav>
  763. </li>
  764. <li class="md-nav__item">
  765. <a href="#llama_token_nlsafellamacontexthandle" class="md-nav__link">
  766. llama_token_nl(SafeLLamaContextHandle)
  767. </a>
  768. <nav class="md-nav" aria-label="llama_token_nl(SafeLLamaContextHandle)">
  769. <ul class="md-nav__list">
  770. <li class="md-nav__item">
  771. <a href="#parameters_7" class="md-nav__link">
  772. Parameters
  773. </a>
  774. </li>
  775. <li class="md-nav__item">
  776. <a href="#returns_7" class="md-nav__link">
  777. Returns
  778. </a>
  779. </li>
  780. </ul>
  781. </nav>
  782. </li>
  783. <li class="md-nav__item">
  784. <a href="#llama_print_timingssafellamacontexthandle" class="md-nav__link">
  785. llama_print_timings(SafeLLamaContextHandle)
  786. </a>
  787. <nav class="md-nav" aria-label="llama_print_timings(SafeLLamaContextHandle)">
  788. <ul class="md-nav__list">
  789. <li class="md-nav__item">
  790. <a href="#parameters_8" class="md-nav__link">
  791. Parameters
  792. </a>
  793. </li>
  794. </ul>
  795. </nav>
  796. </li>
  797. <li class="md-nav__item">
  798. <a href="#llama_reset_timingssafellamacontexthandle" class="md-nav__link">
  799. llama_reset_timings(SafeLLamaContextHandle)
  800. </a>
  801. <nav class="md-nav" aria-label="llama_reset_timings(SafeLLamaContextHandle)">
  802. <ul class="md-nav__list">
  803. <li class="md-nav__item">
  804. <a href="#parameters_9" class="md-nav__link">
  805. Parameters
  806. </a>
  807. </li>
  808. </ul>
  809. </nav>
  810. </li>
  811. <li class="md-nav__item">
  812. <a href="#llama_print_system_info" class="md-nav__link">
  813. llama_print_system_info()
  814. </a>
  815. <nav class="md-nav" aria-label="llama_print_system_info()">
  816. <ul class="md-nav__list">
  817. <li class="md-nav__item">
  818. <a href="#returns_8" class="md-nav__link">
  819. Returns
  820. </a>
  821. </li>
  822. </ul>
  823. </nav>
  824. </li>
  825. <li class="md-nav__item">
  826. <a href="#llama_model_n_vocabsafellamamodelhandle" class="md-nav__link">
  827. llama_model_n_vocab(SafeLlamaModelHandle)
  828. </a>
  829. <nav class="md-nav" aria-label="llama_model_n_vocab(SafeLlamaModelHandle)">
  830. <ul class="md-nav__list">
  831. <li class="md-nav__item">
  832. <a href="#parameters_10" class="md-nav__link">
  833. Parameters
  834. </a>
  835. </li>
  836. <li class="md-nav__item">
  837. <a href="#returns_9" class="md-nav__link">
  838. Returns
  839. </a>
  840. </li>
  841. </ul>
  842. </nav>
  843. </li>
  844. <li class="md-nav__item">
  845. <a href="#llama_model_n_ctxsafellamamodelhandle" class="md-nav__link">
  846. llama_model_n_ctx(SafeLlamaModelHandle)
  847. </a>
  848. <nav class="md-nav" aria-label="llama_model_n_ctx(SafeLlamaModelHandle)">
  849. <ul class="md-nav__list">
  850. <li class="md-nav__item">
  851. <a href="#parameters_11" class="md-nav__link">
  852. Parameters
  853. </a>
  854. </li>
  855. <li class="md-nav__item">
  856. <a href="#returns_10" class="md-nav__link">
  857. Returns
  858. </a>
  859. </li>
  860. </ul>
  861. </nav>
  862. </li>
  863. <li class="md-nav__item">
  864. <a href="#llama_model_n_embdsafellamamodelhandle" class="md-nav__link">
  865. llama_model_n_embd(SafeLlamaModelHandle)
  866. </a>
  867. <nav class="md-nav" aria-label="llama_model_n_embd(SafeLlamaModelHandle)">
  868. <ul class="md-nav__list">
  869. <li class="md-nav__item">
  870. <a href="#parameters_12" class="md-nav__link">
  871. Parameters
  872. </a>
  873. </li>
  874. <li class="md-nav__item">
  875. <a href="#returns_11" class="md-nav__link">
  876. Returns
  877. </a>
  878. </li>
  879. </ul>
  880. </nav>
  881. </li>
  882. <li class="md-nav__item">
  883. <a href="#llama_token_to_piece_with_modelsafellamamodelhandle-int32-byte-int32" class="md-nav__link">
  884. llama_token_to_piece_with_model(SafeLlamaModelHandle, Int32, Byte*, Int32)
  885. </a>
  886. <nav class="md-nav" aria-label="llama_token_to_piece_with_model(SafeLlamaModelHandle, Int32, Byte*, Int32)">
  887. <ul class="md-nav__list">
  888. <li class="md-nav__item">
  889. <a href="#parameters_13" class="md-nav__link">
  890. Parameters
  891. </a>
  892. </li>
  893. <li class="md-nav__item">
  894. <a href="#returns_12" class="md-nav__link">
  895. Returns
  896. </a>
  897. </li>
  898. </ul>
  899. </nav>
  900. </li>
  901. <li class="md-nav__item">
  902. <a href="#llama_tokenize_with_modelsafellamamodelhandle-byte-int32-int32-boolean" class="md-nav__link">
  903. llama_tokenize_with_model(SafeLlamaModelHandle, Byte, Int32, Int32, Boolean)
  904. </a>
  905. <nav class="md-nav" aria-label="llama_tokenize_with_model(SafeLlamaModelHandle, Byte, Int32, Int32, Boolean)">
  906. <ul class="md-nav__list">
  907. <li class="md-nav__item">
  908. <a href="#parameters_14" class="md-nav__link">
  909. Parameters
  910. </a>
  911. </li>
  912. <li class="md-nav__item">
  913. <a href="#returns_13" class="md-nav__link">
  914. Returns
  915. </a>
  916. </li>
  917. </ul>
  918. </nav>
  919. </li>
  920. <li class="md-nav__item">
  921. <a href="#llama_log_setllamalogcallback" class="md-nav__link">
  922. llama_log_set(LLamaLogCallback)
  923. </a>
  924. <nav class="md-nav" aria-label="llama_log_set(LLamaLogCallback)">
  925. <ul class="md-nav__list">
  926. <li class="md-nav__item">
  927. <a href="#parameters_15" class="md-nav__link">
  928. Parameters
  929. </a>
  930. </li>
  931. </ul>
  932. </nav>
  933. </li>
  934. <li class="md-nav__item">
  935. <a href="#llama_grammar_initllamagrammarelement-uint64-uint64" class="md-nav__link">
  936. llama_grammar_init(LLamaGrammarElement, UInt64, UInt64)**
  937. </a>
  938. <nav class="md-nav" aria-label="llama_grammar_init(LLamaGrammarElement, UInt64, UInt64)**">
  939. <ul class="md-nav__list">
  940. <li class="md-nav__item">
  941. <a href="#parameters_16" class="md-nav__link">
  942. Parameters
  943. </a>
  944. </li>
  945. <li class="md-nav__item">
  946. <a href="#returns_14" class="md-nav__link">
  947. Returns
  948. </a>
  949. </li>
  950. </ul>
  951. </nav>
  952. </li>
  953. <li class="md-nav__item">
  954. <a href="#llama_grammar_freeintptr" class="md-nav__link">
  955. llama_grammar_free(IntPtr)
  956. </a>
  957. <nav class="md-nav" aria-label="llama_grammar_free(IntPtr)">
  958. <ul class="md-nav__list">
  959. <li class="md-nav__item">
  960. <a href="#parameters_17" class="md-nav__link">
  961. Parameters
  962. </a>
  963. </li>
  964. </ul>
  965. </nav>
  966. </li>
  967. <li class="md-nav__item">
  968. <a href="#llama_sample_grammarsafellamacontexthandle-llamatokendataarraynative-safellamagrammarhandle" class="md-nav__link">
  969. llama_sample_grammar(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaGrammarHandle)
  970. </a>
  971. <nav class="md-nav" aria-label="llama_sample_grammar(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, SafeLLamaGrammarHandle)">
  972. <ul class="md-nav__list">
  973. <li class="md-nav__item">
  974. <a href="#parameters_18" class="md-nav__link">
  975. Parameters
  976. </a>
  977. </li>
  978. </ul>
  979. </nav>
  980. </li>
  981. <li class="md-nav__item">
  982. <a href="#llama_grammar_accept_tokensafellamacontexthandle-safellamagrammarhandle-int32" class="md-nav__link">
  983. llama_grammar_accept_token(SafeLLamaContextHandle, SafeLLamaGrammarHandle, Int32)
  984. </a>
  985. <nav class="md-nav" aria-label="llama_grammar_accept_token(SafeLLamaContextHandle, SafeLLamaGrammarHandle, Int32)">
  986. <ul class="md-nav__list">
  987. <li class="md-nav__item">
  988. <a href="#parameters_19" class="md-nav__link">
  989. Parameters
  990. </a>
  991. </li>
  992. </ul>
  993. </nav>
  994. </li>
  995. <li class="md-nav__item">
  996. <a href="#llama_model_quantizestring-string-llamamodelquantizeparams" class="md-nav__link">
  997. llama_model_quantize(String, String, LLamaModelQuantizeParams*)
  998. </a>
  999. <nav class="md-nav" aria-label="llama_model_quantize(String, String, LLamaModelQuantizeParams*)">
  1000. <ul class="md-nav__list">
  1001. <li class="md-nav__item">
  1002. <a href="#parameters_20" class="md-nav__link">
  1003. Parameters
  1004. </a>
  1005. </li>
  1006. <li class="md-nav__item">
  1007. <a href="#returns_15" class="md-nav__link">
  1008. Returns
  1009. </a>
  1010. </li>
  1011. </ul>
  1012. </nav>
  1013. </li>
  1014. <li class="md-nav__item">
  1015. <a href="#llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single" class="md-nav__link">
  1016. llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative, SafeLLamaContextHandle, Single)
  1017. </a>
  1018. <nav class="md-nav" aria-label="llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative, SafeLLamaContextHandle, Single)">
  1019. <ul class="md-nav__list">
  1020. <li class="md-nav__item">
  1021. <a href="#parameters_21" class="md-nav__link">
  1022. Parameters
  1023. </a>
  1024. </li>
  1025. </ul>
  1026. </nav>
  1027. </li>
  1028. <li class="md-nav__item">
  1029. <a href="#llama_sample_repetition_penaltysafellamacontexthandle-llamatokendataarraynative-int32-uint64-single" class="md-nav__link">
  1030. llama_sample_repetition_penalty(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single)
  1031. </a>
  1032. <nav class="md-nav" aria-label="llama_sample_repetition_penalty(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32*, UInt64, Single)">
  1033. <ul class="md-nav__list">
  1034. <li class="md-nav__item">
  1035. <a href="#parameters_22" class="md-nav__link">
  1036. Parameters
  1037. </a>
  1038. </li>
  1039. </ul>
  1040. </nav>
  1041. </li>
  1042. <li class="md-nav__item">
  1043. <a href="#llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-llamatokendataarraynative-int32-uint64-single-single" class="md-nav__link">
  1044. llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single, Single)
  1045. </a>
  1046. <nav class="md-nav" aria-label="llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32*, UInt64, Single, Single)">
  1047. <ul class="md-nav__list">
  1048. <li class="md-nav__item">
  1049. <a href="#parameters_23" class="md-nav__link">
  1050. Parameters
  1051. </a>
  1052. </li>
  1053. </ul>
  1054. </nav>
  1055. </li>
  1056. <li class="md-nav__item">
  1057. <a href="#llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single_1" class="md-nav__link">
  1058. llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaContextHandle, Single)
  1059. </a>
  1060. <nav class="md-nav" aria-label="llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, SafeLLamaContextHandle, Single)">
  1061. <ul class="md-nav__list">
  1062. <li class="md-nav__item">
  1063. <a href="#parameters_24" class="md-nav__link">
  1064. Parameters
  1065. </a>
  1066. </li>
  1067. </ul>
  1068. </nav>
  1069. </li>
  1070. <li class="md-nav__item">
  1071. <a href="#llama_sample_softmaxsafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  1072. llama_sample_softmax(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  1073. </a>
  1074. <nav class="md-nav" aria-label="llama_sample_softmax(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  1075. <ul class="md-nav__list">
  1076. <li class="md-nav__item">
  1077. <a href="#parameters_25" class="md-nav__link">
  1078. Parameters
  1079. </a>
  1080. </li>
  1081. </ul>
  1082. </nav>
  1083. </li>
  1084. <li class="md-nav__item">
  1085. <a href="#llama_sample_top_ksafellamacontexthandle-llamatokendataarraynative-int32-uint64" class="md-nav__link">
  1086. llama_sample_top_k(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32, UInt64)
  1087. </a>
  1088. <nav class="md-nav" aria-label="llama_sample_top_k(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32, UInt64)">
  1089. <ul class="md-nav__list">
  1090. <li class="md-nav__item">
  1091. <a href="#parameters_26" class="md-nav__link">
  1092. Parameters
  1093. </a>
  1094. </li>
  1095. </ul>
  1096. </nav>
  1097. </li>
  1098. <li class="md-nav__item">
  1099. <a href="#llama_sample_top_psafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  1100. llama_sample_top_p(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  1101. </a>
  1102. <nav class="md-nav" aria-label="llama_sample_top_p(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  1103. <ul class="md-nav__list">
  1104. <li class="md-nav__item">
  1105. <a href="#parameters_27" class="md-nav__link">
  1106. Parameters
  1107. </a>
  1108. </li>
  1109. </ul>
  1110. </nav>
  1111. </li>
  1112. <li class="md-nav__item">
  1113. <a href="#llama_sample_tail_freesafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  1114. llama_sample_tail_free(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  1115. </a>
  1116. <nav class="md-nav" aria-label="llama_sample_tail_free(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  1117. <ul class="md-nav__list">
  1118. <li class="md-nav__item">
  1119. <a href="#parameters_28" class="md-nav__link">
  1120. Parameters
  1121. </a>
  1122. </li>
  1123. </ul>
  1124. </nav>
  1125. </li>
  1126. <li class="md-nav__item">
  1127. <a href="#llama_sample_typicalsafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  1128. llama_sample_typical(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  1129. </a>
  1130. <nav class="md-nav" aria-label="llama_sample_typical(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  1131. <ul class="md-nav__list">
  1132. <li class="md-nav__item">
  1133. <a href="#parameters_29" class="md-nav__link">
  1134. Parameters
  1135. </a>
  1136. </li>
  1137. </ul>
  1138. </nav>
  1139. </li>
  1140. <li class="md-nav__item">
  1141. <a href="#llama_sample_temperaturesafellamacontexthandle-llamatokendataarraynative-single" class="md-nav__link">
  1142. llama_sample_temperature(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single)
  1143. </a>
  1144. <nav class="md-nav" aria-label="llama_sample_temperature(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single)">
  1145. <ul class="md-nav__list">
  1146. <li class="md-nav__item">
  1147. <a href="#parameters_30" class="md-nav__link">
  1148. Parameters
  1149. </a>
  1150. </li>
  1151. </ul>
  1152. </nav>
  1153. </li>
  1154. <li class="md-nav__item">
  1155. <a href="#llama_empty_call" class="md-nav__link">
  1156. llama_empty_call()
  1157. </a>
  1158. <nav class="md-nav" aria-label="llama_empty_call()">
  1159. <ul class="md-nav__list">
  1160. <li class="md-nav__item">
  1161. <a href="#returns_16" class="md-nav__link">
  1162. Returns
  1163. </a>
  1164. </li>
  1165. </ul>
  1166. </nav>
  1167. </li>
  1168. <li class="md-nav__item">
  1169. <a href="#llama_context_default_params" class="md-nav__link">
  1170. llama_context_default_params()
  1171. </a>
  1172. <nav class="md-nav" aria-label="llama_context_default_params()">
  1173. <ul class="md-nav__list">
  1174. <li class="md-nav__item">
  1175. <a href="#returns_17" class="md-nav__link">
  1176. Returns
  1177. </a>
  1178. </li>
  1179. </ul>
  1180. </nav>
  1181. </li>
  1182. <li class="md-nav__item">
  1183. <a href="#llama_model_quantize_default_params" class="md-nav__link">
  1184. llama_model_quantize_default_params()
  1185. </a>
  1186. <nav class="md-nav" aria-label="llama_model_quantize_default_params()">
  1187. <ul class="md-nav__list">
  1188. <li class="md-nav__item">
  1189. <a href="#returns_18" class="md-nav__link">
  1190. Returns
  1191. </a>
  1192. </li>
  1193. </ul>
  1194. </nav>
  1195. </li>
  1196. <li class="md-nav__item">
  1197. <a href="#llama_mmap_supported" class="md-nav__link">
  1198. llama_mmap_supported()
  1199. </a>
  1200. <nav class="md-nav" aria-label="llama_mmap_supported()">
  1201. <ul class="md-nav__list">
  1202. <li class="md-nav__item">
  1203. <a href="#returns_19" class="md-nav__link">
  1204. Returns
  1205. </a>
  1206. </li>
  1207. </ul>
  1208. </nav>
  1209. </li>
  1210. <li class="md-nav__item">
  1211. <a href="#llama_mlock_supported" class="md-nav__link">
  1212. llama_mlock_supported()
  1213. </a>
  1214. <nav class="md-nav" aria-label="llama_mlock_supported()">
  1215. <ul class="md-nav__list">
  1216. <li class="md-nav__item">
  1217. <a href="#returns_20" class="md-nav__link">
  1218. Returns
  1219. </a>
  1220. </li>
  1221. </ul>
  1222. </nav>
  1223. </li>
  1224. <li class="md-nav__item">
  1225. <a href="#llama_eval_exportsafellamacontexthandle-string" class="md-nav__link">
  1226. llama_eval_export(SafeLLamaContextHandle, String)
  1227. </a>
  1228. <nav class="md-nav" aria-label="llama_eval_export(SafeLLamaContextHandle, String)">
  1229. <ul class="md-nav__list">
  1230. <li class="md-nav__item">
  1231. <a href="#parameters_31" class="md-nav__link">
  1232. Parameters
  1233. </a>
  1234. </li>
  1235. <li class="md-nav__item">
  1236. <a href="#returns_21" class="md-nav__link">
  1237. Returns
  1238. </a>
  1239. </li>
  1240. </ul>
  1241. </nav>
  1242. </li>
  1243. <li class="md-nav__item">
  1244. <a href="#llama_load_model_from_filestring-llamacontextparams" class="md-nav__link">
  1245. llama_load_model_from_file(String, LLamaContextParams)
  1246. </a>
  1247. <nav class="md-nav" aria-label="llama_load_model_from_file(String, LLamaContextParams)">
  1248. <ul class="md-nav__list">
  1249. <li class="md-nav__item">
  1250. <a href="#parameters_32" class="md-nav__link">
  1251. Parameters
  1252. </a>
  1253. </li>
  1254. <li class="md-nav__item">
  1255. <a href="#returns_22" class="md-nav__link">
  1256. Returns
  1257. </a>
  1258. </li>
  1259. </ul>
  1260. </nav>
  1261. </li>
  1262. <li class="md-nav__item">
  1263. <a href="#llama_new_context_with_modelsafellamamodelhandle-llamacontextparams" class="md-nav__link">
  1264. llama_new_context_with_model(SafeLlamaModelHandle, LLamaContextParams)
  1265. </a>
  1266. <nav class="md-nav" aria-label="llama_new_context_with_model(SafeLlamaModelHandle, LLamaContextParams)">
  1267. <ul class="md-nav__list">
  1268. <li class="md-nav__item">
  1269. <a href="#parameters_33" class="md-nav__link">
  1270. Parameters
  1271. </a>
  1272. </li>
  1273. <li class="md-nav__item">
  1274. <a href="#returns_23" class="md-nav__link">
  1275. Returns
  1276. </a>
  1277. </li>
  1278. </ul>
  1279. </nav>
  1280. </li>
  1281. <li class="md-nav__item">
  1282. <a href="#llama_backend_initboolean" class="md-nav__link">
  1283. llama_backend_init(Boolean)
  1284. </a>
  1285. <nav class="md-nav" aria-label="llama_backend_init(Boolean)">
  1286. <ul class="md-nav__list">
  1287. <li class="md-nav__item">
  1288. <a href="#parameters_34" class="md-nav__link">
  1289. Parameters
  1290. </a>
  1291. </li>
  1292. </ul>
  1293. </nav>
  1294. </li>
  1295. <li class="md-nav__item">
  1296. <a href="#llama_freeintptr" class="md-nav__link">
  1297. llama_free(IntPtr)
  1298. </a>
  1299. <nav class="md-nav" aria-label="llama_free(IntPtr)">
  1300. <ul class="md-nav__list">
  1301. <li class="md-nav__item">
  1302. <a href="#parameters_35" class="md-nav__link">
  1303. Parameters
  1304. </a>
  1305. </li>
  1306. </ul>
  1307. </nav>
  1308. </li>
  1309. <li class="md-nav__item">
  1310. <a href="#llama_free_modelintptr" class="md-nav__link">
  1311. llama_free_model(IntPtr)
  1312. </a>
  1313. <nav class="md-nav" aria-label="llama_free_model(IntPtr)">
  1314. <ul class="md-nav__list">
  1315. <li class="md-nav__item">
  1316. <a href="#parameters_36" class="md-nav__link">
  1317. Parameters
  1318. </a>
  1319. </li>
  1320. </ul>
  1321. </nav>
  1322. </li>
  1323. <li class="md-nav__item">
  1324. <a href="#llama_model_apply_lora_from_filesafellamamodelhandle-string-string-int32" class="md-nav__link">
  1325. llama_model_apply_lora_from_file(SafeLlamaModelHandle, String, String, Int32)
  1326. </a>
  1327. <nav class="md-nav" aria-label="llama_model_apply_lora_from_file(SafeLlamaModelHandle, String, String, Int32)">
  1328. <ul class="md-nav__list">
  1329. <li class="md-nav__item">
  1330. <a href="#parameters_37" class="md-nav__link">
  1331. Parameters
  1332. </a>
  1333. </li>
  1334. <li class="md-nav__item">
  1335. <a href="#returns_24" class="md-nav__link">
  1336. Returns
  1337. </a>
  1338. </li>
  1339. </ul>
  1340. </nav>
  1341. </li>
  1342. <li class="md-nav__item">
  1343. <a href="#llama_get_kv_cache_token_countsafellamacontexthandle" class="md-nav__link">
  1344. llama_get_kv_cache_token_count(SafeLLamaContextHandle)
  1345. </a>
  1346. <nav class="md-nav" aria-label="llama_get_kv_cache_token_count(SafeLLamaContextHandle)">
  1347. <ul class="md-nav__list">
  1348. <li class="md-nav__item">
  1349. <a href="#parameters_38" class="md-nav__link">
  1350. Parameters
  1351. </a>
  1352. </li>
  1353. <li class="md-nav__item">
  1354. <a href="#returns_25" class="md-nav__link">
  1355. Returns
  1356. </a>
  1357. </li>
  1358. </ul>
  1359. </nav>
  1360. </li>
  1361. <li class="md-nav__item">
  1362. <a href="#llama_set_rng_seedsafellamacontexthandle-int32" class="md-nav__link">
  1363. llama_set_rng_seed(SafeLLamaContextHandle, Int32)
  1364. </a>
  1365. <nav class="md-nav" aria-label="llama_set_rng_seed(SafeLLamaContextHandle, Int32)">
  1366. <ul class="md-nav__list">
  1367. <li class="md-nav__item">
  1368. <a href="#parameters_39" class="md-nav__link">
  1369. Parameters
  1370. </a>
  1371. </li>
  1372. </ul>
  1373. </nav>
  1374. </li>
  1375. <li class="md-nav__item">
  1376. <a href="#llama_get_state_sizesafellamacontexthandle" class="md-nav__link">
  1377. llama_get_state_size(SafeLLamaContextHandle)
  1378. </a>
  1379. <nav class="md-nav" aria-label="llama_get_state_size(SafeLLamaContextHandle)">
  1380. <ul class="md-nav__list">
  1381. <li class="md-nav__item">
  1382. <a href="#parameters_40" class="md-nav__link">
  1383. Parameters
  1384. </a>
  1385. </li>
  1386. <li class="md-nav__item">
  1387. <a href="#returns_26" class="md-nav__link">
  1388. Returns
  1389. </a>
  1390. </li>
  1391. </ul>
  1392. </nav>
  1393. </li>
  1394. <li class="md-nav__item">
  1395. <a href="#llama_copy_state_datasafellamacontexthandle-byte" class="md-nav__link">
  1396. llama_copy_state_data(SafeLLamaContextHandle, Byte*)
  1397. </a>
  1398. <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte*)">
  1399. <ul class="md-nav__list">
  1400. <li class="md-nav__item">
  1401. <a href="#parameters_41" class="md-nav__link">
  1402. Parameters
  1403. </a>
  1404. </li>
  1405. <li class="md-nav__item">
  1406. <a href="#returns_27" class="md-nav__link">
  1407. Returns
  1408. </a>
  1409. </li>
  1410. </ul>
  1411. </nav>
  1412. </li>
  1413. <li class="md-nav__item">
  1414. <a href="#llama_copy_state_datasafellamacontexthandle-byte_1" class="md-nav__link">
  1415. llama_copy_state_data(SafeLLamaContextHandle, Byte[])
  1416. </a>
  1417. <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte[])">
  1418. <ul class="md-nav__list">
  1419. <li class="md-nav__item">
  1420. <a href="#parameters_42" class="md-nav__link">
  1421. Parameters
  1422. </a>
  1423. </li>
  1424. <li class="md-nav__item">
  1425. <a href="#returns_28" class="md-nav__link">
  1426. Returns
  1427. </a>
  1428. </li>
  1429. </ul>
  1430. </nav>
  1431. </li>
  1432. <li class="md-nav__item">
  1433. <a href="#llama_set_state_datasafellamacontexthandle-byte" class="md-nav__link">
  1434. llama_set_state_data(SafeLLamaContextHandle, Byte*)
  1435. </a>
  1436. <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte*)">
  1437. <ul class="md-nav__list">
  1438. <li class="md-nav__item">
  1439. <a href="#parameters_43" class="md-nav__link">
  1440. Parameters
  1441. </a>
  1442. </li>
  1443. <li class="md-nav__item">
  1444. <a href="#returns_29" class="md-nav__link">
  1445. Returns
  1446. </a>
  1447. </li>
  1448. </ul>
  1449. </nav>
  1450. </li>
  1451. <li class="md-nav__item">
  1452. <a href="#llama_set_state_datasafellamacontexthandle-byte_1" class="md-nav__link">
  1453. llama_set_state_data(SafeLLamaContextHandle, Byte[])
  1454. </a>
  1455. <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte[])">
  1456. <ul class="md-nav__list">
  1457. <li class="md-nav__item">
  1458. <a href="#parameters_44" class="md-nav__link">
  1459. Parameters
  1460. </a>
  1461. </li>
  1462. <li class="md-nav__item">
  1463. <a href="#returns_30" class="md-nav__link">
  1464. Returns
  1465. </a>
  1466. </li>
  1467. </ul>
  1468. </nav>
  1469. </li>
  1470. <li class="md-nav__item">
  1471. <a href="#llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64" class="md-nav__link">
  1472. llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)
  1473. </a>
  1474. <nav class="md-nav" aria-label="llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)">
  1475. <ul class="md-nav__list">
  1476. <li class="md-nav__item">
  1477. <a href="#parameters_45" class="md-nav__link">
  1478. Parameters
  1479. </a>
  1480. </li>
  1481. <li class="md-nav__item">
  1482. <a href="#returns_31" class="md-nav__link">
  1483. Returns
  1484. </a>
  1485. </li>
  1486. </ul>
  1487. </nav>
  1488. </li>
  1489. <li class="md-nav__item">
  1490. <a href="#llama_save_session_filesafellamacontexthandle-string-int32-uint64" class="md-nav__link">
  1491. llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)
  1492. </a>
  1493. <nav class="md-nav" aria-label="llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)">
  1494. <ul class="md-nav__list">
  1495. <li class="md-nav__item">
  1496. <a href="#parameters_46" class="md-nav__link">
  1497. Parameters
  1498. </a>
  1499. </li>
  1500. <li class="md-nav__item">
  1501. <a href="#returns_32" class="md-nav__link">
  1502. Returns
  1503. </a>
  1504. </li>
  1505. </ul>
  1506. </nav>
  1507. </li>
  1508. <li class="md-nav__item">
  1509. <a href="#llama_evalsafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
  1510. llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)
  1511. </a>
  1512. <nav class="md-nav" aria-label="llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)">
  1513. <ul class="md-nav__list">
  1514. <li class="md-nav__item">
  1515. <a href="#parameters_47" class="md-nav__link">
  1516. Parameters
  1517. </a>
  1518. </li>
  1519. <li class="md-nav__item">
  1520. <a href="#returns_33" class="md-nav__link">
  1521. Returns
  1522. </a>
  1523. </li>
  1524. </ul>
  1525. </nav>
  1526. </li>
  1527. <li class="md-nav__item">
  1528. <a href="#llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
  1529. llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)
  1530. </a>
  1531. <nav class="md-nav" aria-label="llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)">
  1532. <ul class="md-nav__list">
  1533. <li class="md-nav__item">
  1534. <a href="#parameters_48" class="md-nav__link">
  1535. Parameters
  1536. </a>
  1537. </li>
  1538. <li class="md-nav__item">
  1539. <a href="#returns_34" class="md-nav__link">
  1540. Returns
  1541. </a>
  1542. </li>
  1543. </ul>
  1544. </nav>
  1545. </li>
  1546. <li class="md-nav__item">
  1547. <a href="#llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean" class="md-nav__link">
  1548. llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)
  1549. </a>
  1550. <nav class="md-nav" aria-label="llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)">
  1551. <ul class="md-nav__list">
  1552. <li class="md-nav__item">
  1553. <a href="#parameters_49" class="md-nav__link">
  1554. Parameters
  1555. </a>
  1556. </li>
  1557. <li class="md-nav__item">
  1558. <a href="#returns_35" class="md-nav__link">
  1559. Returns
  1560. </a>
  1561. </li>
  1562. </ul>
  1563. </nav>
  1564. </li>
  1565. <li class="md-nav__item">
  1566. <a href="#llama_tokenize_nativesafellamacontexthandle-byte-int32-int32-boolean" class="md-nav__link">
  1567. llama_tokenize_native(SafeLLamaContextHandle, Byte, Int32, Int32, Boolean)
  1568. </a>
  1569. <nav class="md-nav" aria-label="llama_tokenize_native(SafeLLamaContextHandle, Byte, Int32, Int32, Boolean)">
  1570. <ul class="md-nav__list">
  1571. <li class="md-nav__item">
  1572. <a href="#parameters_50" class="md-nav__link">
  1573. Parameters
  1574. </a>
  1575. </li>
  1576. <li class="md-nav__item">
  1577. <a href="#returns_36" class="md-nav__link">
  1578. Returns
  1579. </a>
  1580. </li>
  1581. </ul>
  1582. </nav>
  1583. </li>
  1584. <li class="md-nav__item">
  1585. <a href="#llama_n_vocabsafellamacontexthandle" class="md-nav__link">
  1586. llama_n_vocab(SafeLLamaContextHandle)
  1587. </a>
  1588. <nav class="md-nav" aria-label="llama_n_vocab(SafeLLamaContextHandle)">
  1589. <ul class="md-nav__list">
  1590. <li class="md-nav__item">
  1591. <a href="#parameters_51" class="md-nav__link">
  1592. Parameters
  1593. </a>
  1594. </li>
  1595. <li class="md-nav__item">
  1596. <a href="#returns_37" class="md-nav__link">
  1597. Returns
  1598. </a>
  1599. </li>
  1600. </ul>
  1601. </nav>
  1602. </li>
  1603. <li class="md-nav__item">
  1604. <a href="#llama_n_ctxsafellamacontexthandle" class="md-nav__link">
  1605. llama_n_ctx(SafeLLamaContextHandle)
  1606. </a>
  1607. <nav class="md-nav" aria-label="llama_n_ctx(SafeLLamaContextHandle)">
  1608. <ul class="md-nav__list">
  1609. <li class="md-nav__item">
  1610. <a href="#parameters_52" class="md-nav__link">
  1611. Parameters
  1612. </a>
  1613. </li>
  1614. <li class="md-nav__item">
  1615. <a href="#returns_38" class="md-nav__link">
  1616. Returns
  1617. </a>
  1618. </li>
  1619. </ul>
  1620. </nav>
  1621. </li>
  1622. <li class="md-nav__item">
  1623. <a href="#llama_n_embdsafellamacontexthandle" class="md-nav__link">
  1624. llama_n_embd(SafeLLamaContextHandle)
  1625. </a>
  1626. <nav class="md-nav" aria-label="llama_n_embd(SafeLLamaContextHandle)">
  1627. <ul class="md-nav__list">
  1628. <li class="md-nav__item">
  1629. <a href="#parameters_53" class="md-nav__link">
  1630. Parameters
  1631. </a>
  1632. </li>
  1633. <li class="md-nav__item">
  1634. <a href="#returns_39" class="md-nav__link">
  1635. Returns
  1636. </a>
  1637. </li>
  1638. </ul>
  1639. </nav>
  1640. </li>
  1641. <li class="md-nav__item">
  1642. <a href="#llama_get_logitssafellamacontexthandle" class="md-nav__link">
  1643. llama_get_logits(SafeLLamaContextHandle)
  1644. </a>
  1645. <nav class="md-nav" aria-label="llama_get_logits(SafeLLamaContextHandle)">
  1646. <ul class="md-nav__list">
  1647. <li class="md-nav__item">
  1648. <a href="#parameters_54" class="md-nav__link">
  1649. Parameters
  1650. </a>
  1651. </li>
  1652. <li class="md-nav__item">
  1653. <a href="#returns_40" class="md-nav__link">
  1654. Returns
  1655. </a>
  1656. </li>
  1657. </ul>
  1658. </nav>
  1659. </li>
  1660. <li class="md-nav__item">
  1661. <a href="#llama_get_embeddingssafellamacontexthandle" class="md-nav__link">
  1662. llama_get_embeddings(SafeLLamaContextHandle)
  1663. </a>
  1664. <nav class="md-nav" aria-label="llama_get_embeddings(SafeLLamaContextHandle)">
  1665. <ul class="md-nav__list">
  1666. <li class="md-nav__item">
  1667. <a href="#parameters_55" class="md-nav__link">
  1668. Parameters
  1669. </a>
  1670. </li>
  1671. <li class="md-nav__item">
  1672. <a href="#returns_41" class="md-nav__link">
  1673. Returns
  1674. </a>
  1675. </li>
  1676. </ul>
  1677. </nav>
  1678. </li>
  1679. </ul>
  1680. </nav>
  1681. </li>
  1682. </ul>
  1683. </nav>
  1684. </li>
  1685. <li class="md-nav__item">
  1686. <a href="../llama.native.safellamacontexthandle/" class="md-nav__link">
  1687. llama.native.safellamacontexthandle
  1688. </a>
  1689. </li>
  1690. <li class="md-nav__item">
  1691. <a href="../llama.native.safellamagrammarhandle/" class="md-nav__link">
  1692. llama.native.safellamagrammarhandle
  1693. </a>
  1694. </li>
  1695. <li class="md-nav__item">
  1696. <a href="../llama.native.safellamahandlebase/" class="md-nav__link">
  1697. llama.native.safellamahandlebase
  1698. </a>
  1699. </li>
  1700. <li class="md-nav__item">
  1701. <a href="../llama.native.safellamamodelhandle/" class="md-nav__link">
  1702. llama.native.safellamamodelhandle
  1703. </a>
  1704. </li>
  1705. <li class="md-nav__item">
  1706. <a href="../llama.native.samplingapi/" class="md-nav__link">
  1707. llama.native.samplingapi
  1708. </a>
  1709. </li>
  1710. <li class="md-nav__item">
  1711. <a href="../llama.oldversion.chatcompletion/" class="md-nav__link">
  1712. llama.oldversion.chatcompletion
  1713. </a>
  1714. </li>
  1715. <li class="md-nav__item">
  1716. <a href="../llama.oldversion.chatcompletionchoice/" class="md-nav__link">
  1717. llama.oldversion.chatcompletionchoice
  1718. </a>
  1719. </li>
  1720. <li class="md-nav__item">
  1721. <a href="../llama.oldversion.chatcompletionchunk/" class="md-nav__link">
  1722. llama.oldversion.chatcompletionchunk
  1723. </a>
  1724. </li>
  1725. <li class="md-nav__item">
  1726. <a href="../llama.oldversion.chatcompletionchunkchoice/" class="md-nav__link">
  1727. llama.oldversion.chatcompletionchunkchoice
  1728. </a>
  1729. </li>
  1730. <li class="md-nav__item">
  1731. <a href="../llama.oldversion.chatcompletionchunkdelta/" class="md-nav__link">
  1732. llama.oldversion.chatcompletionchunkdelta
  1733. </a>
  1734. </li>
  1735. <li class="md-nav__item">
  1736. <a href="../llama.oldversion.chatcompletionmessage/" class="md-nav__link">
  1737. llama.oldversion.chatcompletionmessage
  1738. </a>
  1739. </li>
  1740. <li class="md-nav__item">
  1741. <a href="../llama.oldversion.chatmessagerecord/" class="md-nav__link">
  1742. llama.oldversion.chatmessagerecord
  1743. </a>
  1744. </li>
  1745. <li class="md-nav__item">
  1746. <a href="../llama.oldversion.chatrole/" class="md-nav__link">
  1747. llama.oldversion.chatrole
  1748. </a>
  1749. </li>
  1750. <li class="md-nav__item">
  1751. <a href="../llama.oldversion.chatsession-1/" class="md-nav__link">
  1752. llama.oldversion.chatsession-1
  1753. </a>
  1754. </li>
  1755. <li class="md-nav__item">
  1756. <a href="../llama.oldversion.completion/" class="md-nav__link">
  1757. llama.oldversion.completion
  1758. </a>
  1759. </li>
  1760. <li class="md-nav__item">
  1761. <a href="../llama.oldversion.completionchoice/" class="md-nav__link">
  1762. llama.oldversion.completionchoice
  1763. </a>
  1764. </li>
  1765. <li class="md-nav__item">
  1766. <a href="../llama.oldversion.completionchunk/" class="md-nav__link">
  1767. llama.oldversion.completionchunk
  1768. </a>
  1769. </li>
  1770. <li class="md-nav__item">
  1771. <a href="../llama.oldversion.completionlogprobs/" class="md-nav__link">
  1772. llama.oldversion.completionlogprobs
  1773. </a>
  1774. </li>
  1775. <li class="md-nav__item">
  1776. <a href="../llama.oldversion.completionusage/" class="md-nav__link">
  1777. llama.oldversion.completionusage
  1778. </a>
  1779. </li>
  1780. <li class="md-nav__item">
  1781. <a href="../llama.oldversion.embedding/" class="md-nav__link">
  1782. llama.oldversion.embedding
  1783. </a>
  1784. </li>
  1785. <li class="md-nav__item">
  1786. <a href="../llama.oldversion.embeddingdata/" class="md-nav__link">
  1787. llama.oldversion.embeddingdata
  1788. </a>
  1789. </li>
  1790. <li class="md-nav__item">
  1791. <a href="../llama.oldversion.embeddingusage/" class="md-nav__link">
  1792. llama.oldversion.embeddingusage
  1793. </a>
  1794. </li>
  1795. <li class="md-nav__item">
  1796. <a href="../llama.oldversion.ichatmodel/" class="md-nav__link">
  1797. llama.oldversion.ichatmodel
  1798. </a>
  1799. </li>
  1800. <li class="md-nav__item">
  1801. <a href="../llama.oldversion.llamaembedder/" class="md-nav__link">
  1802. llama.oldversion.llamaembedder
  1803. </a>
  1804. </li>
  1805. <li class="md-nav__item">
  1806. <a href="../llama.oldversion.llamamodel/" class="md-nav__link">
  1807. llama.oldversion.llamamodel
  1808. </a>
  1809. </li>
  1810. <li class="md-nav__item">
  1811. <a href="../llama.oldversion.llamaparams/" class="md-nav__link">
  1812. llama.oldversion.llamaparams
  1813. </a>
  1814. </li>
  1815. <li class="md-nav__item">
  1816. <a href="../llama.statefulexecutorbase/" class="md-nav__link">
  1817. llama.statefulexecutorbase
  1818. </a>
  1819. </li>
  1820. <li class="md-nav__item">
  1821. <a href="../llama.statelessexecutor/" class="md-nav__link">
  1822. llama.statelessexecutor
  1823. </a>
  1824. </li>
  1825. <li class="md-nav__item">
  1826. <a href="../llama.utils/" class="md-nav__link">
  1827. llama.utils
  1828. </a>
  1829. </li>
  1830. </ul>
  1831. </nav>
  1832. </li>
  1833. </ul>
  1834. </nav>
  1835. </div>
  1836. </div>
  1837. </div>
  1838. <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
  1839. <div class="md-sidebar__scrollwrap">
  1840. <div class="md-sidebar__inner">
  1841. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  1842. <label class="md-nav__title" for="__toc">
  1843. <span class="md-nav__icon md-icon"></span>
  1844. Table of contents
  1845. </label>
  1846. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  1847. <li class="md-nav__item">
  1848. <a href="#constructors" class="md-nav__link">
  1849. Constructors
  1850. </a>
  1851. <nav class="md-nav" aria-label="Constructors">
  1852. <ul class="md-nav__list">
  1853. <li class="md-nav__item">
  1854. <a href="#nativeapi_1" class="md-nav__link">
  1855. NativeApi()
  1856. </a>
  1857. </li>
  1858. </ul>
  1859. </nav>
  1860. </li>
  1861. <li class="md-nav__item">
  1862. <a href="#methods" class="md-nav__link">
  1863. Methods
  1864. </a>
  1865. <nav class="md-nav" aria-label="Methods">
  1866. <ul class="md-nav__list">
  1867. <li class="md-nav__item">
  1868. <a href="#llama_sample_token_mirostatsafellamacontexthandle-llamatokendataarraynative-single-single-int32-single" class="md-nav__link">
  1869. llama_sample_token_mirostat(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Int32, Single&amp;)
  1870. </a>
  1871. <nav class="md-nav" aria-label="llama_sample_token_mirostat(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, Single, Int32, Single&)">
  1872. <ul class="md-nav__list">
  1873. <li class="md-nav__item">
  1874. <a href="#parameters" class="md-nav__link">
  1875. Parameters
  1876. </a>
  1877. </li>
  1878. <li class="md-nav__item">
  1879. <a href="#returns" class="md-nav__link">
  1880. Returns
  1881. </a>
  1882. </li>
  1883. </ul>
  1884. </nav>
  1885. </li>
  1886. <li class="md-nav__item">
  1887. <a href="#llama_sample_token_mirostat_v2safellamacontexthandle-llamatokendataarraynative-single-single-single" class="md-nav__link">
  1888. llama_sample_token_mirostat_v2(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Single&amp;)
  1889. </a>
  1890. <nav class="md-nav" aria-label="llama_sample_token_mirostat_v2(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, Single, Single&)">
  1891. <ul class="md-nav__list">
  1892. <li class="md-nav__item">
  1893. <a href="#parameters_1" class="md-nav__link">
  1894. Parameters
  1895. </a>
  1896. </li>
  1897. <li class="md-nav__item">
  1898. <a href="#returns_1" class="md-nav__link">
  1899. Returns
  1900. </a>
  1901. </li>
  1902. </ul>
  1903. </nav>
  1904. </li>
  1905. <li class="md-nav__item">
  1906. <a href="#llama_sample_token_greedysafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  1907. llama_sample_token_greedy(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  1908. </a>
  1909. <nav class="md-nav" aria-label="llama_sample_token_greedy(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  1910. <ul class="md-nav__list">
  1911. <li class="md-nav__item">
  1912. <a href="#parameters_2" class="md-nav__link">
  1913. Parameters
  1914. </a>
  1915. </li>
  1916. <li class="md-nav__item">
  1917. <a href="#returns_2" class="md-nav__link">
  1918. Returns
  1919. </a>
  1920. </li>
  1921. </ul>
  1922. </nav>
  1923. </li>
  1924. <li class="md-nav__item">
  1925. <a href="#llama_sample_tokensafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  1926. llama_sample_token(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  1927. </a>
  1928. <nav class="md-nav" aria-label="llama_sample_token(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  1929. <ul class="md-nav__list">
  1930. <li class="md-nav__item">
  1931. <a href="#parameters_3" class="md-nav__link">
  1932. Parameters
  1933. </a>
  1934. </li>
  1935. <li class="md-nav__item">
  1936. <a href="#returns_3" class="md-nav__link">
  1937. Returns
  1938. </a>
  1939. </li>
  1940. </ul>
  1941. </nav>
  1942. </li>
  1943. <li class="md-nav__item">
  1944. <a href="#llama_token_to_strsafellamacontexthandle-int32" class="md-nav__link">
  1945. llama_token_to_str(SafeLLamaContextHandle, Int32)
  1946. </a>
  1947. <nav class="md-nav" aria-label="llama_token_to_str(SafeLLamaContextHandle, Int32)">
  1948. <ul class="md-nav__list">
  1949. <li class="md-nav__item">
  1950. <a href="#parameters_4" class="md-nav__link">
  1951. Parameters
  1952. </a>
  1953. </li>
  1954. <li class="md-nav__item">
  1955. <a href="#returns_4" class="md-nav__link">
  1956. Returns
  1957. </a>
  1958. </li>
  1959. </ul>
  1960. </nav>
  1961. </li>
  1962. <li class="md-nav__item">
  1963. <a href="#llama_token_bossafellamacontexthandle" class="md-nav__link">
  1964. llama_token_bos(SafeLLamaContextHandle)
  1965. </a>
  1966. <nav class="md-nav" aria-label="llama_token_bos(SafeLLamaContextHandle)">
  1967. <ul class="md-nav__list">
  1968. <li class="md-nav__item">
  1969. <a href="#parameters_5" class="md-nav__link">
  1970. Parameters
  1971. </a>
  1972. </li>
  1973. <li class="md-nav__item">
  1974. <a href="#returns_5" class="md-nav__link">
  1975. Returns
  1976. </a>
  1977. </li>
  1978. </ul>
  1979. </nav>
  1980. </li>
  1981. <li class="md-nav__item">
  1982. <a href="#llama_token_eossafellamacontexthandle" class="md-nav__link">
  1983. llama_token_eos(SafeLLamaContextHandle)
  1984. </a>
  1985. <nav class="md-nav" aria-label="llama_token_eos(SafeLLamaContextHandle)">
  1986. <ul class="md-nav__list">
  1987. <li class="md-nav__item">
  1988. <a href="#parameters_6" class="md-nav__link">
  1989. Parameters
  1990. </a>
  1991. </li>
  1992. <li class="md-nav__item">
  1993. <a href="#returns_6" class="md-nav__link">
  1994. Returns
  1995. </a>
  1996. </li>
  1997. </ul>
  1998. </nav>
  1999. </li>
  2000. <li class="md-nav__item">
  2001. <a href="#llama_token_nlsafellamacontexthandle" class="md-nav__link">
  2002. llama_token_nl(SafeLLamaContextHandle)
  2003. </a>
  2004. <nav class="md-nav" aria-label="llama_token_nl(SafeLLamaContextHandle)">
  2005. <ul class="md-nav__list">
  2006. <li class="md-nav__item">
  2007. <a href="#parameters_7" class="md-nav__link">
  2008. Parameters
  2009. </a>
  2010. </li>
  2011. <li class="md-nav__item">
  2012. <a href="#returns_7" class="md-nav__link">
  2013. Returns
  2014. </a>
  2015. </li>
  2016. </ul>
  2017. </nav>
  2018. </li>
  2019. <li class="md-nav__item">
  2020. <a href="#llama_print_timingssafellamacontexthandle" class="md-nav__link">
  2021. llama_print_timings(SafeLLamaContextHandle)
  2022. </a>
  2023. <nav class="md-nav" aria-label="llama_print_timings(SafeLLamaContextHandle)">
  2024. <ul class="md-nav__list">
  2025. <li class="md-nav__item">
  2026. <a href="#parameters_8" class="md-nav__link">
  2027. Parameters
  2028. </a>
  2029. </li>
  2030. </ul>
  2031. </nav>
  2032. </li>
  2033. <li class="md-nav__item">
  2034. <a href="#llama_reset_timingssafellamacontexthandle" class="md-nav__link">
  2035. llama_reset_timings(SafeLLamaContextHandle)
  2036. </a>
  2037. <nav class="md-nav" aria-label="llama_reset_timings(SafeLLamaContextHandle)">
  2038. <ul class="md-nav__list">
  2039. <li class="md-nav__item">
  2040. <a href="#parameters_9" class="md-nav__link">
  2041. Parameters
  2042. </a>
  2043. </li>
  2044. </ul>
  2045. </nav>
  2046. </li>
  2047. <li class="md-nav__item">
  2048. <a href="#llama_print_system_info" class="md-nav__link">
  2049. llama_print_system_info()
  2050. </a>
  2051. <nav class="md-nav" aria-label="llama_print_system_info()">
  2052. <ul class="md-nav__list">
  2053. <li class="md-nav__item">
  2054. <a href="#returns_8" class="md-nav__link">
  2055. Returns
  2056. </a>
  2057. </li>
  2058. </ul>
  2059. </nav>
  2060. </li>
  2061. <li class="md-nav__item">
  2062. <a href="#llama_model_n_vocabsafellamamodelhandle" class="md-nav__link">
  2063. llama_model_n_vocab(SafeLlamaModelHandle)
  2064. </a>
  2065. <nav class="md-nav" aria-label="llama_model_n_vocab(SafeLlamaModelHandle)">
  2066. <ul class="md-nav__list">
  2067. <li class="md-nav__item">
  2068. <a href="#parameters_10" class="md-nav__link">
  2069. Parameters
  2070. </a>
  2071. </li>
  2072. <li class="md-nav__item">
  2073. <a href="#returns_9" class="md-nav__link">
  2074. Returns
  2075. </a>
  2076. </li>
  2077. </ul>
  2078. </nav>
  2079. </li>
  2080. <li class="md-nav__item">
  2081. <a href="#llama_model_n_ctxsafellamamodelhandle" class="md-nav__link">
  2082. llama_model_n_ctx(SafeLlamaModelHandle)
  2083. </a>
  2084. <nav class="md-nav" aria-label="llama_model_n_ctx(SafeLlamaModelHandle)">
  2085. <ul class="md-nav__list">
  2086. <li class="md-nav__item">
  2087. <a href="#parameters_11" class="md-nav__link">
  2088. Parameters
  2089. </a>
  2090. </li>
  2091. <li class="md-nav__item">
  2092. <a href="#returns_10" class="md-nav__link">
  2093. Returns
  2094. </a>
  2095. </li>
  2096. </ul>
  2097. </nav>
  2098. </li>
  2099. <li class="md-nav__item">
  2100. <a href="#llama_model_n_embdsafellamamodelhandle" class="md-nav__link">
  2101. llama_model_n_embd(SafeLlamaModelHandle)
  2102. </a>
  2103. <nav class="md-nav" aria-label="llama_model_n_embd(SafeLlamaModelHandle)">
  2104. <ul class="md-nav__list">
  2105. <li class="md-nav__item">
  2106. <a href="#parameters_12" class="md-nav__link">
  2107. Parameters
  2108. </a>
  2109. </li>
  2110. <li class="md-nav__item">
  2111. <a href="#returns_11" class="md-nav__link">
  2112. Returns
  2113. </a>
  2114. </li>
  2115. </ul>
  2116. </nav>
  2117. </li>
  2118. <li class="md-nav__item">
  2119. <a href="#llama_token_to_piece_with_modelsafellamamodelhandle-int32-byte-int32" class="md-nav__link">
  2120. llama_token_to_piece_with_model(SafeLlamaModelHandle, Int32, Byte*, Int32)
  2121. </a>
  2122. <nav class="md-nav" aria-label="llama_token_to_piece_with_model(SafeLlamaModelHandle, Int32, Byte*, Int32)">
  2123. <ul class="md-nav__list">
  2124. <li class="md-nav__item">
  2125. <a href="#parameters_13" class="md-nav__link">
  2126. Parameters
  2127. </a>
  2128. </li>
  2129. <li class="md-nav__item">
  2130. <a href="#returns_12" class="md-nav__link">
  2131. Returns
  2132. </a>
  2133. </li>
  2134. </ul>
  2135. </nav>
  2136. </li>
  2137. <li class="md-nav__item">
  2138. <a href="#llama_tokenize_with_modelsafellamamodelhandle-byte-int32-int32-boolean" class="md-nav__link">
  2139. llama_tokenize_with_model(SafeLlamaModelHandle, Byte, Int32, Int32, Boolean)
  2140. </a>
  2141. <nav class="md-nav" aria-label="llama_tokenize_with_model(SafeLlamaModelHandle, Byte, Int32, Int32, Boolean)">
  2142. <ul class="md-nav__list">
  2143. <li class="md-nav__item">
  2144. <a href="#parameters_14" class="md-nav__link">
  2145. Parameters
  2146. </a>
  2147. </li>
  2148. <li class="md-nav__item">
  2149. <a href="#returns_13" class="md-nav__link">
  2150. Returns
  2151. </a>
  2152. </li>
  2153. </ul>
  2154. </nav>
  2155. </li>
  2156. <li class="md-nav__item">
  2157. <a href="#llama_log_setllamalogcallback" class="md-nav__link">
  2158. llama_log_set(LLamaLogCallback)
  2159. </a>
  2160. <nav class="md-nav" aria-label="llama_log_set(LLamaLogCallback)">
  2161. <ul class="md-nav__list">
  2162. <li class="md-nav__item">
  2163. <a href="#parameters_15" class="md-nav__link">
  2164. Parameters
  2165. </a>
  2166. </li>
  2167. </ul>
  2168. </nav>
  2169. </li>
  2170. <li class="md-nav__item">
  2171. <a href="#llama_grammar_initllamagrammarelement-uint64-uint64" class="md-nav__link">
  2172. llama_grammar_init(LLamaGrammarElement, UInt64, UInt64)**
  2173. </a>
  2174. <nav class="md-nav" aria-label="llama_grammar_init(LLamaGrammarElement, UInt64, UInt64)**">
  2175. <ul class="md-nav__list">
  2176. <li class="md-nav__item">
  2177. <a href="#parameters_16" class="md-nav__link">
  2178. Parameters
  2179. </a>
  2180. </li>
  2181. <li class="md-nav__item">
  2182. <a href="#returns_14" class="md-nav__link">
  2183. Returns
  2184. </a>
  2185. </li>
  2186. </ul>
  2187. </nav>
  2188. </li>
  2189. <li class="md-nav__item">
  2190. <a href="#llama_grammar_freeintptr" class="md-nav__link">
  2191. llama_grammar_free(IntPtr)
  2192. </a>
  2193. <nav class="md-nav" aria-label="llama_grammar_free(IntPtr)">
  2194. <ul class="md-nav__list">
  2195. <li class="md-nav__item">
  2196. <a href="#parameters_17" class="md-nav__link">
  2197. Parameters
  2198. </a>
  2199. </li>
  2200. </ul>
  2201. </nav>
  2202. </li>
  2203. <li class="md-nav__item">
  2204. <a href="#llama_sample_grammarsafellamacontexthandle-llamatokendataarraynative-safellamagrammarhandle" class="md-nav__link">
  2205. llama_sample_grammar(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaGrammarHandle)
  2206. </a>
  2207. <nav class="md-nav" aria-label="llama_sample_grammar(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, SafeLLamaGrammarHandle)">
  2208. <ul class="md-nav__list">
  2209. <li class="md-nav__item">
  2210. <a href="#parameters_18" class="md-nav__link">
  2211. Parameters
  2212. </a>
  2213. </li>
  2214. </ul>
  2215. </nav>
  2216. </li>
  2217. <li class="md-nav__item">
  2218. <a href="#llama_grammar_accept_tokensafellamacontexthandle-safellamagrammarhandle-int32" class="md-nav__link">
  2219. llama_grammar_accept_token(SafeLLamaContextHandle, SafeLLamaGrammarHandle, Int32)
  2220. </a>
  2221. <nav class="md-nav" aria-label="llama_grammar_accept_token(SafeLLamaContextHandle, SafeLLamaGrammarHandle, Int32)">
  2222. <ul class="md-nav__list">
  2223. <li class="md-nav__item">
  2224. <a href="#parameters_19" class="md-nav__link">
  2225. Parameters
  2226. </a>
  2227. </li>
  2228. </ul>
  2229. </nav>
  2230. </li>
  2231. <li class="md-nav__item">
  2232. <a href="#llama_model_quantizestring-string-llamamodelquantizeparams" class="md-nav__link">
  2233. llama_model_quantize(String, String, LLamaModelQuantizeParams*)
  2234. </a>
  2235. <nav class="md-nav" aria-label="llama_model_quantize(String, String, LLamaModelQuantizeParams*)">
  2236. <ul class="md-nav__list">
  2237. <li class="md-nav__item">
  2238. <a href="#parameters_20" class="md-nav__link">
  2239. Parameters
  2240. </a>
  2241. </li>
  2242. <li class="md-nav__item">
  2243. <a href="#returns_15" class="md-nav__link">
  2244. Returns
  2245. </a>
  2246. </li>
  2247. </ul>
  2248. </nav>
  2249. </li>
  2250. <li class="md-nav__item">
  2251. <a href="#llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single" class="md-nav__link">
  2252. llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative, SafeLLamaContextHandle, Single)
  2253. </a>
  2254. <nav class="md-nav" aria-label="llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative, SafeLLamaContextHandle, Single)">
  2255. <ul class="md-nav__list">
  2256. <li class="md-nav__item">
  2257. <a href="#parameters_21" class="md-nav__link">
  2258. Parameters
  2259. </a>
  2260. </li>
  2261. </ul>
  2262. </nav>
  2263. </li>
  2264. <li class="md-nav__item">
  2265. <a href="#llama_sample_repetition_penaltysafellamacontexthandle-llamatokendataarraynative-int32-uint64-single" class="md-nav__link">
  2266. llama_sample_repetition_penalty(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single)
  2267. </a>
  2268. <nav class="md-nav" aria-label="llama_sample_repetition_penalty(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32*, UInt64, Single)">
  2269. <ul class="md-nav__list">
  2270. <li class="md-nav__item">
  2271. <a href="#parameters_22" class="md-nav__link">
  2272. Parameters
  2273. </a>
  2274. </li>
  2275. </ul>
  2276. </nav>
  2277. </li>
  2278. <li class="md-nav__item">
  2279. <a href="#llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-llamatokendataarraynative-int32-uint64-single-single" class="md-nav__link">
  2280. llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single, Single)
  2281. </a>
  2282. <nav class="md-nav" aria-label="llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32*, UInt64, Single, Single)">
  2283. <ul class="md-nav__list">
  2284. <li class="md-nav__item">
  2285. <a href="#parameters_23" class="md-nav__link">
  2286. Parameters
  2287. </a>
  2288. </li>
  2289. </ul>
  2290. </nav>
  2291. </li>
  2292. <li class="md-nav__item">
  2293. <a href="#llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single_1" class="md-nav__link">
  2294. llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaContextHandle, Single)
  2295. </a>
  2296. <nav class="md-nav" aria-label="llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, SafeLLamaContextHandle, Single)">
  2297. <ul class="md-nav__list">
  2298. <li class="md-nav__item">
  2299. <a href="#parameters_24" class="md-nav__link">
  2300. Parameters
  2301. </a>
  2302. </li>
  2303. </ul>
  2304. </nav>
  2305. </li>
  2306. <li class="md-nav__item">
  2307. <a href="#llama_sample_softmaxsafellamacontexthandle-llamatokendataarraynative" class="md-nav__link">
  2308. llama_sample_softmax(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)
  2309. </a>
  2310. <nav class="md-nav" aria-label="llama_sample_softmax(SafeLLamaContextHandle, LLamaTokenDataArrayNative&)">
  2311. <ul class="md-nav__list">
  2312. <li class="md-nav__item">
  2313. <a href="#parameters_25" class="md-nav__link">
  2314. Parameters
  2315. </a>
  2316. </li>
  2317. </ul>
  2318. </nav>
  2319. </li>
  2320. <li class="md-nav__item">
  2321. <a href="#llama_sample_top_ksafellamacontexthandle-llamatokendataarraynative-int32-uint64" class="md-nav__link">
  2322. llama_sample_top_k(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32, UInt64)
  2323. </a>
  2324. <nav class="md-nav" aria-label="llama_sample_top_k(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Int32, UInt64)">
  2325. <ul class="md-nav__list">
  2326. <li class="md-nav__item">
  2327. <a href="#parameters_26" class="md-nav__link">
  2328. Parameters
  2329. </a>
  2330. </li>
  2331. </ul>
  2332. </nav>
  2333. </li>
  2334. <li class="md-nav__item">
  2335. <a href="#llama_sample_top_psafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  2336. llama_sample_top_p(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  2337. </a>
  2338. <nav class="md-nav" aria-label="llama_sample_top_p(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  2339. <ul class="md-nav__list">
  2340. <li class="md-nav__item">
  2341. <a href="#parameters_27" class="md-nav__link">
  2342. Parameters
  2343. </a>
  2344. </li>
  2345. </ul>
  2346. </nav>
  2347. </li>
  2348. <li class="md-nav__item">
  2349. <a href="#llama_sample_tail_freesafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  2350. llama_sample_tail_free(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  2351. </a>
  2352. <nav class="md-nav" aria-label="llama_sample_tail_free(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  2353. <ul class="md-nav__list">
  2354. <li class="md-nav__item">
  2355. <a href="#parameters_28" class="md-nav__link">
  2356. Parameters
  2357. </a>
  2358. </li>
  2359. </ul>
  2360. </nav>
  2361. </li>
  2362. <li class="md-nav__item">
  2363. <a href="#llama_sample_typicalsafellamacontexthandle-llamatokendataarraynative-single-uint64" class="md-nav__link">
  2364. llama_sample_typical(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)
  2365. </a>
  2366. <nav class="md-nav" aria-label="llama_sample_typical(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single, UInt64)">
  2367. <ul class="md-nav__list">
  2368. <li class="md-nav__item">
  2369. <a href="#parameters_29" class="md-nav__link">
  2370. Parameters
  2371. </a>
  2372. </li>
  2373. </ul>
  2374. </nav>
  2375. </li>
  2376. <li class="md-nav__item">
  2377. <a href="#llama_sample_temperaturesafellamacontexthandle-llamatokendataarraynative-single" class="md-nav__link">
  2378. llama_sample_temperature(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single)
  2379. </a>
  2380. <nav class="md-nav" aria-label="llama_sample_temperature(SafeLLamaContextHandle, LLamaTokenDataArrayNative&, Single)">
  2381. <ul class="md-nav__list">
  2382. <li class="md-nav__item">
  2383. <a href="#parameters_30" class="md-nav__link">
  2384. Parameters
  2385. </a>
  2386. </li>
  2387. </ul>
  2388. </nav>
  2389. </li>
  2390. <li class="md-nav__item">
  2391. <a href="#llama_empty_call" class="md-nav__link">
  2392. llama_empty_call()
  2393. </a>
  2394. <nav class="md-nav" aria-label="llama_empty_call()">
  2395. <ul class="md-nav__list">
  2396. <li class="md-nav__item">
  2397. <a href="#returns_16" class="md-nav__link">
  2398. Returns
  2399. </a>
  2400. </li>
  2401. </ul>
  2402. </nav>
  2403. </li>
  2404. <li class="md-nav__item">
  2405. <a href="#llama_context_default_params" class="md-nav__link">
  2406. llama_context_default_params()
  2407. </a>
  2408. <nav class="md-nav" aria-label="llama_context_default_params()">
  2409. <ul class="md-nav__list">
  2410. <li class="md-nav__item">
  2411. <a href="#returns_17" class="md-nav__link">
  2412. Returns
  2413. </a>
  2414. </li>
  2415. </ul>
  2416. </nav>
  2417. </li>
  2418. <li class="md-nav__item">
  2419. <a href="#llama_model_quantize_default_params" class="md-nav__link">
  2420. llama_model_quantize_default_params()
  2421. </a>
  2422. <nav class="md-nav" aria-label="llama_model_quantize_default_params()">
  2423. <ul class="md-nav__list">
  2424. <li class="md-nav__item">
  2425. <a href="#returns_18" class="md-nav__link">
  2426. Returns
  2427. </a>
  2428. </li>
  2429. </ul>
  2430. </nav>
  2431. </li>
  2432. <li class="md-nav__item">
  2433. <a href="#llama_mmap_supported" class="md-nav__link">
  2434. llama_mmap_supported()
  2435. </a>
  2436. <nav class="md-nav" aria-label="llama_mmap_supported()">
  2437. <ul class="md-nav__list">
  2438. <li class="md-nav__item">
  2439. <a href="#returns_19" class="md-nav__link">
  2440. Returns
  2441. </a>
  2442. </li>
  2443. </ul>
  2444. </nav>
  2445. </li>
  2446. <li class="md-nav__item">
  2447. <a href="#llama_mlock_supported" class="md-nav__link">
  2448. llama_mlock_supported()
  2449. </a>
  2450. <nav class="md-nav" aria-label="llama_mlock_supported()">
  2451. <ul class="md-nav__list">
  2452. <li class="md-nav__item">
  2453. <a href="#returns_20" class="md-nav__link">
  2454. Returns
  2455. </a>
  2456. </li>
  2457. </ul>
  2458. </nav>
  2459. </li>
  2460. <li class="md-nav__item">
  2461. <a href="#llama_eval_exportsafellamacontexthandle-string" class="md-nav__link">
  2462. llama_eval_export(SafeLLamaContextHandle, String)
  2463. </a>
  2464. <nav class="md-nav" aria-label="llama_eval_export(SafeLLamaContextHandle, String)">
  2465. <ul class="md-nav__list">
  2466. <li class="md-nav__item">
  2467. <a href="#parameters_31" class="md-nav__link">
  2468. Parameters
  2469. </a>
  2470. </li>
  2471. <li class="md-nav__item">
  2472. <a href="#returns_21" class="md-nav__link">
  2473. Returns
  2474. </a>
  2475. </li>
  2476. </ul>
  2477. </nav>
  2478. </li>
  2479. <li class="md-nav__item">
  2480. <a href="#llama_load_model_from_filestring-llamacontextparams" class="md-nav__link">
  2481. llama_load_model_from_file(String, LLamaContextParams)
  2482. </a>
  2483. <nav class="md-nav" aria-label="llama_load_model_from_file(String, LLamaContextParams)">
  2484. <ul class="md-nav__list">
  2485. <li class="md-nav__item">
  2486. <a href="#parameters_32" class="md-nav__link">
  2487. Parameters
  2488. </a>
  2489. </li>
  2490. <li class="md-nav__item">
  2491. <a href="#returns_22" class="md-nav__link">
  2492. Returns
  2493. </a>
  2494. </li>
  2495. </ul>
  2496. </nav>
  2497. </li>
  2498. <li class="md-nav__item">
  2499. <a href="#llama_new_context_with_modelsafellamamodelhandle-llamacontextparams" class="md-nav__link">
  2500. llama_new_context_with_model(SafeLlamaModelHandle, LLamaContextParams)
  2501. </a>
  2502. <nav class="md-nav" aria-label="llama_new_context_with_model(SafeLlamaModelHandle, LLamaContextParams)">
  2503. <ul class="md-nav__list">
  2504. <li class="md-nav__item">
  2505. <a href="#parameters_33" class="md-nav__link">
  2506. Parameters
  2507. </a>
  2508. </li>
  2509. <li class="md-nav__item">
  2510. <a href="#returns_23" class="md-nav__link">
  2511. Returns
  2512. </a>
  2513. </li>
  2514. </ul>
  2515. </nav>
  2516. </li>
  2517. <li class="md-nav__item">
  2518. <a href="#llama_backend_initboolean" class="md-nav__link">
  2519. llama_backend_init(Boolean)
  2520. </a>
  2521. <nav class="md-nav" aria-label="llama_backend_init(Boolean)">
  2522. <ul class="md-nav__list">
  2523. <li class="md-nav__item">
  2524. <a href="#parameters_34" class="md-nav__link">
  2525. Parameters
  2526. </a>
  2527. </li>
  2528. </ul>
  2529. </nav>
  2530. </li>
  2531. <li class="md-nav__item">
  2532. <a href="#llama_freeintptr" class="md-nav__link">
  2533. llama_free(IntPtr)
  2534. </a>
  2535. <nav class="md-nav" aria-label="llama_free(IntPtr)">
  2536. <ul class="md-nav__list">
  2537. <li class="md-nav__item">
  2538. <a href="#parameters_35" class="md-nav__link">
  2539. Parameters
  2540. </a>
  2541. </li>
  2542. </ul>
  2543. </nav>
  2544. </li>
  2545. <li class="md-nav__item">
  2546. <a href="#llama_free_modelintptr" class="md-nav__link">
  2547. llama_free_model(IntPtr)
  2548. </a>
  2549. <nav class="md-nav" aria-label="llama_free_model(IntPtr)">
  2550. <ul class="md-nav__list">
  2551. <li class="md-nav__item">
  2552. <a href="#parameters_36" class="md-nav__link">
  2553. Parameters
  2554. </a>
  2555. </li>
  2556. </ul>
  2557. </nav>
  2558. </li>
  2559. <li class="md-nav__item">
  2560. <a href="#llama_model_apply_lora_from_filesafellamamodelhandle-string-string-int32" class="md-nav__link">
  2561. llama_model_apply_lora_from_file(SafeLlamaModelHandle, String, String, Int32)
  2562. </a>
  2563. <nav class="md-nav" aria-label="llama_model_apply_lora_from_file(SafeLlamaModelHandle, String, String, Int32)">
  2564. <ul class="md-nav__list">
  2565. <li class="md-nav__item">
  2566. <a href="#parameters_37" class="md-nav__link">
  2567. Parameters
  2568. </a>
  2569. </li>
  2570. <li class="md-nav__item">
  2571. <a href="#returns_24" class="md-nav__link">
  2572. Returns
  2573. </a>
  2574. </li>
  2575. </ul>
  2576. </nav>
  2577. </li>
  2578. <li class="md-nav__item">
  2579. <a href="#llama_get_kv_cache_token_countsafellamacontexthandle" class="md-nav__link">
  2580. llama_get_kv_cache_token_count(SafeLLamaContextHandle)
  2581. </a>
  2582. <nav class="md-nav" aria-label="llama_get_kv_cache_token_count(SafeLLamaContextHandle)">
  2583. <ul class="md-nav__list">
  2584. <li class="md-nav__item">
  2585. <a href="#parameters_38" class="md-nav__link">
  2586. Parameters
  2587. </a>
  2588. </li>
  2589. <li class="md-nav__item">
  2590. <a href="#returns_25" class="md-nav__link">
  2591. Returns
  2592. </a>
  2593. </li>
  2594. </ul>
  2595. </nav>
  2596. </li>
  2597. <li class="md-nav__item">
  2598. <a href="#llama_set_rng_seedsafellamacontexthandle-int32" class="md-nav__link">
  2599. llama_set_rng_seed(SafeLLamaContextHandle, Int32)
  2600. </a>
  2601. <nav class="md-nav" aria-label="llama_set_rng_seed(SafeLLamaContextHandle, Int32)">
  2602. <ul class="md-nav__list">
  2603. <li class="md-nav__item">
  2604. <a href="#parameters_39" class="md-nav__link">
  2605. Parameters
  2606. </a>
  2607. </li>
  2608. </ul>
  2609. </nav>
  2610. </li>
  2611. <li class="md-nav__item">
  2612. <a href="#llama_get_state_sizesafellamacontexthandle" class="md-nav__link">
  2613. llama_get_state_size(SafeLLamaContextHandle)
  2614. </a>
  2615. <nav class="md-nav" aria-label="llama_get_state_size(SafeLLamaContextHandle)">
  2616. <ul class="md-nav__list">
  2617. <li class="md-nav__item">
  2618. <a href="#parameters_40" class="md-nav__link">
  2619. Parameters
  2620. </a>
  2621. </li>
  2622. <li class="md-nav__item">
  2623. <a href="#returns_26" class="md-nav__link">
  2624. Returns
  2625. </a>
  2626. </li>
  2627. </ul>
  2628. </nav>
  2629. </li>
  2630. <li class="md-nav__item">
  2631. <a href="#llama_copy_state_datasafellamacontexthandle-byte" class="md-nav__link">
  2632. llama_copy_state_data(SafeLLamaContextHandle, Byte*)
  2633. </a>
  2634. <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte*)">
  2635. <ul class="md-nav__list">
  2636. <li class="md-nav__item">
  2637. <a href="#parameters_41" class="md-nav__link">
  2638. Parameters
  2639. </a>
  2640. </li>
  2641. <li class="md-nav__item">
  2642. <a href="#returns_27" class="md-nav__link">
  2643. Returns
  2644. </a>
  2645. </li>
  2646. </ul>
  2647. </nav>
  2648. </li>
  2649. <li class="md-nav__item">
  2650. <a href="#llama_copy_state_datasafellamacontexthandle-byte_1" class="md-nav__link">
  2651. llama_copy_state_data(SafeLLamaContextHandle, Byte[])
  2652. </a>
  2653. <nav class="md-nav" aria-label="llama_copy_state_data(SafeLLamaContextHandle, Byte[])">
  2654. <ul class="md-nav__list">
  2655. <li class="md-nav__item">
  2656. <a href="#parameters_42" class="md-nav__link">
  2657. Parameters
  2658. </a>
  2659. </li>
  2660. <li class="md-nav__item">
  2661. <a href="#returns_28" class="md-nav__link">
  2662. Returns
  2663. </a>
  2664. </li>
  2665. </ul>
  2666. </nav>
  2667. </li>
  2668. <li class="md-nav__item">
  2669. <a href="#llama_set_state_datasafellamacontexthandle-byte" class="md-nav__link">
  2670. llama_set_state_data(SafeLLamaContextHandle, Byte*)
  2671. </a>
  2672. <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte*)">
  2673. <ul class="md-nav__list">
  2674. <li class="md-nav__item">
  2675. <a href="#parameters_43" class="md-nav__link">
  2676. Parameters
  2677. </a>
  2678. </li>
  2679. <li class="md-nav__item">
  2680. <a href="#returns_29" class="md-nav__link">
  2681. Returns
  2682. </a>
  2683. </li>
  2684. </ul>
  2685. </nav>
  2686. </li>
  2687. <li class="md-nav__item">
  2688. <a href="#llama_set_state_datasafellamacontexthandle-byte_1" class="md-nav__link">
  2689. llama_set_state_data(SafeLLamaContextHandle, Byte[])
  2690. </a>
  2691. <nav class="md-nav" aria-label="llama_set_state_data(SafeLLamaContextHandle, Byte[])">
  2692. <ul class="md-nav__list">
  2693. <li class="md-nav__item">
  2694. <a href="#parameters_44" class="md-nav__link">
  2695. Parameters
  2696. </a>
  2697. </li>
  2698. <li class="md-nav__item">
  2699. <a href="#returns_30" class="md-nav__link">
  2700. Returns
  2701. </a>
  2702. </li>
  2703. </ul>
  2704. </nav>
  2705. </li>
  2706. <li class="md-nav__item">
  2707. <a href="#llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64" class="md-nav__link">
  2708. llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)
  2709. </a>
  2710. <nav class="md-nav" aria-label="llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)">
  2711. <ul class="md-nav__list">
  2712. <li class="md-nav__item">
  2713. <a href="#parameters_45" class="md-nav__link">
  2714. Parameters
  2715. </a>
  2716. </li>
  2717. <li class="md-nav__item">
  2718. <a href="#returns_31" class="md-nav__link">
  2719. Returns
  2720. </a>
  2721. </li>
  2722. </ul>
  2723. </nav>
  2724. </li>
  2725. <li class="md-nav__item">
  2726. <a href="#llama_save_session_filesafellamacontexthandle-string-int32-uint64" class="md-nav__link">
  2727. llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)
  2728. </a>
  2729. <nav class="md-nav" aria-label="llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)">
  2730. <ul class="md-nav__list">
  2731. <li class="md-nav__item">
  2732. <a href="#parameters_46" class="md-nav__link">
  2733. Parameters
  2734. </a>
  2735. </li>
  2736. <li class="md-nav__item">
  2737. <a href="#returns_32" class="md-nav__link">
  2738. Returns
  2739. </a>
  2740. </li>
  2741. </ul>
  2742. </nav>
  2743. </li>
  2744. <li class="md-nav__item">
  2745. <a href="#llama_evalsafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
  2746. llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)
  2747. </a>
  2748. <nav class="md-nav" aria-label="llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)">
  2749. <ul class="md-nav__list">
  2750. <li class="md-nav__item">
  2751. <a href="#parameters_47" class="md-nav__link">
  2752. Parameters
  2753. </a>
  2754. </li>
  2755. <li class="md-nav__item">
  2756. <a href="#returns_33" class="md-nav__link">
  2757. Returns
  2758. </a>
  2759. </li>
  2760. </ul>
  2761. </nav>
  2762. </li>
  2763. <li class="md-nav__item">
  2764. <a href="#llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32" class="md-nav__link">
  2765. llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)
  2766. </a>
  2767. <nav class="md-nav" aria-label="llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)">
  2768. <ul class="md-nav__list">
  2769. <li class="md-nav__item">
  2770. <a href="#parameters_48" class="md-nav__link">
  2771. Parameters
  2772. </a>
  2773. </li>
  2774. <li class="md-nav__item">
  2775. <a href="#returns_34" class="md-nav__link">
  2776. Returns
  2777. </a>
  2778. </li>
  2779. </ul>
  2780. </nav>
  2781. </li>
  2782. <li class="md-nav__item">
  2783. <a href="#llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean" class="md-nav__link">
  2784. llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)
  2785. </a>
  2786. <nav class="md-nav" aria-label="llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)">
  2787. <ul class="md-nav__list">
  2788. <li class="md-nav__item">
  2789. <a href="#parameters_49" class="md-nav__link">
  2790. Parameters
  2791. </a>
  2792. </li>
  2793. <li class="md-nav__item">
  2794. <a href="#returns_35" class="md-nav__link">
  2795. Returns
  2796. </a>
  2797. </li>
  2798. </ul>
  2799. </nav>
  2800. </li>
  2801. <li class="md-nav__item">
  2802. <a href="#llama_tokenize_nativesafellamacontexthandle-byte-int32-int32-boolean" class="md-nav__link">
  2803. llama_tokenize_native(SafeLLamaContextHandle, Byte, Int32, Int32, Boolean)
  2804. </a>
  2805. <nav class="md-nav" aria-label="llama_tokenize_native(SafeLLamaContextHandle, Byte, Int32, Int32, Boolean)">
  2806. <ul class="md-nav__list">
  2807. <li class="md-nav__item">
  2808. <a href="#parameters_50" class="md-nav__link">
  2809. Parameters
  2810. </a>
  2811. </li>
  2812. <li class="md-nav__item">
  2813. <a href="#returns_36" class="md-nav__link">
  2814. Returns
  2815. </a>
  2816. </li>
  2817. </ul>
  2818. </nav>
  2819. </li>
  2820. <li class="md-nav__item">
  2821. <a href="#llama_n_vocabsafellamacontexthandle" class="md-nav__link">
  2822. llama_n_vocab(SafeLLamaContextHandle)
  2823. </a>
  2824. <nav class="md-nav" aria-label="llama_n_vocab(SafeLLamaContextHandle)">
  2825. <ul class="md-nav__list">
  2826. <li class="md-nav__item">
  2827. <a href="#parameters_51" class="md-nav__link">
  2828. Parameters
  2829. </a>
  2830. </li>
  2831. <li class="md-nav__item">
  2832. <a href="#returns_37" class="md-nav__link">
  2833. Returns
  2834. </a>
  2835. </li>
  2836. </ul>
  2837. </nav>
  2838. </li>
  2839. <li class="md-nav__item">
  2840. <a href="#llama_n_ctxsafellamacontexthandle" class="md-nav__link">
  2841. llama_n_ctx(SafeLLamaContextHandle)
  2842. </a>
  2843. <nav class="md-nav" aria-label="llama_n_ctx(SafeLLamaContextHandle)">
  2844. <ul class="md-nav__list">
  2845. <li class="md-nav__item">
  2846. <a href="#parameters_52" class="md-nav__link">
  2847. Parameters
  2848. </a>
  2849. </li>
  2850. <li class="md-nav__item">
  2851. <a href="#returns_38" class="md-nav__link">
  2852. Returns
  2853. </a>
  2854. </li>
  2855. </ul>
  2856. </nav>
  2857. </li>
  2858. <li class="md-nav__item">
  2859. <a href="#llama_n_embdsafellamacontexthandle" class="md-nav__link">
  2860. llama_n_embd(SafeLLamaContextHandle)
  2861. </a>
  2862. <nav class="md-nav" aria-label="llama_n_embd(SafeLLamaContextHandle)">
  2863. <ul class="md-nav__list">
  2864. <li class="md-nav__item">
  2865. <a href="#parameters_53" class="md-nav__link">
  2866. Parameters
  2867. </a>
  2868. </li>
  2869. <li class="md-nav__item">
  2870. <a href="#returns_39" class="md-nav__link">
  2871. Returns
  2872. </a>
  2873. </li>
  2874. </ul>
  2875. </nav>
  2876. </li>
  2877. <li class="md-nav__item">
  2878. <a href="#llama_get_logitssafellamacontexthandle" class="md-nav__link">
  2879. llama_get_logits(SafeLLamaContextHandle)
  2880. </a>
  2881. <nav class="md-nav" aria-label="llama_get_logits(SafeLLamaContextHandle)">
  2882. <ul class="md-nav__list">
  2883. <li class="md-nav__item">
  2884. <a href="#parameters_54" class="md-nav__link">
  2885. Parameters
  2886. </a>
  2887. </li>
  2888. <li class="md-nav__item">
  2889. <a href="#returns_40" class="md-nav__link">
  2890. Returns
  2891. </a>
  2892. </li>
  2893. </ul>
  2894. </nav>
  2895. </li>
  2896. <li class="md-nav__item">
  2897. <a href="#llama_get_embeddingssafellamacontexthandle" class="md-nav__link">
  2898. llama_get_embeddings(SafeLLamaContextHandle)
  2899. </a>
  2900. <nav class="md-nav" aria-label="llama_get_embeddings(SafeLLamaContextHandle)">
  2901. <ul class="md-nav__list">
  2902. <li class="md-nav__item">
  2903. <a href="#parameters_55" class="md-nav__link">
  2904. Parameters
  2905. </a>
  2906. </li>
  2907. <li class="md-nav__item">
  2908. <a href="#returns_41" class="md-nav__link">
  2909. Returns
  2910. </a>
  2911. </li>
  2912. </ul>
  2913. </nav>
  2914. </li>
  2915. </ul>
  2916. </nav>
  2917. </li>
  2918. </ul>
  2919. </nav>
  2920. </div>
  2921. </div>
  2922. </div>
  2923. <div class="md-content" data-md-component="content">
  2924. <article class="md-content__inner md-typeset">
  2925. <h1 id="nativeapi">NativeApi</h1>
  2926. <p>Namespace: LLama.Native</p>
  2927. <p>Direct translation of the llama.cpp API</p>
  2928. <pre><code class="language-csharp">public class NativeApi
  2929. </code></pre>
  2930. <p>Inheritance <a href="https://docs.microsoft.com/en-us/dotnet/api/system.object">Object</a> → <a href="./">NativeApi</a></p>
  2931. <h2 id="constructors">Constructors</h2>
  2932. <h3 id="nativeapi_1"><strong>NativeApi()</strong></h3>
  2933. <pre><code class="language-csharp">public NativeApi()
  2934. </code></pre>
  2935. <h2 id="methods">Methods</h2>
  2936. <h3 id="llama_sample_token_mirostatsafellamacontexthandle-llamatokendataarraynative-single-single-int32-single"><strong>llama_sample_token_mirostat(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Int32, Single&amp;)</strong></h3>
  2937. <p>Mirostat 1.0 algorithm described in the paper https://arxiv.org/abs/2007.14966. Uses tokens instead of words.</p>
  2938. <pre><code class="language-csharp">public static int llama_sample_token_mirostat(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float tau, float eta, int m, Single&amp; mu)
  2939. </code></pre>
  2940. <h4 id="parameters">Parameters</h4>
  2941. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  2942. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  2943. 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>
  2944. <p><code>tau</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  2945. 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>
  2946. <p><code>eta</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  2947. 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>
  2948. <p><code>m</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  2949. 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>
  2950. <p><code>mu</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single&amp;">Single&amp;</a><br>
  2951. 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>
  2952. <h4 id="returns">Returns</h4>
  2953. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  2954. <h3 id="llama_sample_token_mirostat_v2safellamacontexthandle-llamatokendataarraynative-single-single-single"><strong>llama_sample_token_mirostat_v2(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, Single, Single&amp;)</strong></h3>
  2955. <p>Mirostat 2.0 algorithm described in the paper https://arxiv.org/abs/2007.14966. Uses tokens instead of words.</p>
  2956. <pre><code class="language-csharp">public static int llama_sample_token_mirostat_v2(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float tau, float eta, Single&amp; mu)
  2957. </code></pre>
  2958. <h4 id="parameters_1">Parameters</h4>
  2959. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  2960. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  2961. 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>
  2962. <p><code>tau</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  2963. 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>
  2964. <p><code>eta</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  2965. 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>
  2966. <p><code>mu</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single&amp;">Single&amp;</a><br>
  2967. 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>
  2968. <h4 id="returns_1">Returns</h4>
  2969. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  2970. <h3 id="llama_sample_token_greedysafellamacontexthandle-llamatokendataarraynative"><strong>llama_sample_token_greedy(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)</strong></h3>
  2971. <p>Selects the token with the highest probability.</p>
  2972. <pre><code class="language-csharp">public static int llama_sample_token_greedy(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates)
  2973. </code></pre>
  2974. <h4 id="parameters_2">Parameters</h4>
  2975. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  2976. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  2977. Pointer to LLamaTokenDataArray</p>
  2978. <h4 id="returns_2">Returns</h4>
  2979. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  2980. <h3 id="llama_sample_tokensafellamacontexthandle-llamatokendataarraynative"><strong>llama_sample_token(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)</strong></h3>
  2981. <p>Randomly selects a token from the candidates based on their probabilities.</p>
  2982. <pre><code class="language-csharp">public static int llama_sample_token(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates)
  2983. </code></pre>
  2984. <h4 id="parameters_3">Parameters</h4>
  2985. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  2986. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  2987. Pointer to LLamaTokenDataArray</p>
  2988. <h4 id="returns_3">Returns</h4>
  2989. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  2990. <h3 id="llama_token_to_strsafellamacontexthandle-int32"><strong>llama_token_to_str(SafeLLamaContextHandle, Int32)</strong></h3>
  2991. <p>Token Id -&gt; String. Uses the vocabulary in the provided context</p>
  2992. <pre><code class="language-csharp">public static IntPtr llama_token_to_str(SafeLLamaContextHandle ctx, int token)
  2993. </code></pre>
  2994. <h4 id="parameters_4">Parameters</h4>
  2995. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  2996. <p><code>token</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  2997. <h4 id="returns_4">Returns</h4>
  2998. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br>
  2999. Pointer to a string.</p>
  3000. <h3 id="llama_token_bossafellamacontexthandle"><strong>llama_token_bos(SafeLLamaContextHandle)</strong></h3>
  3001. <p>Get the "Beginning of sentence" token</p>
  3002. <pre><code class="language-csharp">public static int llama_token_bos(SafeLLamaContextHandle ctx)
  3003. </code></pre>
  3004. <h4 id="parameters_5">Parameters</h4>
  3005. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3006. <h4 id="returns_5">Returns</h4>
  3007. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3008. <h3 id="llama_token_eossafellamacontexthandle"><strong>llama_token_eos(SafeLLamaContextHandle)</strong></h3>
  3009. <p>Get the "End of sentence" token</p>
  3010. <pre><code class="language-csharp">public static int llama_token_eos(SafeLLamaContextHandle ctx)
  3011. </code></pre>
  3012. <h4 id="parameters_6">Parameters</h4>
  3013. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3014. <h4 id="returns_6">Returns</h4>
  3015. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3016. <h3 id="llama_token_nlsafellamacontexthandle"><strong>llama_token_nl(SafeLLamaContextHandle)</strong></h3>
  3017. <p>Get the "new line" token</p>
  3018. <pre><code class="language-csharp">public static int llama_token_nl(SafeLLamaContextHandle ctx)
  3019. </code></pre>
  3020. <h4 id="parameters_7">Parameters</h4>
  3021. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3022. <h4 id="returns_7">Returns</h4>
  3023. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3024. <h3 id="llama_print_timingssafellamacontexthandle"><strong>llama_print_timings(SafeLLamaContextHandle)</strong></h3>
  3025. <p>Print out timing information for this context</p>
  3026. <pre><code class="language-csharp">public static void llama_print_timings(SafeLLamaContextHandle ctx)
  3027. </code></pre>
  3028. <h4 id="parameters_8">Parameters</h4>
  3029. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3030. <h3 id="llama_reset_timingssafellamacontexthandle"><strong>llama_reset_timings(SafeLLamaContextHandle)</strong></h3>
  3031. <p>Reset all collected timing information for this context</p>
  3032. <pre><code class="language-csharp">public static void llama_reset_timings(SafeLLamaContextHandle ctx)
  3033. </code></pre>
  3034. <h4 id="parameters_9">Parameters</h4>
  3035. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3036. <h3 id="llama_print_system_info"><strong>llama_print_system_info()</strong></h3>
  3037. <p>Print system information</p>
  3038. <pre><code class="language-csharp">public static IntPtr llama_print_system_info()
  3039. </code></pre>
  3040. <h4 id="returns_8">Returns</h4>
  3041. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3042. <h3 id="llama_model_n_vocabsafellamamodelhandle"><strong>llama_model_n_vocab(SafeLlamaModelHandle)</strong></h3>
  3043. <p>Get the number of tokens in the model vocabulary</p>
  3044. <pre><code class="language-csharp">public static int llama_model_n_vocab(SafeLlamaModelHandle model)
  3045. </code></pre>
  3046. <h4 id="parameters_10">Parameters</h4>
  3047. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3048. <h4 id="returns_9">Returns</h4>
  3049. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3050. <h3 id="llama_model_n_ctxsafellamamodelhandle"><strong>llama_model_n_ctx(SafeLlamaModelHandle)</strong></h3>
  3051. <p>Get the size of the context window for the model</p>
  3052. <pre><code class="language-csharp">public static int llama_model_n_ctx(SafeLlamaModelHandle model)
  3053. </code></pre>
  3054. <h4 id="parameters_11">Parameters</h4>
  3055. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3056. <h4 id="returns_10">Returns</h4>
  3057. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3058. <h3 id="llama_model_n_embdsafellamamodelhandle"><strong>llama_model_n_embd(SafeLlamaModelHandle)</strong></h3>
  3059. <p>Get the dimension of embedding vectors from this model</p>
  3060. <pre><code class="language-csharp">public static int llama_model_n_embd(SafeLlamaModelHandle model)
  3061. </code></pre>
  3062. <h4 id="parameters_12">Parameters</h4>
  3063. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3064. <h4 id="returns_11">Returns</h4>
  3065. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3066. <h3 id="llama_token_to_piece_with_modelsafellamamodelhandle-int32-byte-int32"><strong>llama_token_to_piece_with_model(SafeLlamaModelHandle, Int32, Byte*, Int32)</strong></h3>
  3067. <p>Convert a single token into text</p>
  3068. <pre><code class="language-csharp">public static int llama_token_to_piece_with_model(SafeLlamaModelHandle model, int llamaToken, Byte* buffer, int length)
  3069. </code></pre>
  3070. <h4 id="parameters_13">Parameters</h4>
  3071. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3072. <p><code>llamaToken</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3073. <p><code>buffer</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte*">Byte*</a><br>
  3074. buffer to write string into</p>
  3075. <p><code>length</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3076. size of the buffer</p>
  3077. <h4 id="returns_12">Returns</h4>
  3078. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3079. The length writte, or if the buffer is too small a negative that indicates the length required</p>
  3080. <h3 id="llama_tokenize_with_modelsafellamamodelhandle-byte-int32-int32-boolean"><strong>llama_tokenize_with_model(SafeLlamaModelHandle, Byte<em>, Int32</em>, Int32, Boolean)</strong></h3>
  3081. <p>Convert text into tokens</p>
  3082. <pre><code class="language-csharp">public static int llama_tokenize_with_model(SafeLlamaModelHandle model, Byte* text, Int32* tokens, int n_max_tokens, bool add_bos)
  3083. </code></pre>
  3084. <h4 id="parameters_14">Parameters</h4>
  3085. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3086. <p><code>text</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte*">Byte*</a><br></p>
  3087. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
  3088. <p><code>n_max_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3089. <p><code>add_bos</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3090. <h4 id="returns_13">Returns</h4>
  3091. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3092. Returns the number of tokens on success, no more than n_max_tokens.
  3093. Returns a negative number on failure - the number of tokens that would have been returned</p>
  3094. <h3 id="llama_log_setllamalogcallback"><strong>llama_log_set(LLamaLogCallback)</strong></h3>
  3095. <p>Register a callback to receive llama log messages</p>
  3096. <pre><code class="language-csharp">public static void llama_log_set(LLamaLogCallback logCallback)
  3097. </code></pre>
  3098. <h4 id="parameters_15">Parameters</h4>
  3099. <p><code>logCallback</code> <a href="./llama.native.llamalogcallback.md">LLamaLogCallback</a><br></p>
  3100. <h3 id="llama_grammar_initllamagrammarelement-uint64-uint64"><strong>llama_grammar_init(LLamaGrammarElement</strong>, UInt64, UInt64)**</h3>
  3101. <p>Create a new grammar from the given set of grammar rules</p>
  3102. <pre><code class="language-csharp">public static IntPtr llama_grammar_init(LLamaGrammarElement** rules, ulong n_rules, ulong start_rule_index)
  3103. </code></pre>
  3104. <h4 id="parameters_16">Parameters</h4>
  3105. <p><code>rules</code> <a href="./llama.native.llamagrammarelement**.md">LLamaGrammarElement**</a><br></p>
  3106. <p><code>n_rules</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3107. <p><code>start_rule_index</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3108. <h4 id="returns_14">Returns</h4>
  3109. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3110. <h3 id="llama_grammar_freeintptr"><strong>llama_grammar_free(IntPtr)</strong></h3>
  3111. <p>Free all memory from the given SafeLLamaGrammarHandle</p>
  3112. <pre><code class="language-csharp">public static void llama_grammar_free(IntPtr grammar)
  3113. </code></pre>
  3114. <h4 id="parameters_17">Parameters</h4>
  3115. <p><code>grammar</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3116. <h3 id="llama_sample_grammarsafellamacontexthandle-llamatokendataarraynative-safellamagrammarhandle"><strong>llama_sample_grammar(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaGrammarHandle)</strong></h3>
  3117. <p>Apply constraints from grammar</p>
  3118. <pre><code class="language-csharp">public static void llama_sample_grammar(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, SafeLLamaGrammarHandle grammar)
  3119. </code></pre>
  3120. <h4 id="parameters_18">Parameters</h4>
  3121. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3122. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br></p>
  3123. <p><code>grammar</code> <a href="../llama.native.safellamagrammarhandle/">SafeLLamaGrammarHandle</a><br></p>
  3124. <h3 id="llama_grammar_accept_tokensafellamacontexthandle-safellamagrammarhandle-int32"><strong>llama_grammar_accept_token(SafeLLamaContextHandle, SafeLLamaGrammarHandle, Int32)</strong></h3>
  3125. <p>Accepts the sampled token into the grammar</p>
  3126. <pre><code class="language-csharp">public static void llama_grammar_accept_token(SafeLLamaContextHandle ctx, SafeLLamaGrammarHandle grammar, int token)
  3127. </code></pre>
  3128. <h4 id="parameters_19">Parameters</h4>
  3129. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3130. <p><code>grammar</code> <a href="../llama.native.safellamagrammarhandle/">SafeLLamaGrammarHandle</a><br></p>
  3131. <p><code>token</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3132. <h3 id="llama_model_quantizestring-string-llamamodelquantizeparams"><strong>llama_model_quantize(String, String, LLamaModelQuantizeParams*)</strong></h3>
  3133. <p>Returns 0 on success</p>
  3134. <pre><code class="language-csharp">public static int llama_model_quantize(string fname_inp, string fname_out, LLamaModelQuantizeParams* param)
  3135. </code></pre>
  3136. <h4 id="parameters_20">Parameters</h4>
  3137. <p><code>fname_inp</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3138. <p><code>fname_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3139. <p><code>param</code> <a href="./llama.native.llamamodelquantizeparams*.md">LLamaModelQuantizeParams*</a><br></p>
  3140. <h4 id="returns_15">Returns</h4>
  3141. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3142. Returns 0 on success</p>
  3143. <p><strong>Remarks:</strong></p>
  3144. <p>not great API - very likely to change</p>
  3145. <h3 id="llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single"><strong>llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative, SafeLLamaContextHandle, Single)</strong></h3>
  3146. <p>Apply classifier-free guidance to the logits as described in academic paper "Stay on topic with Classifier-Free Guidance" https://arxiv.org/abs/2306.17806</p>
  3147. <pre><code class="language-csharp">public static void llama_sample_classifier_free_guidance(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative candidates, SafeLLamaContextHandle guidanceCtx, float scale)
  3148. </code></pre>
  3149. <h4 id="parameters_21">Parameters</h4>
  3150. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3151. <p><code>candidates</code> <a href="../llama.native.llamatokendataarraynative/">LLamaTokenDataArrayNative</a><br>
  3152. A vector of <code>llama_token_data</code> containing the candidate tokens, the logits must be directly extracted from the original generation context without being sorted.</p>
  3153. <p><code>guidanceCtx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br>
  3154. A separate context from the same model. Other than a negative prompt at the beginning, it should have all generated and user input tokens copied from the main context.</p>
  3155. <p><code>scale</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  3156. Guidance strength. 1.0f means no guidance. Higher values mean stronger guidance.</p>
  3157. <h3 id="llama_sample_repetition_penaltysafellamacontexthandle-llamatokendataarraynative-int32-uint64-single"><strong>llama_sample_repetition_penalty(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single)</strong></h3>
  3158. <p>Repetition penalty described in CTRL academic paper https://arxiv.org/abs/1909.05858, with negative logit fix.</p>
  3159. <pre><code class="language-csharp">public static void llama_sample_repetition_penalty(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, Int32* last_tokens, ulong last_tokens_size, float penalty)
  3160. </code></pre>
  3161. <h4 id="parameters_22">Parameters</h4>
  3162. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3163. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3164. Pointer to LLamaTokenDataArray</p>
  3165. <p><code>last_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
  3166. <p><code>last_tokens_size</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3167. <p><code>penalty</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3168. <h3 id="llama_sample_frequency_and_presence_penaltiessafellamacontexthandle-llamatokendataarraynative-int32-uint64-single-single"><strong>llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32*, UInt64, Single, Single)</strong></h3>
  3169. <p>Frequency and presence penalties described in OpenAI API https://platform.openai.com/docs/api-reference/parameter-details.</p>
  3170. <pre><code class="language-csharp">public static void llama_sample_frequency_and_presence_penalties(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, Int32* last_tokens, ulong last_tokens_size, float alpha_frequency, float alpha_presence)
  3171. </code></pre>
  3172. <h4 id="parameters_23">Parameters</h4>
  3173. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3174. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3175. Pointer to LLamaTokenDataArray</p>
  3176. <p><code>last_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
  3177. <p><code>last_tokens_size</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3178. <p><code>alpha_frequency</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3179. <p><code>alpha_presence</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3180. <h3 id="llama_sample_classifier_free_guidancesafellamacontexthandle-llamatokendataarraynative-safellamacontexthandle-single_1"><strong>llama_sample_classifier_free_guidance(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, SafeLLamaContextHandle, Single)</strong></h3>
  3181. <p>Apply classifier-free guidance to the logits as described in academic paper "Stay on topic with Classifier-Free Guidance" https://arxiv.org/abs/2306.17806</p>
  3182. <pre><code class="language-csharp">public static void llama_sample_classifier_free_guidance(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, SafeLLamaContextHandle guidance_ctx, float scale)
  3183. </code></pre>
  3184. <h4 id="parameters_24">Parameters</h4>
  3185. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3186. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3187. A vector of <code>llama_token_data</code> containing the candidate tokens, the logits must be directly extracted from the original generation context without being sorted.</p>
  3188. <p><code>guidance_ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br>
  3189. A separate context from the same model. Other than a negative prompt at the beginning, it should have all generated and user input tokens copied from the main context.</p>
  3190. <p><code>scale</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br>
  3191. Guidance strength. 1.0f means no guidance. Higher values mean stronger guidance.</p>
  3192. <h3 id="llama_sample_softmaxsafellamacontexthandle-llamatokendataarraynative"><strong>llama_sample_softmax(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;)</strong></h3>
  3193. <p>Sorts candidate tokens by their logits in descending order and calculate probabilities based on logits.</p>
  3194. <pre><code class="language-csharp">public static void llama_sample_softmax(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates)
  3195. </code></pre>
  3196. <h4 id="parameters_25">Parameters</h4>
  3197. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3198. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3199. Pointer to LLamaTokenDataArray</p>
  3200. <h3 id="llama_sample_top_ksafellamacontexthandle-llamatokendataarraynative-int32-uint64"><strong>llama_sample_top_k(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Int32, UInt64)</strong></h3>
  3201. <p>Top-K sampling described in academic paper "The Curious Case of Neural Text Degeneration" https://arxiv.org/abs/1904.09751</p>
  3202. <pre><code class="language-csharp">public static void llama_sample_top_k(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, int k, ulong min_keep)
  3203. </code></pre>
  3204. <h4 id="parameters_26">Parameters</h4>
  3205. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3206. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3207. Pointer to LLamaTokenDataArray</p>
  3208. <p><code>k</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3209. <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3210. <h3 id="llama_sample_top_psafellamacontexthandle-llamatokendataarraynative-single-uint64"><strong>llama_sample_top_p(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)</strong></h3>
  3211. <p>Nucleus sampling described in academic paper "The Curious Case of Neural Text Degeneration" https://arxiv.org/abs/1904.09751</p>
  3212. <pre><code class="language-csharp">public static void llama_sample_top_p(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float p, ulong min_keep)
  3213. </code></pre>
  3214. <h4 id="parameters_27">Parameters</h4>
  3215. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3216. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3217. Pointer to LLamaTokenDataArray</p>
  3218. <p><code>p</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3219. <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3220. <h3 id="llama_sample_tail_freesafellamacontexthandle-llamatokendataarraynative-single-uint64"><strong>llama_sample_tail_free(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)</strong></h3>
  3221. <p>Tail Free Sampling described in https://www.trentonbricken.com/Tail-Free-Sampling/.</p>
  3222. <pre><code class="language-csharp">public static void llama_sample_tail_free(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float z, ulong min_keep)
  3223. </code></pre>
  3224. <h4 id="parameters_28">Parameters</h4>
  3225. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3226. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3227. Pointer to LLamaTokenDataArray</p>
  3228. <p><code>z</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3229. <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3230. <h3 id="llama_sample_typicalsafellamacontexthandle-llamatokendataarraynative-single-uint64"><strong>llama_sample_typical(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single, UInt64)</strong></h3>
  3231. <p>Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666.</p>
  3232. <pre><code class="language-csharp">public static void llama_sample_typical(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float p, ulong min_keep)
  3233. </code></pre>
  3234. <h4 id="parameters_29">Parameters</h4>
  3235. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3236. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br>
  3237. Pointer to LLamaTokenDataArray</p>
  3238. <p><code>p</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3239. <p><code>min_keep</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3240. <h3 id="llama_sample_temperaturesafellamacontexthandle-llamatokendataarraynative-single"><strong>llama_sample_temperature(SafeLLamaContextHandle, LLamaTokenDataArrayNative&amp;, Single)</strong></h3>
  3241. <p>Modify logits by temperature</p>
  3242. <pre><code class="language-csharp">public static void llama_sample_temperature(SafeLLamaContextHandle ctx, LLamaTokenDataArrayNative&amp; candidates, float temp)
  3243. </code></pre>
  3244. <h4 id="parameters_30">Parameters</h4>
  3245. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3246. <p><code>candidates</code> <a href="./llama.native.llamatokendataarraynative&amp;.md">LLamaTokenDataArrayNative&amp;</a><br></p>
  3247. <p><code>temp</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single">Single</a><br></p>
  3248. <h3 id="llama_empty_call"><strong>llama_empty_call()</strong></h3>
  3249. <p>A method that does nothing. This is a native method, calling it will force the llama native dependencies to be loaded.</p>
  3250. <pre><code class="language-csharp">public static bool llama_empty_call()
  3251. </code></pre>
  3252. <h4 id="returns_16">Returns</h4>
  3253. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3254. <h3 id="llama_context_default_params"><strong>llama_context_default_params()</strong></h3>
  3255. <p>Create a LLamaContextParams with default values</p>
  3256. <pre><code class="language-csharp">public static LLamaContextParams llama_context_default_params()
  3257. </code></pre>
  3258. <h4 id="returns_17">Returns</h4>
  3259. <p><a href="../llama.native.llamacontextparams/">LLamaContextParams</a><br></p>
  3260. <h3 id="llama_model_quantize_default_params"><strong>llama_model_quantize_default_params()</strong></h3>
  3261. <p>Create a LLamaModelQuantizeParams with default values</p>
  3262. <pre><code class="language-csharp">public static LLamaModelQuantizeParams llama_model_quantize_default_params()
  3263. </code></pre>
  3264. <h4 id="returns_18">Returns</h4>
  3265. <p><a href="../llama.native.llamamodelquantizeparams/">LLamaModelQuantizeParams</a><br></p>
  3266. <h3 id="llama_mmap_supported"><strong>llama_mmap_supported()</strong></h3>
  3267. <p>Check if memory mapping is supported</p>
  3268. <pre><code class="language-csharp">public static bool llama_mmap_supported()
  3269. </code></pre>
  3270. <h4 id="returns_19">Returns</h4>
  3271. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3272. <h3 id="llama_mlock_supported"><strong>llama_mlock_supported()</strong></h3>
  3273. <p>Check if memory lockingis supported</p>
  3274. <pre><code class="language-csharp">public static bool llama_mlock_supported()
  3275. </code></pre>
  3276. <h4 id="returns_20">Returns</h4>
  3277. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3278. <h3 id="llama_eval_exportsafellamacontexthandle-string"><strong>llama_eval_export(SafeLLamaContextHandle, String)</strong></h3>
  3279. <p>Export a static computation graph for context of 511 and batch size of 1
  3280. NOTE: since this functionality is mostly for debugging and demonstration purposes, we hardcode these
  3281. parameters here to keep things simple
  3282. IMPORTANT: do not use for anything else other than debugging and testing!</p>
  3283. <pre><code class="language-csharp">public static int llama_eval_export(SafeLLamaContextHandle ctx, string fname)
  3284. </code></pre>
  3285. <h4 id="parameters_31">Parameters</h4>
  3286. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3287. <p><code>fname</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3288. <h4 id="returns_21">Returns</h4>
  3289. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3290. <h3 id="llama_load_model_from_filestring-llamacontextparams"><strong>llama_load_model_from_file(String, LLamaContextParams)</strong></h3>
  3291. <p>Various functions for loading a ggml llama model.
  3292. Allocate (almost) all memory needed for the model.
  3293. Return NULL on failure</p>
  3294. <pre><code class="language-csharp">public static IntPtr llama_load_model_from_file(string path_model, LLamaContextParams params)
  3295. </code></pre>
  3296. <h4 id="parameters_32">Parameters</h4>
  3297. <p><code>path_model</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3298. <p><code>params</code> <a href="../llama.native.llamacontextparams/">LLamaContextParams</a><br></p>
  3299. <h4 id="returns_22">Returns</h4>
  3300. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3301. <h3 id="llama_new_context_with_modelsafellamamodelhandle-llamacontextparams"><strong>llama_new_context_with_model(SafeLlamaModelHandle, LLamaContextParams)</strong></h3>
  3302. <p>Create a new llama_context with the given model.
  3303. Return value should always be wrapped in SafeLLamaContextHandle!</p>
  3304. <pre><code class="language-csharp">public static IntPtr llama_new_context_with_model(SafeLlamaModelHandle model, LLamaContextParams params)
  3305. </code></pre>
  3306. <h4 id="parameters_33">Parameters</h4>
  3307. <p><code>model</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3308. <p><code>params</code> <a href="../llama.native.llamacontextparams/">LLamaContextParams</a><br></p>
  3309. <h4 id="returns_23">Returns</h4>
  3310. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3311. <h3 id="llama_backend_initboolean"><strong>llama_backend_init(Boolean)</strong></h3>
  3312. <p>not great API - very likely to change.
  3313. Initialize the llama + ggml backend
  3314. Call once at the start of the program</p>
  3315. <pre><code class="language-csharp">public static void llama_backend_init(bool numa)
  3316. </code></pre>
  3317. <h4 id="parameters_34">Parameters</h4>
  3318. <p><code>numa</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3319. <h3 id="llama_freeintptr"><strong>llama_free(IntPtr)</strong></h3>
  3320. <p>Frees all allocated memory in the given llama_context</p>
  3321. <pre><code class="language-csharp">public static void llama_free(IntPtr ctx)
  3322. </code></pre>
  3323. <h4 id="parameters_35">Parameters</h4>
  3324. <p><code>ctx</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3325. <h3 id="llama_free_modelintptr"><strong>llama_free_model(IntPtr)</strong></h3>
  3326. <p>Frees all allocated memory associated with a model</p>
  3327. <pre><code class="language-csharp">public static void llama_free_model(IntPtr model)
  3328. </code></pre>
  3329. <h4 id="parameters_36">Parameters</h4>
  3330. <p><code>model</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.intptr">IntPtr</a><br></p>
  3331. <h3 id="llama_model_apply_lora_from_filesafellamamodelhandle-string-string-int32"><strong>llama_model_apply_lora_from_file(SafeLlamaModelHandle, String, String, Int32)</strong></h3>
  3332. <p>Apply a LoRA adapter to a loaded model
  3333. path_base_model is the path to a higher quality model to use as a base for
  3334. the layers modified by the adapter. Can be NULL to use the current loaded model.
  3335. The model needs to be reloaded before applying a new adapter, otherwise the adapter
  3336. will be applied on top of the previous one</p>
  3337. <pre><code class="language-csharp">public static int llama_model_apply_lora_from_file(SafeLlamaModelHandle model_ptr, string path_lora, string path_base_model, int n_threads)
  3338. </code></pre>
  3339. <h4 id="parameters_37">Parameters</h4>
  3340. <p><code>model_ptr</code> <a href="../llama.native.safellamamodelhandle/">SafeLlamaModelHandle</a><br></p>
  3341. <p><code>path_lora</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3342. <p><code>path_base_model</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3343. <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3344. <h4 id="returns_24">Returns</h4>
  3345. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3346. Returns 0 on success</p>
  3347. <h3 id="llama_get_kv_cache_token_countsafellamacontexthandle"><strong>llama_get_kv_cache_token_count(SafeLLamaContextHandle)</strong></h3>
  3348. <p>Returns the number of tokens in the KV cache</p>
  3349. <pre><code class="language-csharp">public static int llama_get_kv_cache_token_count(SafeLLamaContextHandle ctx)
  3350. </code></pre>
  3351. <h4 id="parameters_38">Parameters</h4>
  3352. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3353. <h4 id="returns_25">Returns</h4>
  3354. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3355. <h3 id="llama_set_rng_seedsafellamacontexthandle-int32"><strong>llama_set_rng_seed(SafeLLamaContextHandle, Int32)</strong></h3>
  3356. <p>Sets the current rng seed.</p>
  3357. <pre><code class="language-csharp">public static void llama_set_rng_seed(SafeLLamaContextHandle ctx, int seed)
  3358. </code></pre>
  3359. <h4 id="parameters_39">Parameters</h4>
  3360. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3361. <p><code>seed</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3362. <h3 id="llama_get_state_sizesafellamacontexthandle"><strong>llama_get_state_size(SafeLLamaContextHandle)</strong></h3>
  3363. <p>Returns the maximum size in bytes of the state (rng, logits, embedding
  3364. and kv_cache) - will often be smaller after compacting tokens</p>
  3365. <pre><code class="language-csharp">public static ulong llama_get_state_size(SafeLLamaContextHandle ctx)
  3366. </code></pre>
  3367. <h4 id="parameters_40">Parameters</h4>
  3368. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3369. <h4 id="returns_26">Returns</h4>
  3370. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3371. <h3 id="llama_copy_state_datasafellamacontexthandle-byte"><strong>llama_copy_state_data(SafeLLamaContextHandle, Byte*)</strong></h3>
  3372. <p>Copies the state to the specified destination address.
  3373. Destination needs to have allocated enough memory.</p>
  3374. <pre><code class="language-csharp">public static ulong llama_copy_state_data(SafeLLamaContextHandle ctx, Byte* dest)
  3375. </code></pre>
  3376. <h4 id="parameters_41">Parameters</h4>
  3377. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3378. <p><code>dest</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte*">Byte*</a><br></p>
  3379. <h4 id="returns_27">Returns</h4>
  3380. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br>
  3381. the number of bytes copied</p>
  3382. <h3 id="llama_copy_state_datasafellamacontexthandle-byte_1"><strong>llama_copy_state_data(SafeLLamaContextHandle, Byte[])</strong></h3>
  3383. <p>Copies the state to the specified destination address.
  3384. Destination needs to have allocated enough memory (see llama_get_state_size)</p>
  3385. <pre><code class="language-csharp">public static ulong llama_copy_state_data(SafeLLamaContextHandle ctx, Byte[] dest)
  3386. </code></pre>
  3387. <h4 id="parameters_42">Parameters</h4>
  3388. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3389. <p><code>dest</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte">Byte[]</a><br></p>
  3390. <h4 id="returns_28">Returns</h4>
  3391. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br>
  3392. the number of bytes copied</p>
  3393. <h3 id="llama_set_state_datasafellamacontexthandle-byte"><strong>llama_set_state_data(SafeLLamaContextHandle, Byte*)</strong></h3>
  3394. <p>Set the state reading from the specified address</p>
  3395. <pre><code class="language-csharp">public static ulong llama_set_state_data(SafeLLamaContextHandle ctx, Byte* src)
  3396. </code></pre>
  3397. <h4 id="parameters_43">Parameters</h4>
  3398. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3399. <p><code>src</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte*">Byte*</a><br></p>
  3400. <h4 id="returns_29">Returns</h4>
  3401. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br>
  3402. the number of bytes read</p>
  3403. <h3 id="llama_set_state_datasafellamacontexthandle-byte_1"><strong>llama_set_state_data(SafeLLamaContextHandle, Byte[])</strong></h3>
  3404. <p>Set the state reading from the specified address</p>
  3405. <pre><code class="language-csharp">public static ulong llama_set_state_data(SafeLLamaContextHandle ctx, Byte[] src)
  3406. </code></pre>
  3407. <h4 id="parameters_44">Parameters</h4>
  3408. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3409. <p><code>src</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte">Byte[]</a><br></p>
  3410. <h4 id="returns_30">Returns</h4>
  3411. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br>
  3412. the number of bytes read</p>
  3413. <h3 id="llama_load_session_filesafellamacontexthandle-string-int32-uint64-uint64"><strong>llama_load_session_file(SafeLLamaContextHandle, String, Int32[], UInt64, UInt64*)</strong></h3>
  3414. <p>Load session file</p>
  3415. <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)
  3416. </code></pre>
  3417. <h4 id="parameters_45">Parameters</h4>
  3418. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3419. <p><code>path_session</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3420. <p><code>tokens_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
  3421. <p><code>n_token_capacity</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3422. <p><code>n_token_count_out</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64*">UInt64*</a><br></p>
  3423. <h4 id="returns_31">Returns</h4>
  3424. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3425. <h3 id="llama_save_session_filesafellamacontexthandle-string-int32-uint64"><strong>llama_save_session_file(SafeLLamaContextHandle, String, Int32[], UInt64)</strong></h3>
  3426. <p>Save session file</p>
  3427. <pre><code class="language-csharp">public static bool llama_save_session_file(SafeLLamaContextHandle ctx, string path_session, Int32[] tokens, ulong n_token_count)
  3428. </code></pre>
  3429. <h4 id="parameters_46">Parameters</h4>
  3430. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3431. <p><code>path_session</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3432. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
  3433. <p><code>n_token_count</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.uint64">UInt64</a><br></p>
  3434. <h4 id="returns_32">Returns</h4>
  3435. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3436. <h3 id="llama_evalsafellamacontexthandle-int32-int32-int32-int32"><strong>llama_eval(SafeLLamaContextHandle, Int32[], Int32, Int32, Int32)</strong></h3>
  3437. <p>Run the llama inference to obtain the logits and probabilities for the next token.
  3438. tokens + n_tokens is the provided batch of new tokens to process
  3439. n_past is the number of tokens to use from previous eval calls</p>
  3440. <pre><code class="language-csharp">public static int llama_eval(SafeLLamaContextHandle ctx, Int32[] tokens, int n_tokens, int n_past, int n_threads)
  3441. </code></pre>
  3442. <h4 id="parameters_47">Parameters</h4>
  3443. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3444. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
  3445. <p><code>n_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3446. <p><code>n_past</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3447. <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3448. <h4 id="returns_33">Returns</h4>
  3449. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3450. Returns 0 on success</p>
  3451. <h3 id="llama_eval_with_pointersafellamacontexthandle-int32-int32-int32-int32"><strong>llama_eval_with_pointer(SafeLLamaContextHandle, Int32*, Int32, Int32, Int32)</strong></h3>
  3452. <p>Run the llama inference to obtain the logits and probabilities for the next token.
  3453. tokens + n_tokens is the provided batch of new tokens to process
  3454. n_past is the number of tokens to use from previous eval calls</p>
  3455. <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)
  3456. </code></pre>
  3457. <h4 id="parameters_48">Parameters</h4>
  3458. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3459. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
  3460. <p><code>n_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3461. <p><code>n_past</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3462. <p><code>n_threads</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3463. <h4 id="returns_34">Returns</h4>
  3464. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3465. Returns 0 on success</p>
  3466. <h3 id="llama_tokenizesafellamacontexthandle-string-encoding-int32-int32-boolean"><strong>llama_tokenize(SafeLLamaContextHandle, String, Encoding, Int32[], Int32, Boolean)</strong></h3>
  3467. <p>Convert the provided text into tokens.</p>
  3468. <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)
  3469. </code></pre>
  3470. <h4 id="parameters_49">Parameters</h4>
  3471. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3472. <p><code>text</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a><br></p>
  3473. <p><code>encoding</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding">Encoding</a><br></p>
  3474. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32[]</a><br></p>
  3475. <p><code>n_max_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3476. <p><code>add_bos</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3477. <h4 id="returns_35">Returns</h4>
  3478. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3479. Returns the number of tokens on success, no more than n_max_tokens.
  3480. Returns a negative number on failure - the number of tokens that would have been returned</p>
  3481. <h3 id="llama_tokenize_nativesafellamacontexthandle-byte-int32-int32-boolean"><strong>llama_tokenize_native(SafeLLamaContextHandle, Byte<em>, Int32</em>, Int32, Boolean)</strong></h3>
  3482. <p>Convert the provided text into tokens.</p>
  3483. <pre><code class="language-csharp">public static int llama_tokenize_native(SafeLLamaContextHandle ctx, Byte* text, Int32* tokens, int n_max_tokens, bool add_bos)
  3484. </code></pre>
  3485. <h4 id="parameters_50">Parameters</h4>
  3486. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3487. <p><code>text</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.byte*">Byte*</a><br></p>
  3488. <p><code>tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32*">Int32*</a><br></p>
  3489. <p><code>n_max_tokens</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3490. <p><code>add_bos</code> <a href="https://docs.microsoft.com/en-us/dotnet/api/system.boolean">Boolean</a><br></p>
  3491. <h4 id="returns_36">Returns</h4>
  3492. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br>
  3493. Returns the number of tokens on success, no more than n_max_tokens.
  3494. Returns a negative number on failure - the number of tokens that would have been returned</p>
  3495. <h3 id="llama_n_vocabsafellamacontexthandle"><strong>llama_n_vocab(SafeLLamaContextHandle)</strong></h3>
  3496. <p>Get the number of tokens in the model vocabulary for this context</p>
  3497. <pre><code class="language-csharp">public static int llama_n_vocab(SafeLLamaContextHandle ctx)
  3498. </code></pre>
  3499. <h4 id="parameters_51">Parameters</h4>
  3500. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3501. <h4 id="returns_37">Returns</h4>
  3502. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3503. <h3 id="llama_n_ctxsafellamacontexthandle"><strong>llama_n_ctx(SafeLLamaContextHandle)</strong></h3>
  3504. <p>Get the size of the context window for the model for this context</p>
  3505. <pre><code class="language-csharp">public static int llama_n_ctx(SafeLLamaContextHandle ctx)
  3506. </code></pre>
  3507. <h4 id="parameters_52">Parameters</h4>
  3508. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3509. <h4 id="returns_38">Returns</h4>
  3510. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3511. <h3 id="llama_n_embdsafellamacontexthandle"><strong>llama_n_embd(SafeLLamaContextHandle)</strong></h3>
  3512. <p>Get the dimension of embedding vectors from the model for this context</p>
  3513. <pre><code class="language-csharp">public static int llama_n_embd(SafeLLamaContextHandle ctx)
  3514. </code></pre>
  3515. <h4 id="parameters_53">Parameters</h4>
  3516. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3517. <h4 id="returns_39">Returns</h4>
  3518. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.int32">Int32</a><br></p>
  3519. <h3 id="llama_get_logitssafellamacontexthandle"><strong>llama_get_logits(SafeLLamaContextHandle)</strong></h3>
  3520. <p>Token logits obtained from the last call to llama_eval()
  3521. The logits for the last token are stored in the last row
  3522. Can be mutated in order to change the probabilities of the next token.<br>
  3523. Rows: n_tokens<br>
  3524. Cols: n_vocab</p>
  3525. <pre><code class="language-csharp">public static Single* llama_get_logits(SafeLLamaContextHandle ctx)
  3526. </code></pre>
  3527. <h4 id="parameters_54">Parameters</h4>
  3528. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3529. <h4 id="returns_40">Returns</h4>
  3530. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br></p>
  3531. <h3 id="llama_get_embeddingssafellamacontexthandle"><strong>llama_get_embeddings(SafeLLamaContextHandle)</strong></h3>
  3532. <p>Get the embeddings for the input
  3533. shape: [n_embd] (1-dimensional)</p>
  3534. <pre><code class="language-csharp">public static Single* llama_get_embeddings(SafeLLamaContextHandle ctx)
  3535. </code></pre>
  3536. <h4 id="parameters_55">Parameters</h4>
  3537. <p><code>ctx</code> <a href="../llama.native.safellamacontexthandle/">SafeLLamaContextHandle</a><br></p>
  3538. <h4 id="returns_41">Returns</h4>
  3539. <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.single*">Single*</a><br></p>
  3540. </article>
  3541. </div>
  3542. </div>
  3543. </main>
  3544. <footer class="md-footer">
  3545. <div class="md-footer-meta md-typeset">
  3546. <div class="md-footer-meta__inner md-grid">
  3547. <div class="md-copyright">
  3548. Made with
  3549. <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
  3550. Material for MkDocs
  3551. </a>
  3552. </div>
  3553. </div>
  3554. </div>
  3555. </footer>
  3556. </div>
  3557. <div class="md-dialog" data-md-component="dialog">
  3558. <div class="md-dialog__inner md-typeset"></div>
  3559. </div>
  3560. <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>
  3561. <script src="../../assets/javascripts/bundle.a51614de.min.js"></script>
  3562. </body>
  3563. </html>

C#/.NET上易用的LLM高性能推理框架,支持LLaMA和LLaVA系列模型。

Contributors (1)