Skip to content

Commit

Permalink
fix: linting working with commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
xavidop committed Oct 23, 2024
1 parent 6d6d8df commit d4c7c9f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ jobs:
uses: borales/actions-yarn@v5
with:
cmd: install --frozen-lockfile
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2
with:
version: '1.7'
force: 'true'
- name: 'Set type module'
run: |
which jq
jq --version
tmp=$(mktemp)
jq '.type = "module"' package.json > "$tmp" && mv "$tmp" package.json
- name: lint
uses: borales/actions-yarn@v5
with:
Expand Down
8 changes: 4 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
const globals = require("globals");
const pluginJs = require("@eslint/js");
const tseslint = require("typescript-eslint");


export default [
module.exports = [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.node }},
pluginJs.configs.recommended,
Expand Down
19 changes: 11 additions & 8 deletions src/github_llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,14 @@ function fromGithubChoice(
: "other",
message: {
role: "model",
content: (toolRequestParts?.length ?? 0) > 0
? (toolRequestParts as ToolRequestPart[])
: [
jsonMode
? { data: JSON.parse(choice.message.content!) }
: { text: choice.message.content! },
],
content:
(toolRequestParts?.length ?? 0) > 0
? (toolRequestParts as ToolRequestPart[])
: [
jsonMode
? { data: JSON.parse(choice.message.content!) }
: { text: choice.message.content! },
],
},
custom: {},
};
Expand Down Expand Up @@ -756,7 +757,9 @@ export function toGithubRequestBody(
`${response_format} format is not supported for GPT models currently`,
);
}
const modelString = (request.config?.version || model.version || modelName) as string;
const modelString = (request.config?.version ||
model.version ||
modelName) as string;
const body = {
body: {
messages: githubMessages,
Expand Down
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { genkitPlugin, Plugin } from "@genkit-ai/core";
import ModelClient from "@azure-rest/ai-inference";
import { AzureKeyCredential } from "@azure/core-auth";
import { microsoftPhi35MoE128kInstruct, cohereCommandR082024, cohereCommandRPlus082024, metaLlama3211bVisionInstruct, metaLlama3290bVisionInstruct } from './github_llms';
import {
microsoftPhi35MoE128kInstruct,
cohereCommandR082024,
cohereCommandRPlus082024,
metaLlama3211bVisionInstruct,
metaLlama3290bVisionInstruct,
} from "./github_llms";
import {
githubModel,
openAIGpt4o,
Expand Down Expand Up @@ -66,7 +72,7 @@ export {
microsoftPhi3Small128kInstruct,
microsoftPhi3Medium4kInstruct,
microsoftPhi35Mini128kInstruct,
microsoftPhi35MoE128kInstruct
microsoftPhi35MoE128kInstruct,
};

export {
Expand Down

0 comments on commit d4c7c9f

Please sign in to comment.