Socket
Socket
Sign inDemoInstall

parea-ai

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parea-ai

Client SDK library to connect to Parea AI.


Version published
Weekly downloads
109
increased by1.87%
Maintainers
1
Weekly downloads
 
Created
Source

parea-sdk-js

License

Parea typescript sdk

Installation

npm install parea-ai

Getting Started

import { Completion, CompletionResponse } from '../types';
import { Parea } from '../client';

const p = new 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));

Logging results from LLM providers

import OpenAI from 'openai';
import { patchOpenAI } from '../utils/wrap_openai';

const openai = new OpenAI({ apiKey: 'OPENAI_API_KEY' });

// Patch OpenAI to add trace logs
patchOpenAI(openai);

async function callOpenAI(
  messages: any[],
  model: string = 'gpt-3.5-turbo-0613',
  temperature: number = 0.0,
): Promise<string> {
  const response = await openai.chat.completions.create({ model, messages, temperature });
  return response.choices[0].message.content ?? '';
}

const deployedPromptCall = async (query: string): Promise<string> => {
  return await callOpenAI([{ role: 'user', content: query }]);
};

async function main() {
  return await deployedPromptCall('Write a hello world program using Typescript and the React framework.');
}

main().then((result) => console.log(result));

🛡 License

License

This project is licensed under the terms of the Apache Software License 2.0 license. See LICENSE for more details.

📃 Citation

@misc{parea-sdk-js,
  author = {parea-ai},
  title = {Parea typescript sdk},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/parea-ai/parea-sdk-js}}
}

Keywords

FAQs

Package last updated on 07 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc