Skip to content

Commit 527bceb

Browse files
committed
fix: export ClaudeMessageParam and CallModelInput types
- Export all Claude message types from models/index.ts and src/index.ts - Export CallModelInput type from call-model.ts - Simplify sdk.ts callModel signature to use CallModelInput type - Remove unused imports from sdk.ts Fixes TypeScript compilation errors in CI
1 parent 6a99a7a commit 527bceb

File tree

4 files changed

+39
-12
lines changed

4 files changed

+39
-12
lines changed

src/funcs/call-model.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import type * as models from "../models/index.js";
66
import { ModelResult } from "../lib/model-result.js";
77
import { convertToolsToAPIFormat } from "../lib/tool-executor.js";
88

9-
9+
/**
10+
* Input type for callModel function
11+
*/
12+
export type CallModelInput = Omit<models.OpenResponsesRequest, "stream" | "tools"> & {
13+
tools?: Tool[];
14+
maxToolRounds?: MaxToolRounds;
15+
};
1016

1117
/**
1218
* Get a response with multiple consumption patterns
@@ -33,10 +39,7 @@ import { convertToolsToAPIFormat } from "../lib/tool-executor.js";
3339
*/
3440
export function callModel(
3541
client: OpenRouterCore,
36-
request: Omit<models.OpenResponsesRequest, "stream" | "tools"> & {
37-
tools?: Tool[];
38-
maxToolRounds?: MaxToolRounds;
39-
},
42+
request: CallModelInput,
4043
options?: RequestOptions
4144
): ModelResult {
4245
const { tools, maxToolRounds, ...apiRequest } = request;

src/index.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,34 @@ export * from "./sdk/sdk.js";
1212
export { fromClaudeMessages, toClaudeMessage } from "./lib/anthropic-compat.js";
1313
export { fromChatMessages, toChatMessage } from "./lib/chat-compat.js";
1414

15+
// Claude message types
16+
export type {
17+
ClaudeMessage,
18+
ClaudeMessageParam,
19+
ClaudeContentBlock,
20+
ClaudeContentBlockParam,
21+
ClaudeTextBlock,
22+
ClaudeThinkingBlock,
23+
ClaudeRedactedThinkingBlock,
24+
ClaudeToolUseBlock,
25+
ClaudeServerToolUseBlock,
26+
ClaudeTextBlockParam,
27+
ClaudeImageBlockParam,
28+
ClaudeToolUseBlockParam,
29+
ClaudeToolResultBlockParam,
30+
ClaudeStopReason,
31+
ClaudeUsage,
32+
ClaudeCacheControl,
33+
ClaudeTextCitation,
34+
ClaudeCitationCharLocation,
35+
ClaudeCitationPageLocation,
36+
ClaudeCitationContentBlockLocation,
37+
ClaudeCitationWebSearchResultLocation,
38+
ClaudeCitationSearchResultLocation,
39+
ClaudeBase64ImageSource,
40+
ClaudeURLImageSource,
41+
} from "./models/claude-message.js";
42+
1543
// Tool creation helpers
1644
export { tool, createTool, createGeneratorTool, createManualTool } from "./lib/tool.js";
1745

src/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,4 @@ export * from "./usermessage.js";
155155
export * from "./websearchengine.js";
156156
export * from "./websearchpreviewtooluserlocation.js";
157157
export * from "./websearchstatus.js";
158+
export * from "./claude-message.js";

src/sdk/sdk.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import {
2424
} from "../funcs/call-model.js";
2525
import type { ModelResult } from "../lib/model-result.js";
2626
import type { RequestOptions } from "../lib/sdks.js";
27-
import { type MaxToolRounds, Tool, ToolType } from "../lib/tool-types.js";
28-
import type { OpenResponsesRequest } from "../models/openresponsesrequest.js";
27+
import { type MaxToolRounds, ToolType } from "../lib/tool-types.js";
2928

3029
export { ToolType };
3130
export type { MaxToolRounds };
@@ -99,11 +98,7 @@ export class OpenRouter extends ClientSDK {
9998

10099
// #region sdk-class-body
101100
callModel(
102-
request: Omit<OpenResponsesRequest, "stream" | "tools" | "input"> & {
103-
input?: CallModelInput;
104-
tools?: Tool[];
105-
maxToolRounds?: MaxToolRounds;
106-
},
101+
request: CallModelInput,
107102
options?: RequestOptions,
108103
): ModelResult {
109104
return callModelFunc(this, request, options);

0 commit comments

Comments
 (0)