@forge/llm 0.3.2-next.1 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @forge/llm
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7c05ef4: Adding support for new list method to retrieve the supported AI models
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [69e97f1]
12
+ - Updated dependencies [8f24ce1]
13
+ - @forge/api@7.0.0
14
+
15
+ ## 0.4.0-next.2
16
+
17
+ ### Minor Changes
18
+
19
+ - 7c05ef4: Adding support for new list method to retrieve the supported AI models
20
+
3
21
  ## 0.3.2-next.1
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -5,11 +5,37 @@ Library for Forge LLM
5
5
 
6
6
  ## Usage Example
7
7
 
8
- ### Supported Models
8
+ The SDK supports a `chat` and a `stream` interface available to use for all supported models.
9
9
 
10
- For the list of supported models visit [LLM Models](https://go.atlassian.com/forge-llms-api-reference/#supported-models)
10
+ ### List - Supported Models
11
11
 
12
- The SDK supports a `chat` and a `stream` interface.
12
+ For the list of supported models, visit [LLM Models](https://go.atlassian.com/forge-llms-api-reference/#supported-models)
13
+
14
+ You can also dynamically get the list of available models via the `list` method:
15
+
16
+ ```typescript
17
+ import { list } from '@forge/llm';
18
+
19
+ const response = await list();
20
+ ```
21
+
22
+ #### Response Structure
23
+ The response is a `ModelListResponse` object:
24
+
25
+ ```json
26
+ {
27
+ "models": [
28
+ {
29
+ "model": "claude-sonnet-4-20250514",
30
+ "status": "active"
31
+ },
32
+ {
33
+ "model": "claude-opus-4-20250514",
34
+ "status": "deprecated"
35
+ }
36
+ ]
37
+ }
38
+ ```
13
39
 
14
40
  ### Chat
15
41
 
package/out/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './interfaces/types';
2
2
  declare const chat: (prompt: import("./interfaces/types").Prompt) => Promise<import("./interfaces/internal").LlmResponse>;
3
3
  declare const stream: (prompt: import("./interfaces/types").Prompt) => Promise<import("./streaming/stream-response-wrapper").StreamResponse>;
4
- export { chat, stream };
4
+ declare const list: () => Promise<import("./interfaces/internal").ModelListResponse>;
5
+ export { chat, stream, list };
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AAInC,QAAA,MAAM,IAAI,uGAAoE,CAAC;AAE/E,QAAA,MAAM,MAAM,wHAAwE,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AAInC,QAAA,MAAM,IAAI,uGAAoE,CAAC;AAE/E,QAAA,MAAM,MAAM,wHAAwE,CAAC;AAErF,QAAA,MAAM,IAAI,kEAAsB,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC"}
package/out/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stream = exports.chat = void 0;
3
+ exports.list = exports.stream = exports.chat = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const llm_api_1 = require("./llm-api");
6
6
  tslib_1.__exportStar(require("./interfaces/types"), exports);
@@ -9,3 +9,5 @@ const chat = (...args) => llmApi.chat(...args);
9
9
  exports.chat = chat;
10
10
  const stream = (...args) => llmApi.stream(...args);
11
11
  exports.stream = stream;
12
+ const list = () => llmApi.list();
13
+ exports.list = list;
@@ -2,6 +2,7 @@ import { ChatResponse, Prompt, StreamResponse } from './types';
2
2
  export interface LlmApi {
3
3
  chat(prompt: Prompt): Promise<ChatResponse>;
4
4
  stream(prompt: Prompt): Promise<StreamResponse>;
5
+ list(): Promise<ModelListResponse>;
5
6
  }
6
7
  export interface ClientArgs {
7
8
  model: string;
@@ -9,6 +10,7 @@ export interface ClientArgs {
9
10
  }
10
11
  export interface LlmClient {
11
12
  post(args: ClientArgs): Promise<Response>;
13
+ get(): Promise<Response>;
12
14
  }
13
15
  export interface LlmRequest {
14
16
  messages: Message[];
@@ -81,4 +83,11 @@ export interface TextPart {
81
83
  type: 'text';
82
84
  text: string;
83
85
  }
86
+ export interface ModelListResponse {
87
+ models: ModelDetails[];
88
+ }
89
+ export interface ModelDetails {
90
+ model: string;
91
+ status: 'active' | 'deprecated';
92
+ }
84
93
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/interfaces/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;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ACH;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,oBAAY,OAAO,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AAE7C,oBAAY,WAAW,GAAG,QAAQ,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAC;CACjC"}
@@ -1,12 +1,12 @@
1
1
  import { ForgeLlmError, PromptValidationError } from '../errors';
2
2
  import { StreamResponse } from '../streaming/stream-response-wrapper';
3
- import { LlmRequest, LlmResponse, Message, Tool, ToolCall, Usage } from './internal';
3
+ import { LlmRequest, LlmResponse, Message, Tool, ToolCall, Usage, ModelListResponse, ModelDetails } from './internal';
4
4
  export declare type Prompt = LlmRequest & {
5
5
  model: string;
6
6
  };
7
7
  export declare type ChatResponse = LlmResponse;
8
8
  export type { StreamResponse };
9
9
  export declare type ToolSchema = Tool;
10
- export type { Message, ToolCall, Usage };
10
+ export type { Message, ToolCall, Usage, ModelListResponse, ModelDetails };
11
11
  export { ForgeLlmError, PromptValidationError };
12
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/interfaces/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAErF,oBAAY,MAAM,GAAG,UAAU,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,YAAY,GAAG,WAAW,CAAC;AAEvC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,oBAAY,UAAU,GAAG,IAAI,CAAC;AAE9B,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/interfaces/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtH,oBAAY,MAAM,GAAG,UAAU,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,YAAY,GAAG,WAAW,CAAC;AAEvC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,oBAAY,UAAU,GAAG,IAAI,CAAC;AAE9B,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAC"}
package/out/llm-api.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { ChatResponse, Prompt, StreamResponse } from './interfaces/types';
1
+ import { ChatResponse, ModelListResponse, Prompt, StreamResponse } from './interfaces/types';
2
2
  import { LlmApi, LlmClient } from './interfaces/internal';
3
3
  export declare class LlmApiImpl implements LlmApi {
4
4
  llmClient: LlmClient;
5
+ list: () => Promise<ModelListResponse>;
5
6
  chat: (prompt: Prompt) => Promise<ChatResponse>;
6
7
  stream: (prompt: Prompt) => Promise<StreamResponse>;
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"llm-api.d.ts","sourceRoot":"","sources":["../src/llm-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAK1D,qBAAa,UAAW,YAAW,MAAM;IACvC,SAAS,EAAE,SAAS,CAAuB;IAE3C,IAAI,WAAkB,MAAM,KAAG,QAAQ,YAAY,CAAC,CAgBlD;IAEF,MAAM,WAAkB,MAAM,KAAG,QAAQ,cAAc,CAAC,CAgBtD;CACH"}
1
+ {"version":3,"file":"llm-api.d.ts","sourceRoot":"","sources":["../src/llm-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAK1D,qBAAa,UAAW,YAAW,MAAM;IACvC,SAAS,EAAE,SAAS,CAAuB;IAE3C,IAAI,QAAa,QAAQ,iBAAiB,CAAC,CAMzC;IAEF,IAAI,WAAkB,MAAM,KAAG,QAAQ,YAAY,CAAC,CAgBlD;IAEF,MAAM,WAAkB,MAAM,KAAG,QAAQ,cAAc,CAAC,CAgBtD;CACH"}
package/out/llm-api.js CHANGED
@@ -7,6 +7,11 @@ const error_handling_1 = require("./utils/error-handling");
7
7
  const llm_client_1 = require("./llm-client");
8
8
  class LlmApiImpl {
9
9
  llmClient = new llm_client_1.LlmClientImpl();
10
+ list = async () => {
11
+ const response = await this.llmClient.get();
12
+ await (0, error_handling_1.checkResponseError)(response);
13
+ return await (0, response_mapper_1.mapForgeLLMBatchResponse)(response);
14
+ };
10
15
  chat = async (prompt) => {
11
16
  (0, validators_1.validatePrompt)(prompt);
12
17
  const { model, ...request } = prompt;
@@ -4,6 +4,8 @@ export declare class LlmClientImpl implements LlmClient {
4
4
  traceId: string;
5
5
  spanId: string;
6
6
  };
7
+ private static LLM_BASE_URL;
8
+ get(): Promise<Response>;
7
9
  post(args: ClientArgs): Promise<Response>;
8
10
  private buildForgeLlmUrl;
9
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"llm-client.d.ts","sourceRoot":"","sources":["../src/llm-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO;;;MAA2B;IAE5B,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkB/C,OAAO,CAAC,gBAAgB;CAIzB"}
1
+ {"version":3,"file":"llm-client.d.ts","sourceRoot":"","sources":["../src/llm-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO;;;MAA2B;IAElC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAiB;IAEtC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;IAexB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkB/C,OAAO,CAAC,gBAAgB;CAGzB"}
package/out/llm-client.js CHANGED
@@ -4,6 +4,21 @@ exports.LlmClientImpl = void 0;
4
4
  const api_1 = require("@forge/api");
5
5
  class LlmClientImpl {
6
6
  tracing = (0, api_1.__getRuntime)()?.tracing;
7
+ static LLM_BASE_URL = 'https://llm';
8
+ async get() {
9
+ const { traceId, spanId } = this.tracing;
10
+ const options = {
11
+ method: 'GET',
12
+ headers: {
13
+ 'Content-Type': 'application/json',
14
+ 'x-b3-traceid': traceId,
15
+ 'x-b3-spanid': spanId
16
+ }
17
+ };
18
+ return await global.__forge_fetch__({ type: 'llm' }, LlmClientImpl.LLM_BASE_URL, {
19
+ ...options
20
+ });
21
+ }
7
22
  async post(args) {
8
23
  const { model, body } = args;
9
24
  const { traceId, spanId } = this.tracing;
@@ -22,8 +37,7 @@ class LlmClientImpl {
22
37
  });
23
38
  }
24
39
  buildForgeLlmUrl(model) {
25
- const baseUrl = 'https://llm';
26
- return `${baseUrl}/${encodeURIComponent(model)}`;
40
+ return `${LlmClientImpl.LLM_BASE_URL}/${encodeURIComponent(model)}`;
27
41
  }
28
42
  }
29
43
  exports.LlmClientImpl = LlmClientImpl;
@@ -1,6 +1,5 @@
1
1
  import { APIResponse } from '@forge/api';
2
- import { ChatResponse } from './interfaces/types';
3
2
  import { StreamResponse } from './streaming/stream-response-wrapper';
4
- export declare const mapForgeLLMBatchResponse: (response: APIResponse) => Promise<ChatResponse>;
3
+ export declare function mapForgeLLMBatchResponse<T>(response: APIResponse): Promise<T>;
5
4
  export declare const mapForgeLLMStreamResponse: (response: Response) => StreamResponse;
6
5
  //# sourceMappingURL=response-mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-mapper.d.ts","sourceRoot":"","sources":["../src/response-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAyB,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE5F,eAAO,MAAM,wBAAwB,aAAoB,WAAW,KAAG,QAAQ,YAAY,CAG1F,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,cAQ9D,CAAC"}
1
+ {"version":3,"file":"response-mapper.d.ts","sourceRoot":"","sources":["../src/response-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAyB,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE5F,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAGnF;AAED,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,cAQ9D,CAAC"}
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapForgeLLMStreamResponse = exports.mapForgeLLMBatchResponse = void 0;
4
4
  const stream_response_wrapper_1 = require("./streaming/stream-response-wrapper");
5
- const mapForgeLLMBatchResponse = async (response) => {
5
+ async function mapForgeLLMBatchResponse(response) {
6
6
  const chatResponse = await response.json();
7
7
  return chatResponse;
8
- };
8
+ }
9
9
  exports.mapForgeLLMBatchResponse = mapForgeLLMBatchResponse;
10
10
  const mapForgeLLMStreamResponse = (response) => {
11
11
  if (response.body) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@forge/llm",
3
- "version": "0.3.2-next.1",
3
+ "version": "0.4.0",
4
4
  "description": "Forge LLM SDK",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
7
7
  "author": "Atlassian",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "dependencies": {
10
- "@forge/api": "^7.0.0-next.3"
10
+ "@forge/api": "^7.0.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "20.19.1",