-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ab9b6f
Showing
15 changed files
with
2,548 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
|
||
main.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Prompt Mixer OpenAI with Function calling Connector | ||
|
||
This is a connector for Prompt Mixer that allows you to access the OpenAI API from within Prompt Mixer. It includes a testing function that simulates a database request returning a user list from the database. | ||
|
||
## Features | ||
- Connect to the OpenAI API and use various models to generate text, code, images, and more | ||
- Pass prompts and settings to the OpenAI API with just a few clicks | ||
- Output is displayed directly in Prompt Mixer | ||
- Test OpenAI functions to ensure they work as expected | ||
- Includes a testing function that simulates a database request returning a user list from the database | ||
|
||
## Installation | ||
To install: | ||
|
||
- In Prompt Mixer go to Connectors > All Connectors | ||
- Go to Connectors > Installed > OpenAI with Function calling to configure your API key | ||
|
||
## Usage | ||
After installing and configuring your API key, you can start using any OpenAI model 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 OpenAI documentation: https://platform.openai.com/docs/guides/function-calling | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
export const config = { | ||
connectorName: 'OpenAI SQL Functions Connector', | ||
connectorVersion: '1.0.1', | ||
models: [ | ||
'gpt-4o', | ||
'gpt-4o-2024-05-13', | ||
'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: | ||
'OpenAI Connector with a testing function that simulates a database request returning a user list from the database', | ||
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: 'API Key', | ||
value: '', | ||
type: 'string', | ||
}, | ||
{ | ||
id: 'CONNECTION_STRING', | ||
name: 'Connection String', | ||
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', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'es2022', | ||
outfile: './build/main.js', | ||
}); | ||
|
||
if (prod) { | ||
await context.rebuild(); | ||
process.exit(0); | ||
} else { | ||
await context.watch(); | ||
} |
Oops, something went wrong.