Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing finish reason. #35

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions samples/backend/js/expressjs/src/routes/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
AIChatCompletion,
AIChatCompletionDelta,
AIChatCompletionRequest,
AIChatFinishReason,
AIChatMessage,
AIChatRole,
} from "@microsoft/ai-chat-protocol";
Expand Down Expand Up @@ -86,7 +85,6 @@ chat.post("/", async (req: ChatRequest, res, next) => {

const completion: AIChatCompletion = {
message: responseMessage,
finishReason: choice.finishReason as AIChatFinishReason,
sessionState: req.sessionState,
};
res.json(completion);
Expand Down Expand Up @@ -118,7 +116,6 @@ chat.post(
role: (delta.role ?? undefined) as AIChatRole,
},
sessionState: req.sessionState,
finishReason: choice.finishReason as AIChatFinishReason,
};
responseMessage.role = completion.delta.role ?? responseMessage.role;
responseMessage.content += completion.delta.content ?? "";
Expand Down
1 change: 0 additions & 1 deletion sdk/js/packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export {
AIChatCompletionOperationOptions,
AIChatCompletionOptions,
AIChatCompletionRequest,
AIChatFinishReason,
AIChatMessage,
AIChatMessageDelta,
AIChatRole,
Expand Down
1 change: 0 additions & 1 deletion sdk/js/packages/client/src/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export {
AIChatCompletionOperationOptions,
AIChatCompletionOptions,
AIChatCompletionRequest,
AIChatFinishReason,
AIChatMessage,
AIChatMessageDelta,
AIChatRole,
Expand Down
4 changes: 0 additions & 4 deletions sdk/js/packages/client/src/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { ClientOptions, OperationOptions } from "@typespec/ts-http-runtime";

export type AIChatRole = "user" | "assistant" | "system";

export type AIChatFinishReason = "stop" | "length";

export interface AIChatMessage {
role: AIChatRole;
content: string;
Expand All @@ -23,14 +21,12 @@ export interface AIChatCompletion {
message: AIChatMessage;
sessionState?: unknown;
context?: object;
finishReason: AIChatFinishReason;
}

export interface AIChatCompletionDelta {
delta: AIChatMessageDelta;
sessionState?: unknown;
context?: object;
finishReason?: AIChatFinishReason;
}

export interface AIChatCompletionOptions {
Expand Down
7 changes: 0 additions & 7 deletions spec/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ enum AIChatRole {
system,
}

enum AIChatFinishReason {
stop,
length,
}

model AIChatMessage {
role: AIChatRole;
content: string;
Expand All @@ -35,7 +30,6 @@ model AIChatMessageDelta {

model AIChatCompletion {
message: AIChatMessage;
finishReason: AIChatFinishReason;
...ContextProp;
...SessionStateProp;
}
Expand All @@ -45,7 +39,6 @@ model AIChatCompletionDelta {
contentType: "application/x-ndjson";

delta: AIChatMessageDelta;
finisReason?: AIChatFinishReason;
...ContextProp;
...SessionStateProp;
}
Expand Down