langtrain 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+ push:
7
+ tags:
8
+ - 'v*'
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: '20.x'
19
+ registry-url: 'https://registry.npmjs.org'
20
+
21
+ - run: npm ci
22
+ - run: npm run build
23
+
24
+ publish:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ if: startsWith(github.ref, 'refs/tags/v')
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/setup-node@v4
31
+ with:
32
+ node-version: '20.x'
33
+ registry-url: 'https://registry.npmjs.org'
34
+
35
+ - run: npm ci
36
+ - run: npm run build
37
+ - run: npm publish
38
+ env:
39
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/logo.svg" alt="Langtrain Logo" width="120" height="auto" />
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-white.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg">
5
+ <img alt="Langtrain Logo" src="https://raw.githubusercontent.com/langtrain-ai/langtrain-sdk/main/public/langtrain-black.svg" width="250">
6
+ </picture>
3
7
  <h1>Langtrain SDK</h1>
4
8
  <p>
5
9
  The unified intelligence layer for JavaScript applications. <br/>
@@ -10,6 +14,7 @@
10
14
  <a href="https://www.npmjs.com/package/langtrain"><img src="https://img.shields.io/npm/v/langtrain?style=flat-square&labelColor=231f20&color=000000" alt="npm version" /></a>
11
15
  <a href="https://langtrain.ai"><img src="https://img.shields.io/badge/website-langtrain.ai-000000?style=flat-square&labelColor=231f20" alt="website" /></a>
12
16
  <a href="https://docs.langtrain.ai"><img src="https://img.shields.io/badge/docs-documentation-000000?style=flat-square&labelColor=231f20" alt="documentation" /></a>
17
+ <a href="https://github.com/langtrain-ai/langtrain-sdk/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/langtrain?style=flat-square&labelColor=231f20&color=000000" alt="license" /></a>
13
18
  </p>
14
19
 
15
20
  <br/>
@@ -23,14 +28,16 @@
23
28
 
24
29
  Langtrain brings the power of **Langvision** (Computer Vision) and **Langtune** (LLM Optimization) into your JavaScript/TypeScript workflow. It is designed to be the only SDK you need to build intelligent, multimodal AI applications.
25
30
 
26
- ## Features
31
+ ## Key Features
27
32
 
28
- - **Computer Vision**: Advanced image analysis, object detection, and visual reasoning.
29
- - **LLM Optimization**: Fine-tune and optimize language models effortlessly.
30
- - **Zero-Config Bundling**: Everything is included. No peer dependencies to manage.
31
- - **Type-Safe**: Written in TypeScript for a robust development experience.
33
+ | Feature | Description |
34
+ | :--- | :--- |
35
+ | **👁️ Computer Vision** | Advanced image analysis, object detection, and visual reasoning powered by `Langvision`. |
36
+ | **🧠 LLM Optimization** | Fine-tune and optimize language models effortlessly with `Langtune`. |
37
+ | **📦 Unified & Bundled** | A single dependency for your entire AI stack. Zero configuration required. |
38
+ | **⚡ Type-Safe** | Built with TypeScript for a robust, developer-friendly experience. |
32
39
 
33
- ## Usage
40
+ ## Quick Start
34
41
 
35
42
  ```typescript
36
43
  import { Langvision, Langtune } from 'langtrain';
@@ -41,20 +48,47 @@ const tune = new Langtune({ apiKey: process.env.LANGTUNE_API_KEY });
41
48
 
42
49
  // 2. Build Intelligence
43
50
  async function analyzeAndTune() {
44
- // Analyze visual user context
45
- const context = await vision.analyze({
46
- image: 'https://example.com/dashboard.jpg',
47
- features: ['layout', 'text']
48
- });
49
-
50
- // Generate optimized response based on visual context
51
- const response = await tune.generate({
52
- model: 'gpt-4-vision-optimized',
53
- prompt: `Explain this dashboard layout: ${context.description}`
54
- });
55
-
56
- console.log(response);
51
+ try {
52
+ // Analyze visual user context
53
+ const context = await vision.analyze({
54
+ image: 'https://example.com/dashboard.jpg',
55
+ features: ['layout', 'text']
56
+ });
57
+
58
+ console.log('Visual Context:', context);
59
+
60
+ // Generate optimized response based on visual context
61
+ const response = await tune.generate({
62
+ model: 'gpt-4-vision-optimized',
63
+ prompt: `Explain this dashboard layout: ${context.description}`
64
+ });
65
+
66
+ console.log('AI Response:', response);
67
+ } catch (error) {
68
+ console.error('Error processing AI request:', error);
69
+ }
57
70
  }
71
+
72
+ analyzeAndTune();
73
+ ```
74
+
75
+ ## Advanced Usage
76
+
77
+ For more complex workflows, you can leverage specific modules:
78
+
79
+ ### Fine-Tuning a Model
80
+
81
+ ```typescript
82
+ // Start a fine-tuning job
83
+ const job = await tune.createFineTune({
84
+ trainingFile: 'file-id-123',
85
+ model: 'gpt-3.5-turbo',
86
+ hyperparameters: {
87
+ nEpochs: 4
88
+ }
89
+ });
90
+
91
+ console.log(`Fine-tuning started: ${job.id}`);
58
92
  ```
59
93
 
60
94
  ## Documentation
package/dist/cli.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import 'langvision';
3
+ import 'langtune';
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import 'langvision';
3
+ import 'langtune';