paint-brush
Zvakafanotaurwa Zvinobuda: Iyo OpenAI Feature Iwe Pamwe Wakapotsaby@iamarsenibragimov
1,934 kuverenga
1,934 kuverenga

Zvakafanotaurwa Zvinobuda: Iyo OpenAI Feature Iwe Pamwe Wakapotsa

by iamarsenibragimov4m2024/11/20
Read on Terminal Reader

Kurebesa; Kuverenga

Predicted Outputs inoderedza zvakanyanya latency yemuenzaniso mhinduro, kunyanya kana yakawanda yekubuda ichizivikanwa nguva isati yasvika. Iyi ficha inonyanya kubatsira kune maapplication anosanganisira kuvandudza zvinyorwa zvemavara kana mafaera ekodhi ane zvidiki zvigadziriso. Iyo ficha inoita seyakasarudzika inopa inogadzirisa iyo chaiyo kudiwa kwekudzikisa latency paunenge uchigadzira patsva zvemukati.
featured image - Zvakafanotaurwa Zvinobuda: Iyo OpenAI Feature Iwe Pamwe Wakapotsa
iamarsenibragimov HackerNoon profile picture
0-item


OpenAI ichangobva kuunza chinhu chine simba chinodaidzwa kuti Predicted Outputs , iyo yakapinda chinyararire muchiitiko pasina kutariswa kwakawanda kubva kune tekinoroji midhiya-kutarisa kunofanirwa kururamiswa. Ndakaona kuti vataura izvi paX muakaundi yavo yekuvandudza , asi haina kushambadza zvakanyanya. Ndakafunga kukwevera pfungwa pazviri nekuti chinhu chinotonhorera uye chinobatsira.


Predicted Outputs inoderedza zvakanyanya latency yemuenzaniso mhinduro, kunyanya kana yakawanda yekubuda ichizivikanwa nguva isati yasvika. Iyi ficha inonyanya kubatsira kune maapplication anosanganisira kuvandudza zvinyorwa zvemavara kana mafaera ekodhi ane zvidiki zvigadziriso.


Ndezvipi Zvinofanotaurwa Zvinobuda?

Predicted Outputs inobvumira vanogadzira kuti vakurumidze mhinduro dzeAPI kubva kuChat Completions apo zvinotarisirwa kubuda zvakanyanya kufanofungidzira. Nekupa kufanotaura kwemhinduro inotarisirwa uchishandisa prediction yeparameter muChat Completions, modhi inogona kuburitsa inodiwa inobuda zvakanyanya. Kushanda uku kuri kuwanikwa neazvino gpt-4o uye gpt-4o-mini modhi.


Zvakafanotaurwa Zvinoshanda Sei?

Paunenge uine mhinduro uko zvakawanda zvemukati zvave kutozivikanwa, unogona kupa izvo zvinotarisirwa zvirimo sekufanotaura kune modhi. Iyo modhi inozoshandisa fungidziro iyi kukurumidzira chizvarwa chemhinduro, kuderedza latency nekuvandudza mashandiro.


Tsika Muenzaniso: Kugadziridza Mafaira eKugadziridza

Fungidzira iwe une JSON yekumisikidza faira inoda diki yekuvandudza. Heino muenzaniso wefaira rakadaro:

 { "appName": "MyApp", "version": "1.0.0", "settings": { "enableFeatureX": false, "maxUsers": 100 } }


Ngatiti iwe unoda kugadzirisa "enableFeatureX" kuti true . Panzvimbo pekugadzira faira yose kubva pakutanga, unogona kupa faira yepakutanga sekufanotaura uye kuraira muenzaniso kuti uite shanduko inodiwa.


 import OpenAI from "openai"; const config = ` { "appName": "MyApp", "version": "1.0.0", "settings": { "enableFeatureX": false, "maxUsers": 100 } } `.trim(); const openai = new OpenAI(); const updatePrompt = ` Change "enableFeatureX" to true in the following JSON configuration. Respond only with the updated JSON, without any additional text. `; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ { role: "user", content: updatePrompt }, { role: "user", content: config } ], prediction: { type: "content", content: config } }); // Output the updated configuration console.log(completion.choices[0].message.content);


Mumuenzaniso uyu, modhi yacho inokurumidza kuburitsa iyo yakagadziridzwa faira yekumisikidza, ichisimudzira fungidziro kuderedza nguva yekupindura.


Kutepfenyura ne Predicted Outputs

Kune maapplication anoda kutenderera mhinduro, Predicted Outputs inopa yakanyanya kudzikisira latency. Heano maitiro aungaita muenzaniso wekare uchishandisa kutenderera:

 import OpenAI from "openai"; const config = `...`; // Original JSON configuration const openai = new OpenAI(); const updatePrompt = `...`; // Prompt as before const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ /* ... */ ], prediction: { type: "content", content: config }, stream: true }); for await (const chunk of completion) { process.stdout.write(chunk.choices[0]?.delta?.content || ""); }


Panguva yekunyora, hapana dzimwe nzira dzemhinduro iyi kubva kune vanokwikwidza. OpenAI's Predicted Outputs chimiro chinoratidzika sechipo chakasarudzika chinogadzirisa iyo chaiyo kudiwa kwekudzikisa latency kana uchigadzirazve zvinozivikanwa zvirimo nediki gadziriso.


Mazano eVagadziri

Chinhu chinotonhorera ndechekuti kutanga kuishandisa, hapana chaunoda. Ingoitora uye uishandise nekuwedzera imwe chete itsva parameter kune API chikumbiro. Izvi zvinoita kuti zvive nyore kwazvo kune vanogadzira kuita iyi ficha mumashandisirwo avo aripo.


Kuganhurirwa

Nepo Zvakafanotaurwa Zvinobuda zvichipa zvakakosha zvakakosha, pane zvakakosha kufunga:

  • Kuenderana Kwemuenzanisi : Iyo chete gpt-4o uye gpt-4o-mini modhi inotsigira Zvakafanotaurwa. Ini ndinofunga kuti chokwadi chinongowanikwa pamhando idzi harisi dambudziko zvachose, nekuti parizvino ndiyo yakanakisa mhando kubva kuOpenAI, uye yekutanga GPT-4 inononoka kune izvi zvakadaro.
  • Kubhejera : Matokeni ekufungidzira akarambwa anobhadharwa pamwero wakafanana neakagadzirwa tokeni. Tarisa rejected_prediction_tokens mune data rekushandisa kugadzirisa mitengo.
  • Zvisingatsigirwi Parameters :
    • n (zvinokosha kupfuura 1)
    • logprobs
    • presence_penalty (values yakakura kupfuura 0)
    • frequency_penalty (nhamba dzinopfuura 0)
    • max_completion_tokens
    • tools (basa rekufona haritsigirwe)
  • Modality Restrictions : Maitiro ezvinyorwa chete anotsigirwa; maodhiyo ekupinda uye zvinobuda hazvienderane nePredicted Outputs.


Mhedziso

OpenAI's Predicted Outputs chinhu chinokatyamadza chinogadzirisa dambudziko rakajairika mumashandisirwo eAI: kudzikisa latency kana mhinduro ichinyanya kufungidzira. Nekubvumidza vanogadzira kuti vape zvinotarisirwa zvinobuda, inomhanyisa nguva dzekupindura uye inosimudzira ruzivo rwemushandisi.


Mukufunga kwangu pachangu, OpenAI modhi haina kusimba senge Anthropic's modhi. Nekudaro, OpenAI inogadzira akawanda anotonhorera uye anodiwa mhinduro mune dzimwe nzvimbo. Zvimiro zvakaita sePredicted Outputs inoisa OpenAI parutivi kubva kune vamwe vanopa AI, ichipa yakasarudzika mhinduro inosangana nezvinodiwa chaizvo munharaunda yekuvandudza.