New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

langbase

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langbase

The AI framework for building declarative and composable AI-powered LLM products.

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by4.69%
Maintainers
1
Weekly downloads
 
Created
Source

Langbase SDK

The AI framework for building declarative and composable AI-powered LLM products.

Getting Started with langbase SDK

Installation

First, install the langbase package using npm or yarn:

npm install langbase

or

pnpm add langbase

or

yarn add langbase

Usage

You can generateText or streamText based on the type of a pipe.

import 'dotenv/config';
import {Pipe} from 'langbase';

// STREAM: OFF
const pipeStreamOff = new Pipe({
	apiKey: process.env.PIPE_LESS_WORDY!,
});

const result = await pipeStreamOff.generateText({
	messages: [{role: 'user', content: 'Who is Ahmad Awais?'}],
});

console.log(result.completion);

// STREAM: ON
const pipeStreaming = new Pipe({
	apiKey: process.env.PIPE_LESS_WORDY_STREAM!,
});

const stream = await pipeStreaming.streamText({
	messages: [{role: 'user', content: 'Who is Ahmad Awais?'}],
});

for await (const chunk of stream) {
	process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

Keywords

FAQs

Package last updated on 19 Jul 2024

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