- Notifications
You must be signed in to change notification settings - Fork1
TypeScript SDK for experimenting, testing, evaluating & monitoring LLM-powered applications - Parea AI (YC S23)
License
NotificationsYou must be signed in to change notification settings
parea-ai/parea-sdk-ts
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
npm install parea-ai
import{Completion,CompletionResponse,Parea}from"parea-ai";constp=newParea('PAREA_API_KEY');constdeployedPromptCall=async(query:string):Promise<string>=>{constcompletion:Completion={deployment_id:'Deployment_ID',llm_inputs:{query:query},};constresponse=awaitp.completion(completion);returnresponse.content;};asyncfunctionmain(){returnawaitdeployedPromptCall('Write a hello world program using Typescript and the React framework.');}main().then((result)=>console.log(result));
importOpenAIfrom'openai';import{patchOpenAI,Parea,getCurrentTraceId}from"parea-ai";constopenai=newOpenAI({apiKey:'OPENAI_API_KEY'});// Patch OpenAI to add trace logspatchOpenAI(openai);constp=newParea('PAREA_API_KEY');asyncfunctioncallOpenAI(messages:any[],model:string='gpt-3.5-turbo-0125',temperature:number=0.0,):Promise<string>{constresponse=awaitopenai.chat.completions.create({ model, messages, temperature});returnresponse.choices[0].message.content??'';}asyncfunctionmain(){constresult=awaitcallOpenAI([{role:'user',content:'Write a hello world program using Typescript and the React framework.'}]);// record feedback on resultconsttraceId=getCurrentTraceId();awaitp.recordFeedback({trace_id:traceId,score:0.21,// 0.0 (bad) to 1.0 (good)});returnresult;}main().then((result)=>console.log(result));
This project is licensed under the terms of theApache Software License 2.0 license.SeeLICENSE for more details.
@misc{parea-sdk-ts,author ={parea-ai},title ={Parea typescript sdk},year ={2023},publisher ={GitHub},journal ={GitHub repository},howpublished ={\url{https://github.com/parea-ai/parea-sdk-ts}}}
About
TypeScript SDK for experimenting, testing, evaluating & monitoring LLM-powered applications - Parea AI (YC S23)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.