Skip to content

Commit aa4f1e2

Browse files
committed
👌 IMPROVE: Types
1 parent c581434 commit aa4f1e2

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

packages/langbase/src/data/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export const GENERATION_ENDPOINTS = [
22
'/v1/pipes/run',
33
'/beta/chat',
44
'/beta/generate',
5-
'/v1/llm/run',
5+
'/v1/agent/run',
66
];

packages/langbase/src/langbase/langbase.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ export interface RunResponse {
8181
};
8282
}
8383

84+
export interface AgentRunResponse {
85+
output: string;
86+
threadId?: string;
87+
id: string;
88+
object: string;
89+
created: number;
90+
model: string;
91+
choices: ChoiceGenerate[];
92+
usage: Usage;
93+
system_fingerprint: string | null;
94+
rawResponse?: {
95+
headers: Record<string, string>;
96+
};
97+
}
98+
8499
export interface RunResponseStream {
85100
stream: ReadableStream<any>;
86101
threadId: string | null;
@@ -583,7 +598,7 @@ export class Langbase {
583598
public agent: {
584599
run: {
585600
(options: AgentRunOptionsStream): Promise<RunResponseStream>;
586-
(options: AgentRunOptions): Promise<RunResponse>;
601+
(options: AgentRunOptions): Promise<AgentRunResponse>;
587602
};
588603
};
589604

@@ -1094,11 +1109,11 @@ export class Langbase {
10941109
options: AgentRunOptionsStream,
10951110
): Promise<RunResponseStream>;
10961111

1097-
private async runAgent(options: AgentRunOptions): Promise<RunResponse>;
1112+
private async runAgent(options: AgentRunOptions): Promise<AgentRunResponse>;
10981113

10991114
private async runAgent(
11001115
options: AgentRunOptions | AgentRunOptionsStream,
1101-
): Promise<RunResponse | RunResponseStream> {
1116+
): Promise<AgentRunResponse | RunResponseStream> {
11021117
if (!options.apiKey) {
11031118
throw new Error('LLM API key is required to run this LLM.');
11041119
}

0 commit comments

Comments
 (0)