@axiom-lattice/client-sdk 4.5.2 → 4.6.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.
package/dist/index.mjs CHANGED
@@ -2889,6 +2889,70 @@ var AbstractClient = class {
2889
2889
  return await this.makeRequest(`/api/database-configs/${id}/test`, { method: "POST" });
2890
2890
  }
2891
2891
  };
2892
+ this.modelProviders = {
2893
+ list: async () => {
2894
+ const response = await this.makeRequest("/api/model-providers");
2895
+ return response.data.records;
2896
+ },
2897
+ get: async (id) => {
2898
+ const response = await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}`);
2899
+ if (!response.data)
2900
+ throw new ApiError("Model provider not found", 404);
2901
+ return response.data;
2902
+ },
2903
+ create: async (data) => {
2904
+ const response = await this.makeRequest("/api/model-providers", { method: "POST", body: data });
2905
+ if (!response.data)
2906
+ throw new ApiError("Failed to create model provider", 500);
2907
+ return response.data;
2908
+ },
2909
+ update: async (id, data) => {
2910
+ const response = await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}`, { method: "PUT", body: data });
2911
+ if (!response.data)
2912
+ throw new ApiError("Failed to update model provider", 500);
2913
+ return response.data;
2914
+ },
2915
+ delete: async (id) => {
2916
+ await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}`, { method: "DELETE" });
2917
+ },
2918
+ // Probes a base URL + API key that may not be saved yet; used by the
2919
+ // provider form to validate before saving.
2920
+ probe: async (data) => {
2921
+ const response = await this.makeRequest("/api/model-providers/probe", { method: "POST", body: data });
2922
+ if (!response.data)
2923
+ throw new ApiError("Failed to probe model provider", 500);
2924
+ return response.data;
2925
+ },
2926
+ // Replace this provider's model set with exactly these models, picked
2927
+ // from the live list a probe returned. Both states travel: a deselected
2928
+ // model arrives as `enabled: false` rather than being dropped.
2929
+ setModels: async (id, models) => {
2930
+ const response = await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}/models`, { method: "PUT", body: { models } });
2931
+ if (!response.data)
2932
+ throw new ApiError("Failed to update models", 500);
2933
+ return response.data;
2934
+ },
2935
+ discover: async (id) => {
2936
+ const response = await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}/discover`, { method: "POST", body: {} });
2937
+ if (!response.data)
2938
+ throw new ApiError("Failed to discover models", 500);
2939
+ return response.data;
2940
+ },
2941
+ // The model id travels in the body because upstream ids routinely
2942
+ // contain "/" (e.g. Qwen/Qwen2.5-7B-Instruct).
2943
+ setModelEnabled: async (id, modelId, enabled) => {
2944
+ const response = await this.makeRequest(`/api/model-providers/${encodeURIComponent(id)}/models/enabled`, { method: "POST", body: { modelId, enabled } });
2945
+ if (!response.data)
2946
+ throw new ApiError("Failed to update model", 500);
2947
+ return response.data;
2948
+ }
2949
+ };
2950
+ this.tenantModels = {
2951
+ list: async () => {
2952
+ const response = await this.makeRequest("/api/tenant-models");
2953
+ return response.data;
2954
+ }
2955
+ };
2892
2956
  this.metricsConfigs = {
2893
2957
  list: async () => {
2894
2958
  const response = await this.makeRequest("/api/metrics-configs");