Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatyss committed Apr 17, 2024
0 parents commit b427f83
Show file tree
Hide file tree
Showing 15 changed files with 2,427 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
"prettier/prettier": "error"
}
}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
40 changes: 40 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release Version (e.g., v1.0.0)'
required: true

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '21'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag: ${{ github.event.inputs.releaseVersion || github.ref_name }}
name: Release ${{ github.event.inputs.releaseVersion || github.ref_name }}
draft: false
prerelease: false
artifacts: 'build/*'
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vscode
.vscode

# Intellij
*.iml
.idea

# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js

# Exclude sourcemaps
*.map

# obsidian
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 80
}
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OpenAI Github Connector for Prompt Mixer
This connector includes functions to connect and retrieve information from Github using OpenAI models.

## Features
- Connect to the Github API and access various data such as repositories, issues, and user information
- Pass queries and settings to the Github API with just a few clicks
- Output is displayed directly in Prompt Mixer
- Test Github functions to ensure they work as expected

## Installation
To install:
- In Prompt Mixer go to Connectors > All Connectors
- Go to Connectors > Installed > OpenAI Github Connector to configure your OpenAI API key and Github token

## Usage
After installing and configuring your API key, you can start using the Github connector through the assistant panel in Prompt Mixer.

### Function Calling
During an API call, you can specify functions which the model will use to intelligently generate a JSON object. This object contains the necessary arguments for calling one or several functions. Note that the Chat Completions API will not execute these functions; it merely creates the JSON for you to use in your function calls within your own code.

For more details on how this works, consult the Github API documentation: https://docs.github.com/en/rest

To test your functions, please fork this repository, then add and describe your functions.

## Contributing
Pull requests and issues welcome! Let me know if you have any problems using the connector or ideas for improvements.

For guidance on building your own connector, refer to this documentation: https://docs.promptmixer.dev/tutorial-extras/create-a-custom-connector

## License
MIT
25 changes: 25 additions & 0 deletions config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export interface ModelConfig {
connectorName: string;
models: string[];
properties: Property[];
settings: Setting[];
iconBase64: string;
description?: string;
author?: string;
}

export interface Property {
id: string;
name: string;
value: string | number | boolean | string[];
type: 'string' | 'number' | 'boolean' | 'array';
}

export interface Setting {
id: string;
name: string;
value: string;
type: 'string';
}

export declare const config: ModelConfig;
103 changes: 103 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
export const config = {
connectorName: 'OpenAI Github Connector',
connectorVersion: '1.0.0',
models: [
'gpt-4-turbo',
'gpt-4-turbo-2024-04-09',
'gpt-4-0125-preview',
'gpt-4-turbo-preview',
'gpt-4-vision-preview',
'gpt-4-1106-vision-preview',
'gpt-4-1106-preview',
'gpt-4',
'gpt-4-32k',
'gpt-3.5-turbo-0125',
'gpt-3.5-turbo-1106',
'gpt-3.5-turbo',
'gpt-3.5-turbo-instruct',
'gpt-3.5-turbo-16k',
'gpt-3.5-turbo-0613',
'gpt-3.5-turbo-16k-0613'
],
description:
'This connector includes functions to connect and retrieve information from Github using OpenAI models.',
author: 'Prompt Mixer',
properties: [
{
id: 'prompt',
name: 'System Prompt',
value: 'You are a helpful assistant.',
type: 'string',
},
{
id: 'max_tokens',
name: 'Max Tokens',
value: 4096,
type: 'number',
},
{
id: 'temperature',
name: 'Temperature',
value: 0.7,
type: 'number',
},
{
id: 'top_p',
name: 'Top P',
value: 1,
type: 'number',
},
{
id: 'frequency_penalty',
name: 'Frequency Penalty',
value: 0.5,
type: 'number',
},
{
id: 'presence_penalty',
name: 'Presence Penalty',
value: 0.5,
type: 'number',
},
{
id: 'stop',
name: 'Stop Sequences',
value: ['\n'],
type: 'array',
},
{
id: 'echo',
name: 'Echo',
value: false,
type: 'boolean',
},
{
id: 'best_of',
name: 'Best Of',
value: 1,
type: 'number',
},
{
id: 'logprobs',
name: 'LogProbs',
value: false,
type: 'boolean',
},
],
settings: [
{
id: 'API_KEY',
name: 'OpenAI API Key',
value: '',
type: 'string',
},
{
id: 'GH_TOKEN',
name: 'Github Token',
value: '',
type: 'string',
},
],
iconBase64:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAILSURBVHgB1ZPNceJAEIX5O8BNIUAEy0aAHIHZCCwisLgBF8yFv4tFBJYzsCNARLA4grUjMCcKqAL2e1s9WzLCrvLNVtXUTP/odb83PbncV//y7wU6nU41n8/fsvzj8ejhWu73+8F0On3IfRbQwOYAPWJGm81mValUAs63+BLlsD+RE43H4+cPAcMw9Pj5juTVcDhsWQEf+47jC0CxYpybrAb2RRr0DWC32w1J7ouiEnEpUeBV7BY/JioYRZEAc71e7wZ/YzQaXWQA6SIwsJbRreEOWB5AodMUu260B+oM0NfD4fDTdVlwgIVC4ZpEJSXprklOAOsD9of4TJ2T+yJbfkur/sdxBxLrbG/A9BWLRXW1YP0SAwo00VZUa9g1m4DnDKAJXXU2I+JZoX/aodODGFDgEq3nhHx8Afs9/jADSGXRuXQgpVJJM9g47ZjYAn9b3ZodI8GVi5fcoVwuR9vt9hVd1NmA6rG7dV2I0RLIguIr/O5X+b0MIMPribYEp6oEl073hJZ26zP2mWmd/nzlZCjToTT01ut15AQXkG6fXWMR4v+RRtLAE9frmTnf6WDPobOcTCZt2W6I0y+FPTTtfouRLgp5orOAqTecAPxIdWlzZS9FMxpbXp9YHTYt92rOAjpQkgMAfHM1GKH2breLkUU6X+Nrnr7hdwHPFBDdGwEbxSdWcA7se3x/AeZhVUbFkV5NAAAAAElFTkSuQmCC',
};
19 changes: 19 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import esbuild from 'esbuild';
import process from 'process';

const prod = process.argv[2] === 'production';

const context = await esbuild.context({
entryPoints: ['main.ts'],
bundle: true,
platform: 'node',
target: 'es2018',
outfile: './build/main.js',
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
Loading

0 comments on commit b427f83

Please sign in to comment.