-
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 4aec71f
Showing
15 changed files
with
2,429 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,80 @@ | ||
# OpenAI Connector with Apollo API Function Calling | ||
|
||
This connector for Prompt Mixer allows you to access the OpenAI API and the Apollo API from within Prompt Mixer. | ||
|
||
## Features | ||
|
||
- Connect to the OpenAI API and use various models to generate text, code, and more. | ||
- Integrate with the Apollo API to search for contacts and retrieve detailed information. | ||
- 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: | ||
|
||
1. In Prompt Mixer, go to **Connectors > All Connectors**. | ||
2. Find the OpenAI Connector with Apollo API Function Calling and click **Install**. | ||
3. Go to **Connectors > Installed > OpenAI with Apollo API Function Calling** to configure your API keys. | ||
|
||
## Usage | ||
|
||
After installing and configuring your API keys, you can start using any OpenAI model and the Apollo API 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: [OpenAI Function Calling](https://platform.openai.com/docs/guides/function-calling) | ||
|
||
To test your functions, please fork this repository, then add and describe your functions. | ||
|
||
### Apollo API Integration | ||
|
||
The Apollo API allows you to search for contacts and retrieve detailed information. For more information, check the Apollo API documentation: [Apollo People API](https://apolloio.github.io/apollo-api-docs/?shell#people-api) | ||
|
||
## Step-by-Step Instructions | ||
|
||
### Configuring API Keys | ||
|
||
1. Open Prompt Mixer and navigate to **Connectors > Installed > OpenAI with Apollo API Function Calling**. | ||
2. Enter your OpenAI API key and Apollo API key in the respective fields. | ||
3. Click **Save** to apply the changes. | ||
|
||
### Using the Connector | ||
|
||
1. Open the assistant panel in Prompt Mixer. | ||
2. Select the OpenAI model you wish to use. | ||
3. Enter your prompt and any necessary settings. | ||
4. If using Apollo API functions, specify the required parameters. | ||
5. Click **Run** to execute the API call and view the output. | ||
|
||
## Troubleshooting and FAQs | ||
|
||
### Common Issues | ||
|
||
- **Invalid API Key**: Ensure that you have entered the correct API keys for both OpenAI and Apollo. | ||
- **Function Not Found**: Verify that the function name and parameters are correct. | ||
|
||
### Frequently Asked Questions | ||
|
||
1. **How do I get my OpenAI API key?** | ||
- Visit the OpenAI website and sign in to your account. Navigate to the API section to generate and copy your API key. | ||
|
||
2. **How do I get my Apollo API key?** | ||
- Visit the Apollo website and sign in to your account. Navigate to the API section to generate and copy your API key. | ||
|
||
3. **Can I use both OpenAI and Apollo APIs simultaneously?** | ||
- Yes, you can use both APIs simultaneously by specifying the functions and parameters for each API in your prompts. | ||
|
||
## Contributing | ||
|
||
Pull requests and issues are 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: [Prompt Mixer Custom Connector](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,90 @@ | ||
export const config = { | ||
connectorName: 'OpenAI with Apollo', | ||
connectorVersion: '1.0.0', | ||
models: [ | ||
'gpt-4o', | ||
'gpt-4-turbo', | ||
'gpt-3.5-turbo', | ||
], | ||
description: | ||
'OpenAI Connector with Apollo Search Function', | ||
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: 'OPENAI_API_KEY', | ||
name: 'OpenAI API Key', | ||
value: '', | ||
type: 'string', | ||
}, | ||
{ | ||
id: 'APOLLO_KEY', | ||
name: 'Apollo API Key', | ||
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.