Skip to content

Commit

Permalink
fix: undo change
Browse files Browse the repository at this point in the history
  • Loading branch information
xavidop committed Nov 19, 2024
1 parent d40812f commit 20785b4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/github_llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,19 @@ export function toGithubRequestBody(
if (!model) throw new Error(`Unsupported model: ${modelName}`);
const githubMessages = toGithubMessages(request.messages);

const jsonMode =
request.output?.format === "json" ||
request.output?.contentType === "application/json";

const textMode =
request.output?.format === "text" ||
request.output?.contentType === "plain/text";

let responseFormat;
const response_format = request.output?.format;
if (response_format === "json" && model.info.supports?.output?.includes("json")) {
const response_format = request.output?.format
? request.output?.format
: request.output?.contentType;
if (jsonMode && model.info.supports?.output?.includes("json")) {
responseFormat = {
type: "json_object",
};
Expand All @@ -743,7 +753,7 @@ export function toGithubRequestBody(
content: "Write it in JSON",
} as ChatRequestSystemMessage);
} else if (
(response_format === "text" && model.info.supports?.output?.includes("text")) ||
(textMode && model.info.supports?.output?.includes("text")) ||
model.info.supports?.output?.includes("text")
) {
responseFormat = {
Expand Down

0 comments on commit 20785b4

Please sign in to comment.