
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
The AI framework for building declarative and composable AI-powered LLM products.
The AI framework for building declarative and composable AI-powered LLM products.
langbase
SDKFirst, install the langbase
package using npm or yarn:
npm install langbase
or
pnpm add langbase
or
yarn add langbase
You can generateText
or streamText
based on the type of a pipe.
Check our SDK documentation for more details.
Check the following examples:
import 'dotenv/config';
import {Pipe} from 'langbase';
// STREAM: OFF
console.log('STREAM-OFF: generateText()');
// 1. Initiate the Pipe.
const pipe = new Pipe({
// Make sure you have a .env file with any pipe you wanna use.
// As a demo we're using a pipe that has less wordy responses.
apiKey: process.env.PIPE_LESS_WORDY!,
});
// 3. Generate the text by asking a question.
const result = await pipe.generateText({
messages: [{role: 'user', content: 'Who is an AI Engineer?'}],
});
// 4. Done: You got the generated completion.
console.log(result.completion);
// ======= OR ======== //
// STREAM: ON
console.log('');
console.log('STREAM-ON: streamText()');
// 2. Generate a stream by asking a question
const stream = await pipe.streamText({
messages: [{role: 'user', content: 'Who is an AI Engineer?'}],
});
// 3. Print the stream
for await (const chunk of stream) {
// Streaming text part — a single word or several.
const textPart = chunk.choices[0]?.delta?.content || '';
// Demo: Print the stream — you can use it however.
process.stdout.write(textPart);
}
FAQs
The AI SDK for building declarative and composable AI-powered LLM products.
The npm package langbase receives a total of 13,018 weekly downloads. As such, langbase popularity was classified as popular.
We found that langbase demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.