langtrain 0.1.6 → 0.1.9

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.
package/dist/index.mjs CHANGED
@@ -6785,6 +6785,13 @@ var FinetuneConfigSchema = external_exports.object({
6785
6785
  var Langvision = class {
6786
6786
  constructor(options = {}) {
6787
6787
  this.cliPath = options.cliPath || "langvision";
6788
+ this.apiKey = options.apiKey;
6789
+ }
6790
+ getEnv() {
6791
+ return {
6792
+ ...process.env,
6793
+ LANGVISION_API_KEY: this.apiKey || process.env.LANGVISION_API_KEY
6794
+ };
6788
6795
  }
6789
6796
  /**
6790
6797
  * Run a fine-tuning job using the local CLI
@@ -6809,7 +6816,10 @@ var Langvision = class {
6809
6816
  validated.outputDir
6810
6817
  ];
6811
6818
  try {
6812
- await execa(this.cliPath, args, { stdio: "inherit" });
6819
+ await execa(this.cliPath, args, {
6820
+ stdio: "inherit",
6821
+ env: this.getEnv()
6822
+ });
6813
6823
  } catch (error) {
6814
6824
  throw new Error(`Langvision fine-tuning failed: ${error}`);
6815
6825
  }
@@ -6832,7 +6842,9 @@ var Langvision = class {
6832
6842
  args.push("--temperature", options.temperature.toString());
6833
6843
  }
6834
6844
  try {
6835
- const { stdout } = await execa(this.cliPath, args);
6845
+ const { stdout } = await execa(this.cliPath, args, {
6846
+ env: this.getEnv()
6847
+ });
6836
6848
  return stdout;
6837
6849
  } catch (error) {
6838
6850
  throw new Error(`Langvision generation failed: ${error}`);
@@ -12502,6 +12514,13 @@ var FinetuneConfigSchema2 = external_exports2.object({
12502
12514
  var Langtune = class {
12503
12515
  constructor(options = {}) {
12504
12516
  this.cliPath = options.cliPath || "langtune";
12517
+ this.apiKey = options.apiKey;
12518
+ }
12519
+ getEnv() {
12520
+ return {
12521
+ ...process.env,
12522
+ LANGTUNE_API_KEY: this.apiKey || process.env.LANGTUNE_API_KEY
12523
+ };
12505
12524
  }
12506
12525
  /**
12507
12526
  * Run a fine-tuning job using the local CLI
@@ -12534,7 +12553,10 @@ var Langtune = class {
12534
12553
  args.push("--use-lisa");
12535
12554
  }
12536
12555
  try {
12537
- await execa2(this.cliPath, args, { stdio: "inherit" });
12556
+ await execa2(this.cliPath, args, {
12557
+ stdio: "inherit",
12558
+ env: this.getEnv()
12559
+ });
12538
12560
  } catch (error) {
12539
12561
  throw new Error(`Langtune fine-tuning failed: ${error}`);
12540
12562
  }
@@ -12557,14 +12579,51 @@ var Langtune = class {
12557
12579
  args.push("--temperature", options.temperature.toString());
12558
12580
  }
12559
12581
  try {
12560
- const { stdout } = await execa2(this.cliPath, args);
12582
+ const { stdout } = await execa2(this.cliPath, args, {
12583
+ env: this.getEnv()
12584
+ });
12561
12585
  return stdout;
12562
12586
  } catch (error) {
12563
12587
  throw new Error(`Langtune generation failed: ${error}`);
12564
12588
  }
12565
12589
  }
12566
12590
  };
12591
+
12592
+ // src/agent.ts
12593
+ var agent_exports = {};
12594
+ __export(agent_exports, {
12595
+ AgentClient: () => AgentClient
12596
+ });
12597
+ import axios from "axios";
12598
+ var AgentClient = class {
12599
+ constructor(config) {
12600
+ this.config = config;
12601
+ this.client = axios.create({
12602
+ baseURL: config.baseUrl || "https://api.langtrain.ai/api/v1",
12603
+ headers: {
12604
+ "X-API-Key": config.apiKey,
12605
+ "Content-Type": "application/json"
12606
+ }
12607
+ });
12608
+ }
12609
+ async list(workspaceId) {
12610
+ const params = {};
12611
+ if (workspaceId) params.workspace_id = workspaceId;
12612
+ const response = await this.client.get("/agents", { params });
12613
+ return response.data.agents;
12614
+ }
12615
+ async execute(agentId, input, messages = [], conversationId) {
12616
+ const response = await this.client.post(`/agents/${agentId}/execute`, {
12617
+ input,
12618
+ messages,
12619
+ conversation_id: conversationId
12620
+ });
12621
+ return response.data;
12622
+ }
12623
+ };
12567
12624
  export {
12625
+ AgentClient,
12626
+ agent_exports as AgentTypes,
12568
12627
  Langtune,
12569
12628
  Langvision,
12570
12629
  dist_exports2 as Text,