Skip to content

Conversation

@ahmadbilaldev
Copy link
Contributor

@ahmadbilaldev ahmadbilaldev commented Mar 8, 2025

This PR adds the langbase.llm() function.

Usage

It is completely runtime, so provide all parameters, messages, and llm API key with the function. For example:

	// 1. Initiate
	const langbase = new Langbase({
		apiKey: process.env.LANGBASE_API_KEY!,
	});

	// 2. Generate a stream by asking a question
	const result = await langbase.llm({
		messages: [
			{role: 'system', content: 'You are a helpful assistant.'},
			{role: 'user', content: "What is 2+2?"}],
		model: 'openai:gpt-4o-mini',
		llmKey: '',
		stream: false,
	});

llmKey, model, and llmKey are required variables. See types for more options.

@ahmadbilaldev ahmadbilaldev requested a review from msaaddev March 10, 2025 16:34
@ahmadbilaldev ahmadbilaldev requested a review from msaaddev March 11, 2025 19:35
Copy link
Contributor

@msaaddev msaaddev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ahmadbilaldev ahmadbilaldev merged commit 6c7fb73 into main Mar 11, 2025
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants