Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Repository files navigation

License

Parea typescript sdk

Installation

npm install parea-ai

TypeScript SDK Docs

Getting Started

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));

Logging results from LLM providers & recording user feedback

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));

🛡 License

License

This project is licensed under the terms of theApache Software License 2.0 license.SeeLICENSE for more details.

📃 Citation

@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

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp