langtrain 0.1.26 → 0.2.0

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.
@@ -1,4 +1,6 @@
1
- import axios, { AxiosInstance } from 'axios';
1
+ import { BaseClient, ClientConfig } from './base';
2
+
3
+ // ── Types ──────────────────────────────────────────────────────────────────
2
4
 
3
5
  export interface Secret {
4
6
  key: string;
@@ -6,34 +8,47 @@ export interface Secret {
6
8
  updated_at: string;
7
9
  }
8
10
 
9
- export class SecretClient {
10
- private client: AxiosInstance;
11
+ // ── Client ─────────────────────────────────────────────────────────────────
11
12
 
12
- constructor(private config: { apiKey: string, baseUrl?: string }) {
13
- this.client = axios.create({
14
- baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',
15
- headers: {
16
- 'X-API-Key': config.apiKey,
17
- 'Content-Type': 'application/json'
18
- }
19
- });
13
+ /**
14
+ * Client for managing workspace secrets and environment variables.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const secrets = new SecretClient({ apiKey: 'lt_...' });
19
+ * await secrets.set('OPENAI_KEY', 'sk-...');
20
+ * const all = await secrets.list();
21
+ * ```
22
+ */
23
+ export class SecretClient extends BaseClient {
24
+ constructor(config: ClientConfig) {
25
+ super(config);
20
26
  }
21
27
 
28
+ /** List all secrets in a workspace. Values are redacted. */
22
29
  async list(workspaceId?: string): Promise<Secret[]> {
23
- const params: any = {};
24
- if (workspaceId) params.workspace_id = workspaceId;
25
- const response = await this.client.get<{ secrets: Secret[] }>('/secrets', { params });
26
- return response.data.secrets;
30
+ return this.request(async () => {
31
+ const params: Record<string, string> = {};
32
+ if (workspaceId) params.workspace_id = workspaceId;
33
+ const res = await this.http.get<{ secrets: Secret[] }>('/secrets', { params });
34
+ return res.data.secrets;
35
+ });
27
36
  }
28
37
 
38
+ /** Set (create or update) a secret. */
29
39
  async set(key: string, value: string, workspaceId?: string): Promise<Secret> {
30
- const response = await this.client.post<Secret>('/secrets', { key, value, workspaceId });
31
- return response.data;
40
+ return this.request(async () => {
41
+ const res = await this.http.post<Secret>('/secrets', { key, value, workspace_id: workspaceId });
42
+ return res.data;
43
+ });
32
44
  }
33
45
 
46
+ /** Delete a secret by key. */
34
47
  async delete(key: string, workspaceId?: string): Promise<void> {
35
- const params: any = { key };
36
- if (workspaceId) params.workspace_id = workspaceId;
37
- await this.client.delete(`/secrets/${key}`, { params });
48
+ return this.request(async () => {
49
+ const params: Record<string, string> = {};
50
+ if (workspaceId) params.workspace_id = workspaceId;
51
+ await this.http.delete(`/secrets/${key}`, { params });
52
+ });
38
53
  }
39
54
  }
@@ -1,33 +1,6 @@
1
- import axios, { AxiosInstance } from 'axios';
2
-
3
- export class SubscriptionClient {
4
- private client: AxiosInstance;
5
-
6
- constructor(config: { apiKey: string, baseUrl?: string }) {
7
- this.client = axios.create({
8
- baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',
9
- headers: {
10
- 'X-API-Key': config.apiKey,
11
- 'Content-Type': 'application/json'
12
- }
13
- });
14
- }
1
+ import { BaseClient, ClientConfig } from './base';
15
2
 
16
- async getStatus(): Promise<SubscriptionInfo> {
17
- const response = await this.client.get('/subscription/status');
18
- return response.data;
19
- }
20
-
21
- async checkFeature(feature: string): Promise<FeatureCheck> {
22
- const response = await this.client.get(`/subscription/check/${feature}`);
23
- return response.data;
24
- }
25
-
26
- async getLimits(): Promise<any> {
27
- const response = await this.client.get('/subscription/analytics');
28
- return response.data;
29
- }
30
- }
3
+ // ── Types ──────────────────────────────────────────────────────────────────
31
4
 
32
5
  export interface SubscriptionInfo {
33
6
  is_active: boolean;
@@ -35,7 +8,7 @@ export interface SubscriptionInfo {
35
8
  plan_name: string;
36
9
  expires_at?: string;
37
10
  features: string[];
38
- limits: any;
11
+ limits: Record<string, number>;
39
12
  usage?: {
40
13
  tokensUsedThisMonth?: number;
41
14
  tokenLimit?: number;
@@ -49,3 +22,45 @@ export interface FeatureCheck {
49
22
  limit?: number;
50
23
  used?: number;
51
24
  }
25
+
26
+ // ── Client ─────────────────────────────────────────────────────────────────
27
+
28
+ /**
29
+ * Client for checking subscription status and feature access.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const sub = new SubscriptionClient({ apiKey: 'lt_...' });
34
+ * const status = await sub.getStatus();
35
+ * console.log(status.plan); // 'pro'
36
+ * ```
37
+ */
38
+ export class SubscriptionClient extends BaseClient {
39
+ constructor(config: ClientConfig) {
40
+ super(config);
41
+ }
42
+
43
+ /** Get current subscription status. */
44
+ async getStatus(): Promise<SubscriptionInfo> {
45
+ return this.request(async () => {
46
+ const res = await this.http.get<SubscriptionInfo>('/subscription/status');
47
+ return res.data;
48
+ });
49
+ }
50
+
51
+ /** Check if a specific feature is available on the current plan. */
52
+ async checkFeature(feature: string): Promise<FeatureCheck> {
53
+ return this.request(async () => {
54
+ const res = await this.http.get<FeatureCheck>(`/subscription/check/${feature}`);
55
+ return res.data;
56
+ });
57
+ }
58
+
59
+ /** Get usage analytics for the current subscription. */
60
+ async getLimits(): Promise<Record<string, unknown>> {
61
+ return this.request(async () => {
62
+ const res = await this.http.get('/subscription/analytics');
63
+ return res.data;
64
+ });
65
+ }
66
+ }
@@ -1,39 +1,15 @@
1
- import axios, { AxiosInstance } from 'axios';
1
+ import { BaseClient, ClientConfig } from './base';
2
2
 
3
- export class TrainingClient {
4
- private client: AxiosInstance;
3
+ // ── Types ──────────────────────────────────────────────────────────────────
5
4
 
6
- constructor(config: { apiKey: string, baseUrl?: string }) {
7
- this.client = axios.create({
8
- baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',
9
- headers: {
10
- 'X-API-Key': config.apiKey,
11
- 'Content-Type': 'application/json'
12
- }
13
- });
14
- }
15
-
16
- async createJob(job: FineTuneJobCreate): Promise<FineTuneJobResponse> {
17
- const response = await this.client.post('/finetune/jobs', job);
18
- return response.data;
19
- }
20
-
21
- async listJobs(workspaceId: string, limit: number = 10): Promise<FineTuneJobList> {
22
- const response = await this.client.get('/finetune/jobs', {
23
- params: { workspace_id: workspaceId, limit }
24
- });
25
- return response.data;
26
- }
27
-
28
- async getJob(jobId: string): Promise<FineTuneJobResponse> {
29
- const response = await this.client.get(`/finetune/jobs/${jobId}`);
30
- return response.data;
31
- }
32
-
33
- async cancelJob(jobId: string): Promise<FineTuneJobResponse> {
34
- const response = await this.client.post(`/finetune/jobs/${jobId}/cancel`);
35
- return response.data;
36
- }
5
+ export interface FineTuneHyperparameters {
6
+ epochs?: number;
7
+ learning_rate?: number;
8
+ batch_size?: number;
9
+ warmup_steps?: number;
10
+ lora_rank?: number;
11
+ lora_alpha?: number;
12
+ weight_decay?: number;
37
13
  }
38
14
 
39
15
  export interface FineTuneJobCreate {
@@ -44,21 +20,78 @@ export interface FineTuneJobCreate {
44
20
  guardrail_id?: string;
45
21
  task?: 'text' | 'vision';
46
22
  training_method?: 'sft' | 'dpo' | 'rlhf' | 'lora' | 'qlora';
47
- hyperparameters?: any;
48
- [key: string]: any;
23
+ hyperparameters?: FineTuneHyperparameters;
49
24
  }
50
25
 
51
26
  export interface FineTuneJobResponse {
52
27
  id: string;
53
28
  name: string;
54
- status: string;
29
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
55
30
  progress: number;
56
31
  error_message?: string;
32
+ base_model?: string;
33
+ training_method?: string;
57
34
  created_at: string;
58
- [key: string]: any;
35
+ started_at?: string;
36
+ completed_at?: string;
59
37
  }
60
38
 
61
39
  export interface FineTuneJobList {
62
40
  data: FineTuneJobResponse[];
63
41
  has_more: boolean;
64
42
  }
43
+
44
+ // ── Client ─────────────────────────────────────────────────────────────────
45
+
46
+ /**
47
+ * Client for managing fine-tuning training jobs.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const training = new TrainingClient({ apiKey: 'lt_...' });
52
+ * const job = await training.createJob({
53
+ * base_model: 'meta-llama/Llama-3.1-8B',
54
+ * dataset_id: 'file_abc123',
55
+ * training_method: 'lora',
56
+ * });
57
+ * ```
58
+ */
59
+ export class TrainingClient extends BaseClient {
60
+ constructor(config: ClientConfig) {
61
+ super(config);
62
+ }
63
+
64
+ /** Create a new fine-tuning job. */
65
+ async createJob(job: FineTuneJobCreate): Promise<FineTuneJobResponse> {
66
+ return this.request(async () => {
67
+ const res = await this.http.post<FineTuneJobResponse>('/finetune/jobs', job);
68
+ return res.data;
69
+ });
70
+ }
71
+
72
+ /** List fine-tuning jobs for a workspace. */
73
+ async listJobs(workspaceId: string, limit: number = 10): Promise<FineTuneJobList> {
74
+ return this.request(async () => {
75
+ const res = await this.http.get<FineTuneJobList>('/finetune/jobs', {
76
+ params: { workspace_id: workspaceId, limit },
77
+ });
78
+ return res.data;
79
+ });
80
+ }
81
+
82
+ /** Get a specific job by ID. */
83
+ async getJob(jobId: string): Promise<FineTuneJobResponse> {
84
+ return this.request(async () => {
85
+ const res = await this.http.get<FineTuneJobResponse>(`/finetune/jobs/${jobId}`);
86
+ return res.data;
87
+ });
88
+ }
89
+
90
+ /** Cancel a running job. */
91
+ async cancelJob(jobId: string): Promise<FineTuneJobResponse> {
92
+ return this.request(async () => {
93
+ const res = await this.http.post<FineTuneJobResponse>(`/finetune/jobs/${jobId}/cancel`);
94
+ return res.data;
95
+ });
96
+ }
97
+ }
package/src/lib/usage.ts CHANGED
@@ -1,10 +1,11 @@
1
+ import { BaseClient, ClientConfig } from './base';
1
2
 
2
- import axios, { AxiosInstance } from 'axios';
3
+ // ── Types ──────────────────────────────────────────────────────────────────
3
4
 
4
5
  export interface UsageSummary {
5
6
  workspace_id: string;
6
7
  plan: string;
7
- quotas: Record<string, any>;
8
+ quotas: Record<string, number>;
8
9
  billing?: {
9
10
  plan_id: string;
10
11
  tokens_used: number;
@@ -20,36 +21,40 @@ export interface UsageHistoryPoint {
20
21
  cost: number;
21
22
  }
22
23
 
23
- export class UsageClient {
24
- private client: AxiosInstance;
24
+ // ── Client ─────────────────────────────────────────────────────────────────
25
25
 
26
- constructor(private config: { apiKey: string, baseUrl?: string }) {
27
- this.client = axios.create({
28
- baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',
29
- headers: {
30
- 'X-API-Key': config.apiKey,
31
- 'Content-Type': 'application/json'
32
- }
33
- });
26
+ /**
27
+ * Client for querying usage metrics and billing data.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const usage = new UsageClient({ apiKey: 'lt_...' });
32
+ * const summary = await usage.getSummary('ws_abc123');
33
+ * console.log(summary.billing?.tokens_used);
34
+ * ```
35
+ */
36
+ export class UsageClient extends BaseClient {
37
+ constructor(config: ClientConfig) {
38
+ super(config);
34
39
  }
35
40
 
36
- /**
37
- * Get current usage summary for a workspace.
38
- */
41
+ /** Get current usage summary for a workspace. */
39
42
  async getSummary(workspaceId: string): Promise<UsageSummary> {
40
- const response = await this.client.get<UsageSummary>(`/usage`, {
41
- params: { workspace_id: workspaceId }
43
+ return this.request(async () => {
44
+ const res = await this.http.get<UsageSummary>('/usage', {
45
+ params: { workspace_id: workspaceId },
46
+ });
47
+ return res.data;
42
48
  });
43
- return response.data;
44
49
  }
45
50
 
46
- /**
47
- * Get historical usage data for charts.
48
- */
51
+ /** Get historical usage data for charts. */
49
52
  async getHistory(workspaceId: string, days: number = 30): Promise<UsageHistoryPoint[]> {
50
- const response = await this.client.get<{ history: UsageHistoryPoint[] }>(`/usage/history`, {
51
- params: { workspace_id: workspaceId, days }
53
+ return this.request(async () => {
54
+ const res = await this.http.get<{ history: UsageHistoryPoint[] }>('/usage/history', {
55
+ params: { workspace_id: workspaceId, days },
56
+ });
57
+ return res.data.history;
52
58
  });
53
- return response.data.history;
54
59
  }
55
60
  }
@@ -1,3 +0,0 @@
1
- 'use strict';var langvision=require('langvision'),langtune=require('langtune'),_=require('axios'),A=require('form-data'),y=require('fs');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var langvision__namespace=/*#__PURE__*/_interopNamespace(langvision);var langtune__namespace=/*#__PURE__*/_interopNamespace(langtune);var ___default=/*#__PURE__*/_interopDefault(_);var A__default=/*#__PURE__*/_interopDefault(A);var y__default=/*#__PURE__*/_interopDefault(y);var x=Object.defineProperty;var K=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var p=(n,e)=>{for(var t in e)x(n,t,{get:e[t],enumerable:true});};var u={};p(u,{AgentClient:()=>i});var i=class{constructor(e){this.config=e;this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/agents",{params:t})).data.agents}async get(e){return (await this.client.get(`/agents/${e}`)).data}async create(e){return (await this.client.post("/agents/",e)).data}async delete(e){await this.client.delete(`/agents/${e}`);}async execute(e,t,s=[],r){return (await this.client.post(`/agents/${e}/execute`,{input:t,messages:s,conversation_id:r})).data}async logs(e,t=100){return (await this.client.get(`/agents/${e}/logs`,{params:{limit:t}})).data}};var c=class{constructor(e){this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey}});}async upload(e,t,s="fine-tune"){let r=new A__default.default;if(typeof e=="string"){if(!y__default.default.existsSync(e))throw new Error(`File not found: ${e}`);r.append("file",y__default.default.createReadStream(e));}else throw new Error("File path required");return t&&r.append("workspace_id",t),r.append("purpose",s),(await this.client.post("/files",r,{headers:{...r.getHeaders()}})).data}async list(e,t){let s={workspace_id:e};return t&&(s.purpose=t),(await this.client.get("/files",{params:s})).data.data}};var g=class{constructor(e){this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async createJob(e){return (await this.client.post("/finetune/jobs",e)).data}async listJobs(e,t=10){return (await this.client.get("/finetune/jobs",{params:{workspace_id:e,limit:t}})).data}async getJob(e){return (await this.client.get(`/finetune/jobs/${e}`)).data}async cancelJob(e){return (await this.client.post(`/finetune/jobs/${e}/cancel`)).data}};var l=class{constructor(e){this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async getStatus(){return (await this.client.get("/subscription/status")).data}async checkFeature(e){return (await this.client.get(`/subscription/check/${e}`)).data}async getLimits(){return (await this.client.get("/subscription/analytics")).data}};var b={};p(b,{ModelClient:()=>a});var a=class{constructor(e){this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};e&&(t.task=e);try{return (await this.client.get("/models",{params:t})).data.data}catch(s){throw s}}async get(e){return (await this.client.get(`/models/${e}`)).data}};var h={};p(h,{SecretClient:()=>o});var o=class{constructor(e){this.config=e;this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/secrets",{params:t})).data.secrets}async set(e,t,s){return (await this.client.post("/secrets",{key:e,value:t,workspaceId:s})).data}async delete(e,t){let s={key:e};t&&(s.workspace_id=t),await this.client.delete(`/secrets/${e}`,{params:s});}};var d=class{constructor(e){this.config=e;this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/guardrails/",{params:t})).data}async get(e){return (await this.client.get(`/guardrails/${e}`)).data}async create(e){return (await this.client.post("/guardrails/",e)).data}async delete(e){await this.client.delete(`/guardrails/${e}`);}async apply(e,t){return (await this.client.post("/guardrails/apply",{dataset_id:e,guardrail_id:t})).data}};var m=class{constructor(e){this.config=e;this.client=___default.default.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async getSummary(e){return (await this.client.get("/usage",{params:{workspace_id:e}})).data}async getHistory(e,t=30){return (await this.client.get("/usage/history",{params:{workspace_id:e,days:t}})).data.history}};
2
- exports.m=langvision__namespace;Object.defineProperty(exports,"o",{enumerable:true,get:function(){return langvision.Langvision}});exports.n=langtune__namespace;Object.defineProperty(exports,"p",{enumerable:true,get:function(){return langtune.Langtune}});exports.a=K;exports.b=i;exports.c=u;exports.d=c;exports.e=g;exports.f=l;exports.g=a;exports.h=b;exports.i=o;exports.j=h;exports.k=d;exports.l=m;//# sourceMappingURL=chunk-7D4BGTDT.js.map
3
- //# sourceMappingURL=chunk-7D4BGTDT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/agent.ts","../src/lib/files.ts","../src/lib/training.ts","../src/lib/subscription.ts","../src/lib/models.ts","../src/lib/secrets.ts","../src/lib/guardrails.ts","../src/lib/usage.ts"],"names":["agent_exports","__export","AgentClient","config","axios","workspaceId","params","agentId","agent","input","messages","conversationId","limit","FileClient","file","purpose","form","FormData","fs","TrainingClient","job","jobId","SubscriptionClient","feature","models_exports","ModelClient","task","error","modelId","secrets_exports","SecretClient","key","value","GuardrailClient","guardrailId","data","datasetId","UsageClient","days"],"mappings":"smCAAA,IAAAA,CAAAA,CAAA,GAAAC,CAAAA,CAAAD,EAAA,CAAA,WAAA,CAAA,IAAAE,CAAAA,CAAAA,CAAAA,CAwBO,IAAMA,EAAN,KAAkB,CAGrB,WAAA,CAAoBC,CAAAA,CAA8C,CAA9C,IAAA,CAAA,MAAA,CAAAA,EAChB,IAAA,CAAK,MAAA,CAASC,kBAAAA,CAAM,MAAA,CAAO,CACvB,OAAA,CAASD,EAAO,OAAA,EAAW,iCAAA,CAC3B,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CAASD,CAAAA,CAAO,OAAA,EAAW,iCAAA,CAC3B,QAAS,CACL,WAAA,CAAaA,CAAAA,CAAO,MAAA,CACpB,cAAA,CAAgB,kBACpB,CACJ,CAAC,EACL,CAKA,MAAM,UAAA,CAAWE,CAAAA,CAA4C,CAIzD,OAAA,CAHiB,MAAM,IAAA,CAAK,MAAA,CAAO,GAAA,CAAkB,QAAA,CAAU,CAC3D,MAAA,CAAQ,CAAE,YAAA,CAAcA,CAAY,CACxC,CAAC,GACe,IACpB,CAKA,MAAM,UAAA,CAAWA,CAAAA,CAAqBiC,CAAAA,CAAe,GAAkC,CAInF,OAAA,CAHiB,MAAM,IAAA,CAAK,MAAA,CAAO,GAAA,CAAsC,iBAAkB,CACvF,MAAA,CAAQ,CAAE,YAAA,CAAcjC,CAAAA,CAAa,IAAA,CAAAiC,CAAK,CAC9C,CAAC,CAAA,EACe,IAAA,CAAK,OACzB,CACJ","file":"chunk-7D4BGTDT.js","sourcesContent":["import axios, { AxiosInstance } from 'axios';\n\nexport interface Agent {\n id: string;\n workspace_id: string;\n name: string;\n description?: string;\n model_id?: string;\n config: Record<string, unknown>;\n is_active: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface AgentRun {\n id: string;\n conversation_id: string;\n success: boolean;\n output?: unknown;\n error?: string;\n latency_ms: number;\n tokens_used: number;\n}\n\nexport class AgentClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Agent[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n\n const response = await this.client.get<{ agents: Agent[] }>('/agents', { params });\n return response.data.agents;\n }\n\n async get(agentId: string): Promise<Agent> {\n const response = await this.client.get<Agent>(`/agents/${agentId}`);\n return response.data;\n }\n\n async create(agent: AgentCreate): Promise<Agent> {\n const response = await this.client.post<Agent>('/agents/', agent);\n return response.data;\n }\n\n async delete(agentId: string): Promise<void> {\n await this.client.delete(`/agents/${agentId}`);\n }\n\n async execute(agentId: string, input: any, messages: any[] = [], conversationId?: string): Promise<AgentRun> {\n const response = await this.client.post<AgentRun>(`/agents/${agentId}/execute`, {\n input,\n messages,\n conversation_id: conversationId\n });\n return response.data;\n }\n\n async logs(agentId: string, limit: number = 100): Promise<{ logs: string[] }> {\n const response = await this.client.get<{ logs: string[] }>(`/agents/${agentId}/logs`, {\n params: { limit }\n });\n return response.data;\n }\n}\n\nexport interface AgentConfig {\n system_prompt?: string;\n temperature?: number;\n max_tokens?: number;\n tools?: string[];\n [key: string]: any;\n}\n\nexport interface AgentCreate {\n workspace_id: string; // UUID\n name: string;\n description?: string;\n model_id?: string; // UUID\n config?: AgentConfig;\n}\n","import axios, { AxiosInstance } from 'axios';\nimport FormData from 'form-data';\nimport fs from 'fs';\n\nexport class FileClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n }\n });\n }\n\n async upload(file: any, workspaceId?: string, purpose: string = 'fine-tune'): Promise<FileResponse> {\n const form = new FormData();\n // Check if file is a path or buffer. Assuming path for CLI\n if (typeof file === 'string') {\n if (!fs.existsSync(file)) throw new Error(`File not found: ${file}`);\n form.append('file', fs.createReadStream(file));\n } else {\n // Handle buffer or other types if needed, but for now strict to path\n throw new Error('File path required');\n }\n\n if (workspaceId) form.append('workspace_id', workspaceId);\n form.append('purpose', purpose);\n\n const response = await this.client.post('/files', form, {\n headers: {\n ...form.getHeaders()\n }\n });\n return response.data;\n }\n\n async list(workspaceId: string, purpose?: string): Promise<FileResponse[]> {\n const params: any = { workspace_id: workspaceId };\n if (purpose) params.purpose = purpose;\n const response = await this.client.get('/files', { params });\n return response.data.data;\n }\n}\n\nexport interface FileResponse {\n id: string;\n filename: string;\n purpose: string;\n bytes: number;\n created_at: string;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport class TrainingClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async createJob(job: FineTuneJobCreate): Promise<FineTuneJobResponse> {\n const response = await this.client.post('/finetune/jobs', job);\n return response.data;\n }\n\n async listJobs(workspaceId: string, limit: number = 10): Promise<FineTuneJobList> {\n const response = await this.client.get('/finetune/jobs', {\n params: { workspace_id: workspaceId, limit }\n });\n return response.data;\n }\n\n async getJob(jobId: string): Promise<FineTuneJobResponse> {\n const response = await this.client.get(`/finetune/jobs/${jobId}`);\n return response.data;\n }\n\n async cancelJob(jobId: string): Promise<FineTuneJobResponse> {\n const response = await this.client.post(`/finetune/jobs/${jobId}/cancel`);\n return response.data;\n }\n}\n\nexport interface FineTuneJobCreate {\n name?: string;\n base_model: string;\n model_id?: string;\n dataset_id: string;\n guardrail_id?: string;\n task?: 'text' | 'vision';\n training_method?: 'sft' | 'dpo' | 'rlhf' | 'lora' | 'qlora';\n hyperparameters?: any;\n [key: string]: any;\n}\n\nexport interface FineTuneJobResponse {\n id: string;\n name: string;\n status: string;\n progress: number;\n error_message?: string;\n created_at: string;\n [key: string]: any;\n}\n\nexport interface FineTuneJobList {\n data: FineTuneJobResponse[];\n has_more: boolean;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport class SubscriptionClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async getStatus(): Promise<SubscriptionInfo> {\n const response = await this.client.get('/subscription/status');\n return response.data;\n }\n\n async checkFeature(feature: string): Promise<FeatureCheck> {\n const response = await this.client.get(`/subscription/check/${feature}`);\n return response.data;\n }\n\n async getLimits(): Promise<any> {\n const response = await this.client.get('/subscription/analytics');\n return response.data;\n }\n}\n\nexport interface SubscriptionInfo {\n is_active: boolean;\n plan: string;\n plan_name: string;\n expires_at?: string;\n features: string[];\n limits: any;\n usage?: {\n tokensUsedThisMonth?: number;\n tokenLimit?: number;\n apiCalls?: number;\n };\n}\n\nexport interface FeatureCheck {\n feature: string;\n allowed: boolean;\n limit?: number;\n used?: number;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface Permission {\n id: string;\n object: string;\n created: number;\n allow_create_engine: boolean;\n allow_sampling: boolean;\n allow_logprobs: boolean;\n allow_search_indices: boolean;\n allow_view: boolean;\n allow_fine_tuning: boolean;\n organization: string;\n group: any;\n is_blocking: boolean;\n}\n\nexport interface Model {\n id: string;\n object: string; // 'model'\n created: number;\n owned_by: string;\n permission: Permission[];\n root: string;\n parent: string | null;\n task?: 'text' | 'vision' | 'agent';\n}\n\nexport class ModelClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(task?: string): Promise<Model[]> {\n const params: any = {};\n if (task) params.task = task;\n\n try {\n const response = await this.client.get<{ data: Model[] }>('/models', { params });\n return response.data.data;\n } catch (error) {\n // Fallback if endpoint doesn't support filtering or fails\n // Verify if /models exists, otherwise return empty or throw\n // customized error handling could go here\n throw error;\n }\n }\n\n async get(modelId: string): Promise<Model> {\n const response = await this.client.get<Model>(`/models/${modelId}`);\n return response.data;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface Secret {\n key: string;\n created_at: string;\n updated_at: string;\n}\n\nexport class SecretClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Secret[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n const response = await this.client.get<{ secrets: Secret[] }>('/secrets', { params });\n return response.data.secrets;\n }\n\n async set(key: string, value: string, workspaceId?: string): Promise<Secret> {\n const response = await this.client.post<Secret>('/secrets', { key, value, workspaceId });\n return response.data;\n }\n\n async delete(key: string, workspaceId?: string): Promise<void> {\n const params: any = { key };\n if (workspaceId) params.workspace_id = workspaceId;\n await this.client.delete(`/secrets/${key}`, { params });\n }\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface GuardrailConfig {\n pii_enabled: boolean;\n pii_entities?: string[];\n profanity_enabled: boolean;\n profanity_threshold?: number;\n blocked_topics?: string[];\n regex_patterns?: string[];\n min_length?: number;\n max_length?: number;\n}\n\nexport interface Guardrail {\n id: string;\n workspace_id: string;\n name: string;\n description?: string;\n config: GuardrailConfig;\n is_active: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GuardrailCreate {\n name: string;\n description?: string;\n config: GuardrailConfig;\n}\n\nexport class GuardrailClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Guardrail[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n const response = await this.client.get<Guardrail[]>('/guardrails/', { params });\n return response.data;\n }\n\n async get(guardrailId: string): Promise<Guardrail> {\n const response = await this.client.get<Guardrail>(`/guardrails/${guardrailId}`);\n return response.data;\n }\n\n async create(data: GuardrailCreate): Promise<Guardrail> {\n const response = await this.client.post<Guardrail>('/guardrails/', data);\n return response.data;\n }\n\n async delete(guardrailId: string): Promise<void> {\n await this.client.delete(`/guardrails/${guardrailId}`);\n }\n\n async apply(datasetId: string, guardrailId: string): Promise<any> {\n const response = await this.client.post('/guardrails/apply', {\n dataset_id: datasetId,\n guardrail_id: guardrailId\n });\n return response.data;\n }\n}\n","\nimport axios, { AxiosInstance } from 'axios';\n\nexport interface UsageSummary {\n workspace_id: string;\n plan: string;\n quotas: Record<string, any>;\n billing?: {\n plan_id: string;\n tokens_used: number;\n tokens_limit: number;\n period_end: string;\n };\n}\n\nexport interface UsageHistoryPoint {\n date: string;\n tokens: number;\n agent_runs: number;\n cost: number;\n}\n\nexport class UsageClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n /**\n * Get current usage summary for a workspace.\n */\n async getSummary(workspaceId: string): Promise<UsageSummary> {\n const response = await this.client.get<UsageSummary>(`/usage`, {\n params: { workspace_id: workspaceId }\n });\n return response.data;\n }\n\n /**\n * Get historical usage data for charts.\n */\n async getHistory(workspaceId: string, days: number = 30): Promise<UsageHistoryPoint[]> {\n const response = await this.client.get<{ history: UsageHistoryPoint[] }>(`/usage/history`, {\n params: { workspace_id: workspaceId, days }\n });\n return response.data.history;\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- import*as langvision from'langvision';export{langvision as m };export{Langvision as o}from'langvision';import*as langtune from'langtune';export{langtune as n };export{Langtune as p}from'langtune';import _ from'axios';import A from'form-data';import y from'fs';var x=Object.defineProperty;var K=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var p=(n,e)=>{for(var t in e)x(n,t,{get:e[t],enumerable:true});};var u={};p(u,{AgentClient:()=>i});var i=class{constructor(e){this.config=e;this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/agents",{params:t})).data.agents}async get(e){return (await this.client.get(`/agents/${e}`)).data}async create(e){return (await this.client.post("/agents/",e)).data}async delete(e){await this.client.delete(`/agents/${e}`);}async execute(e,t,s=[],r){return (await this.client.post(`/agents/${e}/execute`,{input:t,messages:s,conversation_id:r})).data}async logs(e,t=100){return (await this.client.get(`/agents/${e}/logs`,{params:{limit:t}})).data}};var c=class{constructor(e){this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey}});}async upload(e,t,s="fine-tune"){let r=new A;if(typeof e=="string"){if(!y.existsSync(e))throw new Error(`File not found: ${e}`);r.append("file",y.createReadStream(e));}else throw new Error("File path required");return t&&r.append("workspace_id",t),r.append("purpose",s),(await this.client.post("/files",r,{headers:{...r.getHeaders()}})).data}async list(e,t){let s={workspace_id:e};return t&&(s.purpose=t),(await this.client.get("/files",{params:s})).data.data}};var g=class{constructor(e){this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async createJob(e){return (await this.client.post("/finetune/jobs",e)).data}async listJobs(e,t=10){return (await this.client.get("/finetune/jobs",{params:{workspace_id:e,limit:t}})).data}async getJob(e){return (await this.client.get(`/finetune/jobs/${e}`)).data}async cancelJob(e){return (await this.client.post(`/finetune/jobs/${e}/cancel`)).data}};var l=class{constructor(e){this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async getStatus(){return (await this.client.get("/subscription/status")).data}async checkFeature(e){return (await this.client.get(`/subscription/check/${e}`)).data}async getLimits(){return (await this.client.get("/subscription/analytics")).data}};var b={};p(b,{ModelClient:()=>a});var a=class{constructor(e){this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};e&&(t.task=e);try{return (await this.client.get("/models",{params:t})).data.data}catch(s){throw s}}async get(e){return (await this.client.get(`/models/${e}`)).data}};var h={};p(h,{SecretClient:()=>o});var o=class{constructor(e){this.config=e;this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/secrets",{params:t})).data.secrets}async set(e,t,s){return (await this.client.post("/secrets",{key:e,value:t,workspaceId:s})).data}async delete(e,t){let s={key:e};t&&(s.workspace_id=t),await this.client.delete(`/secrets/${e}`,{params:s});}};var d=class{constructor(e){this.config=e;this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async list(e){let t={};return e&&(t.workspace_id=e),(await this.client.get("/guardrails/",{params:t})).data}async get(e){return (await this.client.get(`/guardrails/${e}`)).data}async create(e){return (await this.client.post("/guardrails/",e)).data}async delete(e){await this.client.delete(`/guardrails/${e}`);}async apply(e,t){return (await this.client.post("/guardrails/apply",{dataset_id:e,guardrail_id:t})).data}};var m=class{constructor(e){this.config=e;this.client=_.create({baseURL:e.baseUrl||"https://api.langtrain.ai/api/v1",headers:{"X-API-Key":e.apiKey,"Content-Type":"application/json"}});}async getSummary(e){return (await this.client.get("/usage",{params:{workspace_id:e}})).data}async getHistory(e,t=30){return (await this.client.get("/usage/history",{params:{workspace_id:e,days:t}})).data.history}};
2
- export{K as a,i as b,u as c,c as d,g as e,l as f,a as g,b as h,o as i,h as j,d as k,m as l};//# sourceMappingURL=chunk-O3AFVWU4.mjs.map
3
- //# sourceMappingURL=chunk-O3AFVWU4.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/agent.ts","../src/lib/files.ts","../src/lib/training.ts","../src/lib/subscription.ts","../src/lib/models.ts","../src/lib/secrets.ts","../src/lib/guardrails.ts","../src/lib/usage.ts"],"names":["agent_exports","__export","AgentClient","config","axios","workspaceId","params","agentId","agent","input","messages","conversationId","limit","FileClient","file","purpose","form","FormData","fs","TrainingClient","job","jobId","SubscriptionClient","feature","models_exports","ModelClient","task","error","modelId","secrets_exports","SecretClient","key","value","GuardrailClient","guardrailId","data","datasetId","UsageClient","days"],"mappings":"0lBAAA,IAAAA,CAAAA,CAAA,GAAAC,CAAAA,CAAAD,EAAA,CAAA,WAAA,CAAA,IAAAE,CAAAA,CAAAA,CAAAA,CAwBO,IAAMA,EAAN,KAAkB,CAGrB,WAAA,CAAoBC,CAAAA,CAA8C,CAA9C,IAAA,CAAA,MAAA,CAAAA,EAChB,IAAA,CAAK,MAAA,CAASC,CAAAA,CAAM,MAAA,CAAO,CACvB,OAAA,CAASD,EAAO,OAAA,EAAW,iCAAA,CAC3B,OAAA,CAAS,CACL,WAAA,CAAaA,CAAAA,CAAO,OACpB,cAAA,CAAgB,kBACpB,CACJ,CAAC,EACL,CAEA,MAAM,IAAA,CAAKE,CAAAA,CAAwC,CAC/C,IAAMC,CAAAA,CAAc,GACpB,OAAID,CAAAA,GAAaC,EAAO,YAAA,CAAeD,CAAAA,CAAAA,CAAAA,CAEtB,MAAM,IAAA,CAAK,MAAA,CAAO,GAAA,CAAyB,SAAA,CAAW,CAAE,MAAA,CAAAC,CAAO,CAAC,CAAA,EACjE,IAAA,CAAK,MACzB,CAEA,MAAM,IAAIC,CAAAA,CAAiC,CAEvC,OAAA,CADiB,MAAM,IAAA,CAAK,MAAA,CAAO,IAAW,CAAA,QAAA,EAAWA,CAAO,CAAA,CAAE,CAAA,EAClD,IACpB,CAEA,MAAM,MAAA,CAAOC,CAAAA,CAAoC,CAE7C,OAAA,CADiB,MAAM,IAAA,CAAK,OAAO,IAAA,CAAY,UA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esContent":["import axios, { AxiosInstance } from 'axios';\n\nexport interface Agent {\n id: string;\n workspace_id: string;\n name: string;\n description?: string;\n model_id?: string;\n config: Record<string, unknown>;\n is_active: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface AgentRun {\n id: string;\n conversation_id: string;\n success: boolean;\n output?: unknown;\n error?: string;\n latency_ms: number;\n tokens_used: number;\n}\n\nexport class AgentClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Agent[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n\n const response = await this.client.get<{ agents: Agent[] }>('/agents', { params });\n return response.data.agents;\n }\n\n async get(agentId: string): Promise<Agent> {\n const response = await this.client.get<Agent>(`/agents/${agentId}`);\n return response.data;\n }\n\n async create(agent: AgentCreate): Promise<Agent> {\n const response = await this.client.post<Agent>('/agents/', agent);\n return response.data;\n }\n\n async delete(agentId: string): Promise<void> {\n await this.client.delete(`/agents/${agentId}`);\n }\n\n async execute(agentId: string, input: any, messages: any[] = [], conversationId?: string): Promise<AgentRun> {\n const response = await this.client.post<AgentRun>(`/agents/${agentId}/execute`, {\n input,\n messages,\n conversation_id: conversationId\n });\n return response.data;\n }\n\n async logs(agentId: string, limit: number = 100): Promise<{ logs: string[] }> {\n const response = await this.client.get<{ logs: string[] }>(`/agents/${agentId}/logs`, {\n params: { limit }\n });\n return response.data;\n }\n}\n\nexport interface AgentConfig {\n system_prompt?: string;\n temperature?: number;\n max_tokens?: number;\n tools?: string[];\n [key: string]: any;\n}\n\nexport interface AgentCreate {\n workspace_id: string; // UUID\n name: string;\n description?: string;\n model_id?: string; // UUID\n config?: AgentConfig;\n}\n","import axios, { AxiosInstance } from 'axios';\nimport FormData from 'form-data';\nimport fs from 'fs';\n\nexport class FileClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n }\n });\n }\n\n async upload(file: any, workspaceId?: string, purpose: string = 'fine-tune'): Promise<FileResponse> {\n const form = new FormData();\n // Check if file is a path or buffer. Assuming path for CLI\n if (typeof file === 'string') {\n if (!fs.existsSync(file)) throw new Error(`File not found: ${file}`);\n form.append('file', fs.createReadStream(file));\n } else {\n // Handle buffer or other types if needed, but for now strict to path\n throw new Error('File path required');\n }\n\n if (workspaceId) form.append('workspace_id', workspaceId);\n form.append('purpose', purpose);\n\n const response = await this.client.post('/files', form, {\n headers: {\n ...form.getHeaders()\n }\n });\n return response.data;\n }\n\n async list(workspaceId: string, purpose?: string): Promise<FileResponse[]> {\n const params: any = { workspace_id: workspaceId };\n if (purpose) params.purpose = purpose;\n const response = await this.client.get('/files', { params });\n return response.data.data;\n }\n}\n\nexport interface FileResponse {\n id: string;\n filename: string;\n purpose: string;\n bytes: number;\n created_at: string;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport class TrainingClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async createJob(job: FineTuneJobCreate): Promise<FineTuneJobResponse> {\n const response = await this.client.post('/finetune/jobs', job);\n return response.data;\n }\n\n async listJobs(workspaceId: string, limit: number = 10): Promise<FineTuneJobList> {\n const response = await this.client.get('/finetune/jobs', {\n params: { workspace_id: workspaceId, limit }\n });\n return response.data;\n }\n\n async getJob(jobId: string): Promise<FineTuneJobResponse> {\n const response = await this.client.get(`/finetune/jobs/${jobId}`);\n return response.data;\n }\n\n async cancelJob(jobId: string): Promise<FineTuneJobResponse> {\n const response = await this.client.post(`/finetune/jobs/${jobId}/cancel`);\n return response.data;\n }\n}\n\nexport interface FineTuneJobCreate {\n name?: string;\n base_model: string;\n model_id?: string;\n dataset_id: string;\n guardrail_id?: string;\n task?: 'text' | 'vision';\n training_method?: 'sft' | 'dpo' | 'rlhf' | 'lora' | 'qlora';\n hyperparameters?: any;\n [key: string]: any;\n}\n\nexport interface FineTuneJobResponse {\n id: string;\n name: string;\n status: string;\n progress: number;\n error_message?: string;\n created_at: string;\n [key: string]: any;\n}\n\nexport interface FineTuneJobList {\n data: FineTuneJobResponse[];\n has_more: boolean;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport class SubscriptionClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async getStatus(): Promise<SubscriptionInfo> {\n const response = await this.client.get('/subscription/status');\n return response.data;\n }\n\n async checkFeature(feature: string): Promise<FeatureCheck> {\n const response = await this.client.get(`/subscription/check/${feature}`);\n return response.data;\n }\n\n async getLimits(): Promise<any> {\n const response = await this.client.get('/subscription/analytics');\n return response.data;\n }\n}\n\nexport interface SubscriptionInfo {\n is_active: boolean;\n plan: string;\n plan_name: string;\n expires_at?: string;\n features: string[];\n limits: any;\n usage?: {\n tokensUsedThisMonth?: number;\n tokenLimit?: number;\n apiCalls?: number;\n };\n}\n\nexport interface FeatureCheck {\n feature: string;\n allowed: boolean;\n limit?: number;\n used?: number;\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface Permission {\n id: string;\n object: string;\n created: number;\n allow_create_engine: boolean;\n allow_sampling: boolean;\n allow_logprobs: boolean;\n allow_search_indices: boolean;\n allow_view: boolean;\n allow_fine_tuning: boolean;\n organization: string;\n group: any;\n is_blocking: boolean;\n}\n\nexport interface Model {\n id: string;\n object: string; // 'model'\n created: number;\n owned_by: string;\n permission: Permission[];\n root: string;\n parent: string | null;\n task?: 'text' | 'vision' | 'agent';\n}\n\nexport class ModelClient {\n private client: AxiosInstance;\n\n constructor(config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(task?: string): Promise<Model[]> {\n const params: any = {};\n if (task) params.task = task;\n\n try {\n const response = await this.client.get<{ data: Model[] }>('/models', { params });\n return response.data.data;\n } catch (error) {\n // Fallback if endpoint doesn't support filtering or fails\n // Verify if /models exists, otherwise return empty or throw\n // customized error handling could go here\n throw error;\n }\n }\n\n async get(modelId: string): Promise<Model> {\n const response = await this.client.get<Model>(`/models/${modelId}`);\n return response.data;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface Secret {\n key: string;\n created_at: string;\n updated_at: string;\n}\n\nexport class SecretClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Secret[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n const response = await this.client.get<{ secrets: Secret[] }>('/secrets', { params });\n return response.data.secrets;\n }\n\n async set(key: string, value: string, workspaceId?: string): Promise<Secret> {\n const response = await this.client.post<Secret>('/secrets', { key, value, workspaceId });\n return response.data;\n }\n\n async delete(key: string, workspaceId?: string): Promise<void> {\n const params: any = { key };\n if (workspaceId) params.workspace_id = workspaceId;\n await this.client.delete(`/secrets/${key}`, { params });\n }\n}\n","import axios, { AxiosInstance } from 'axios';\n\nexport interface GuardrailConfig {\n pii_enabled: boolean;\n pii_entities?: string[];\n profanity_enabled: boolean;\n profanity_threshold?: number;\n blocked_topics?: string[];\n regex_patterns?: string[];\n min_length?: number;\n max_length?: number;\n}\n\nexport interface Guardrail {\n id: string;\n workspace_id: string;\n name: string;\n description?: string;\n config: GuardrailConfig;\n is_active: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GuardrailCreate {\n name: string;\n description?: string;\n config: GuardrailConfig;\n}\n\nexport class GuardrailClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n async list(workspaceId?: string): Promise<Guardrail[]> {\n const params: any = {};\n if (workspaceId) params.workspace_id = workspaceId;\n const response = await this.client.get<Guardrail[]>('/guardrails/', { params });\n return response.data;\n }\n\n async get(guardrailId: string): Promise<Guardrail> {\n const response = await this.client.get<Guardrail>(`/guardrails/${guardrailId}`);\n return response.data;\n }\n\n async create(data: GuardrailCreate): Promise<Guardrail> {\n const response = await this.client.post<Guardrail>('/guardrails/', data);\n return response.data;\n }\n\n async delete(guardrailId: string): Promise<void> {\n await this.client.delete(`/guardrails/${guardrailId}`);\n }\n\n async apply(datasetId: string, guardrailId: string): Promise<any> {\n const response = await this.client.post('/guardrails/apply', {\n dataset_id: datasetId,\n guardrail_id: guardrailId\n });\n return response.data;\n }\n}\n","\nimport axios, { AxiosInstance } from 'axios';\n\nexport interface UsageSummary {\n workspace_id: string;\n plan: string;\n quotas: Record<string, any>;\n billing?: {\n plan_id: string;\n tokens_used: number;\n tokens_limit: number;\n period_end: string;\n };\n}\n\nexport interface UsageHistoryPoint {\n date: string;\n tokens: number;\n agent_runs: number;\n cost: number;\n}\n\nexport class UsageClient {\n private client: AxiosInstance;\n\n constructor(private config: { apiKey: string, baseUrl?: string }) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.langtrain.ai/api/v1',\n headers: {\n 'X-API-Key': config.apiKey,\n 'Content-Type': 'application/json'\n }\n });\n }\n\n /**\n * Get current usage summary for a workspace.\n */\n async getSummary(workspaceId: string): Promise<UsageSummary> {\n const response = await this.client.get<UsageSummary>(`/usage`, {\n params: { workspace_id: workspaceId }\n });\n return response.data;\n }\n\n /**\n * Get historical usage data for charts.\n */\n async getHistory(workspaceId: string, days: number = 30): Promise<UsageHistoryPoint[]> {\n const response = await this.client.get<{ history: UsageHistoryPoint[] }>(`/usage/history`, {\n params: { workspace_id: workspaceId, days }\n });\n return response.data.history;\n }\n}\n"]}