Skip to content

Commit

Permalink
fix: lint and add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
xavidop committed Sep 10, 2024
1 parent 4283bb6 commit c5d52e4
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 17 deletions.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
_Before you submit a pull request, please make sure you have read and understood the [contribution guidelines](https://github.com/xavidop/genkitx-github/blob/main/CONTRIBUTING.md) and the [code of conduct](https://github.com/xavidop/genkitx-github/blob/main/CODE_OF_CONDUCT.md)._

**This pull request is related to:**

- [ ] A bug
- [ ] A new feature
- [ ] Documentation
- [ ] Other (please specify)

**I have checked the following:**

- [ ] I have read and understood the [contribution guidelines](https://github.com/xavidop/genkitx-github/blob/main/CONTRIBUTING.md) and the [code of conduct](https://github.com/xavidop/genkitx-github/blob/main/CODE_OF_CONDUCT.md);
- [ ] I have added new tests (for bug fixes/features);
- [ ] I have added/updated the documentation (for bug fixes / features).

**Description:**
Please provide a clear and concise description of the changes you are proposing here.

**Related issues:**
Please, link the related issues that this pull request will resolve here (if any).
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
labels:
- "github-actions"
- "dependencies"
schedule:
interval: daily
- package-ecosystem: "npm"
directory: "/"
labels:
- "npm"
- "dependencies"
schedule:
interval: daily
36 changes: 36 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a bug report to help us improve
title: ''
labels: bug
---

**Affected Model(s)**

- [ ] GPT-4o
- ...

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Use the model '...'
2. Provide the option '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Plugin(s) version:**
Provide the plugin(s) version in which you noticed the bug here.

**Genkit version:**
Provide the Genkit version you are using the plugin(s) with.

**Additional context**
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"generative-ai"
],
"version": "1.0.0",
"type": "commonjs",
"type": "module",
"main": "lib/cjs/index.js",
"module": "./dist/esm/index.mjs",
"module": "./lib/esm/index.mjs",
"repository": {
"type": "git",
"url": "git+https://github.com/xavidop/genkitx-github.git"
Expand Down
31 changes: 17 additions & 14 deletions src/github_llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-explicit-any */


import { Message } from "@genkit-ai/ai";
import {
Expand Down Expand Up @@ -204,7 +206,6 @@ export const mistralSmall = modelRef({
configSchema: GenerationCommonConfigSchema,
});


export const mistralLarge = modelRef({
name: "github/mistral-large",
info: {
Expand Down Expand Up @@ -463,29 +464,30 @@ export function toGithubMessages(
const msg = new Message(message);
const role = toGithubRole(message.role);
switch (role) {
case "user":
case "user": {
const textAndMedia = msg.content.map((part) =>
toGithubTextAndMedia(part, visualDetailLevel),
);
if (textAndMedia.length > 1){
if (textAndMedia.length > 1) {
githubMsgs.push({
role: role,
content: textAndMedia,
});
}else {
githubMsgs.push({
role: role,
content: msg.text(),
});
}
});
} else {
githubMsgs.push({
role: role,
content: msg.text(),
});
}
break;
}
case "system":
githubMsgs.push({
role: role,
content: msg.text(),
});
break;
case "assistant":
case "assistant": {
const toolCalls: ChatCompletionsToolCall[] = msg.content
.filter((part) => part.toolRequest)
.map((part) => {
Expand Down Expand Up @@ -515,7 +517,8 @@ export function toGithubMessages(
});
}
break;
case "tool":
}
case "tool": {
const toolResponseParts = msg.toolResponseParts();
toolResponseParts.map((part) => {
githubMsgs.push({
Expand All @@ -528,6 +531,7 @@ export function toGithubMessages(
});
});
break;
}
default:
throw new Error("unrecognized role");
}
Expand Down Expand Up @@ -587,7 +591,6 @@ function fromGithubChoice(
}

function fromGithubChunkChoice(choice: any): CandidateData {
choice.custom;
return {
index: choice.index,
finishReason: choice.content
Expand All @@ -598,7 +601,7 @@ function fromGithubChunkChoice(choice: any): CandidateData {
content: [{ text: choice.delta?.content ?? "" }],
},
custom: {},
};
} as CandidateData;
}

export function toGithubRequestBody(
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { genkitPlugin, GenkitError, Plugin } from "@genkit-ai/core";
import { genkitPlugin, Plugin } from "@genkit-ai/core";
import ModelClient from "@azure-rest/ai-inference";
import { AzureKeyCredential } from "@azure/core-auth";
import {
Expand Down

0 comments on commit c5d52e4

Please sign in to comment.