Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 5 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,32 +146,7 @@ const { NeuroLink } = require('@juspay/neurolink');
### Basic Usage

```typescript
import { NeuroLink, AIProviderFactory } from "@juspay/neurolink";

// LiteLLM - Access 100+ models through unified interface
const litellmProvider = await AIProviderFactory.createProvider(
"litellm",
"openai/gpt-4o",
);
const result = await litellmProvider.generate({
input: { text: "Write a haiku about programming" },
});

// Compare multiple models simultaneously
const models = [
"openai/gpt-4o",
"anthropic/claude-3-5-sonnet",
"google/gemini-2.0-flash",
];
const comparisons = await Promise.all(
models.map(async (model) => {
const provider = await AIProviderFactory.createProvider("litellm", model);
const result = await provider.generate({
input: { text: "Explain quantum computing" },
});
return { model, response: result.content, provider: result.provider };
}),
);
import { NeuroLink } from "@juspay/neurolink";

// Auto-select best available provider
const neurolink = new NeuroLink();
Expand All @@ -181,8 +156,8 @@ const autoResult = await neurolink.generate({
timeout: "30s",
});

console.log(result.content);
console.log(`Used: ${result.provider}`);
console.log(autoResult.content);
console.log(`Used: ${autoResult.provider}`);
```

### Conversation Memory
Expand Down Expand Up @@ -241,27 +216,10 @@ npx @juspay/neurolink generate "Write a proposal" --enable-analytics --enable-ev
npx @juspay/neurolink stream "What time is it and write a file with the current date"
```

#### SDK with LiteLLM and Enhancement Features
#### SDK and Enhancement Features

```typescript
import { NeuroLink, AIProviderFactory } from "@juspay/neurolink";

// LiteLLM multi-model comparison
const models = [
"openai/gpt-4o",
"anthropic/claude-3-5-sonnet",
"google/gemini-2.0-flash",
];
const comparisons = await Promise.all(
models.map(async (model) => {
const provider = await AIProviderFactory.createProvider("litellm", model);
return await provider.generate({
input: { text: "Explain the benefits of renewable energy" },
enableAnalytics: true,
enableEvaluation: true,
});
}),
);
import { NeuroLink } from "@juspay/neurolink";

// Enhanced generation with analytics
const neurolink = new NeuroLink();
Expand Down
45 changes: 41 additions & 4 deletions docs/API-REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

Complete reference for NeuroLink's TypeScript API.

## `NeuroLink` Class

The `NeuroLink` class is the main entry point for using the SDK. It provides a high-level interface for interacting with AI providers and managing advanced features like context summarization and event monitoring.

### Constructor

```typescript
new NeuroLink(options?: NeuroLinkOptions)
```

**Parameters:**

- `options` (optional): An object to configure the `NeuroLink` instance.
- `provider?: AIProviderName`: The default provider to use.
- `model?: string`: The default model to use.
- `conversationMemory?: ConversationMemoryConfig`: Configuration for conversation memory.

**Examples:**

```typescript
import { NeuroLink } from "@juspay/neurolink";

// Auto-select best available provider
const neurolink = new NeuroLink();

// Use a specific provider
const googleAI = new NeuroLink({ provider: "google-ai" });

// Use a specific provider and model
const openAI = new NeuroLink({ provider: "openai", model: "gpt-4o" });
```

## Core Functions

### `createBestAIProvider(requestedProvider?, modelName?)`
Expand Down Expand Up @@ -122,17 +154,19 @@ interface BuiltInTools {
### Example Usage

```typescript
import { NeuroLink } from "@juspay/neurolink";

// All providers automatically have tool support
const provider = createBestAIProvider("openai");
const neurolink = new NeuroLink({ provider: "openai" });

// Tools are used automatically when appropriate
const result = await provider.generate({
const result = await neurolink.generate({
input: { text: "What time is it?" },
});
// Result will use getCurrentTime tool automatically

// Disable tools if needed
const resultNoTools = await provider.generate({
const resultNoTools = await neurolink.generate({
input: { text: "What time is it?" },
disableTools: true,
});
Expand Down Expand Up @@ -887,7 +921,10 @@ interface GenerateOptions {
**Enhanced Usage Example:**

```typescript
const result = await provider.generate({
import { NeuroLink } from "@juspay/neurolink";

const neurolink = new NeuroLink();
const result = await neurolink.generate({
input: { text: "Write a business proposal" },
enableAnalytics: true,
enableEvaluation: true,
Expand Down
19 changes: 19 additions & 0 deletions docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ console.log(result.content);
console.log(`Used: ${result.provider}`);
```

### Write Once, Run Anywhere

NeuroLink's power is in its provider-agnostic design. Write your code once, and NeuroLink automatically uses the best available provider. If your primary provider fails, it seamlessly falls back to another, ensuring your application remains robust.

```typescript
import { NeuroLink } from "@juspay/neurolink";

// No provider specified - NeuroLink handles it!
const neurolink = new NeuroLink();

// This code works with OpenAI, Google, Anthropic, etc. without any changes.
const result = await neurolink.generate({
input: { text: "Explain quantum computing simply." },
});

console.log(result.content);
console.log(`AI Provider Used: ${result.provider}`);
```

## 🔑 Get API Keys

### Google AI Studio (Free Tier Available)
Expand Down