Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
npm install parea-ai
import {Completion, CompletionResponse, Parea} from "parea-ai";
const p = new Parea('PAREA_API_KEY');
const deployedPromptCall = async (query: string): Promise<string> => {
const completion: Completion = {
deployment_id: 'Deployment_ID',
llm_inputs: { query: query },
};
const response = await p.completion(completion);
return response.content;
};
async function main() {
return await deployedPromptCall('Write a hello world program using Typescript and the React framework.');
}
main().then((result) => console.log(result));
import OpenAI from 'openai';
import {patchOpenAI, Parea, getCurrentTraceId} from "parea-ai";
const openai = new OpenAI({ apiKey: 'OPENAI_API_KEY' });
// Patch OpenAI to add trace logs
patchOpenAI(openai);
const p = new Parea('PAREA_API_KEY');
async function callOpenAI(
messages: any[],
model: string = 'gpt-3.5-turbo-0125',
temperature: number = 0.0,
): Promise<string> {
const response = await openai.chat.completions.create({ model, messages, temperature });
return response.choices[0].message.content ?? '';
}
async function main() {
const result = await callOpenAI([{ role: 'user', content: 'Write a hello world program using Typescript and the React framework.'}]);
// record feedback on result
const traceId = getCurrentTraceId();
await p.recordFeedback({
trace_id: traceId,
score: 0.21, // 0.0 (bad) to 1.0 (good)
});
return result;
}
main().then((result) => console.log(result));
This project is licensed under the terms of the Apache Software License 2.0
license.
See LICENSE 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}}
}
FAQs
Client SDK library to connect to Parea AI.
The npm package parea-ai receives a total of 100 weekly downloads. As such, parea-ai popularity was classified as not popular.
We found that parea-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.