Skip to content

Commit

Permalink
Task: Add function calling to OAI streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
zya committed Nov 7, 2023
1 parent 4a2f394 commit 0944f92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/handlers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function* toStreamingResponse(
delta: {
content: openAIChoice.delta.content,
role: openAIChoice.delta.role,
function_call: openAIChoice.delta.function_call,
},
index: openAIChoice.index,
finish_reason: openAIChoice.finish_reason,
Expand Down
11 changes: 10 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@ export interface ConsistentResponseChoice {
message: {
role: string | null | undefined;
content: string | null | undefined;
function_call?: {
arguments: string;
name: string;
};
};
}

export interface ConsistentResponseStreamingChoice
extends Omit<ConsistentResponseChoice, 'message'> {
delta: ConsistentResponseChoice['message'];
delta: Omit<ConsistentResponseChoice['message'], 'function_call'> & {
function_call?: {
arguments?: string;
name?: string;
};
};
}

export interface ConsistentResponseUsage {
Expand Down

0 comments on commit 0944f92

Please sign in to comment.