Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
0.4.203
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and fardjad committed Feb 7, 2024
1 parent 81147ce commit f614f7c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llmatic",
"version": "0.4.202",
"version": "0.4.203",
"description": "Use self-hosted LLMs with an OpenAI compatible API",
"exports": {
"./llm-adapter": {
Expand Down Expand Up @@ -86,9 +86,9 @@
"earl": "^1.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-xo": "^0.43.1",
"eslint-config-xo-typescript": "^1.0.1",
"eslint-plugin-unicorn": "^50.0.1",
"eslint-config-xo": "^0.44.0",
"eslint-config-xo-typescript": "^2.0.0",
"eslint-plugin-unicorn": "^51.0.1",
"http-status-codes": "^2.3.0",
"jsonpath-plus": "^8.0.0",
"nodemon": "^3.0.3",
Expand Down
8 changes: 2 additions & 6 deletions src/handlers/create-chat-completion.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,18 @@ export default class CreateChatCompletionHandler implements OperationHandler {
return;
}

if (choices[index] == null) {
choices[index] = {
choices[index] ??= {
index,
message: { role: Role.Assistant, content: "" },
};
}

choices[index].finish_reason = finishReason;

if (delta.role) {
choices[index].message!.role = delta.role;
}

if (choiceTokens[index] == null) {
choiceTokens[index] = [];
}
choiceTokens[index] ??= [];

if (delta.content) {
choiceTokens[index].push(delta.content);
Expand Down
8 changes: 2 additions & 6 deletions src/handlers/create-completion.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,12 @@ export default class CreateCompletionHandler implements OperationHandler {
return;
}

if (choices[index] == null) {
choices[index] = {
choices[index] ??= {
index,
};
}

choices[index].finish_reason = finishReason;
if (choiceTokens[index] == null) {
choiceTokens[index] = [];
}
choiceTokens[index] ??= [];

choiceTokens[index].push(text);
},
Expand Down

0 comments on commit f614f7c

Please sign in to comment.