Skip to content

Commit 4aec71f

Browse files
committed
init
0 parents  commit 4aec71f

15 files changed

+2429
-0
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
3+
main.js

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"env": { "node": true },
5+
"plugins": [
6+
"@typescript-eslint",
7+
"prettier"
8+
],
9+
"extends": [
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/eslint-recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"prettier"
14+
],
15+
"parserOptions": {
16+
"sourceType": "module"
17+
},
18+
"rules": {
19+
"no-unused-vars": "off",
20+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
21+
"@typescript-eslint/ban-ts-comment": "off",
22+
"no-prototype-builtins": "off",
23+
"@typescript-eslint/no-empty-function": "off",
24+
"prettier/prettier": "error"
25+
}
26+
}

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
releaseVersion:
10+
description: 'Release Version (e.g., v1.0.0)'
11+
required: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '21'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Create Release
32+
id: create_release
33+
uses: ncipollo/release-action@v1
34+
with:
35+
token: ${{ secrets.GH_TOKEN }}
36+
tag: ${{ github.event.inputs.releaseVersion || github.ref_name }}
37+
name: Release ${{ github.event.inputs.releaseVersion || github.ref_name }}
38+
draft: false
39+
prerelease: false
40+
artifacts: 'build/*'

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# vscode
2+
.vscode
3+
4+
# Intellij
5+
*.iml
6+
.idea
7+
8+
# npm
9+
node_modules
10+
11+
# Don't include the compiled main.js file in the repo.
12+
# They should be uploaded to GitHub releases instead.
13+
main.js
14+
15+
# Exclude sourcemaps
16+
*.map
17+
18+
# obsidian
19+
data.json
20+
21+
# Exclude macOS Finder (System Explorer) View States
22+
.DS_Store

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"tabWidth": 2,
6+
"printWidth": 80
7+
}

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# OpenAI Connector with Apollo API Function Calling
2+
3+
This connector for Prompt Mixer allows you to access the OpenAI API and the Apollo API from within Prompt Mixer.
4+
5+
## Features
6+
7+
- Connect to the OpenAI API and use various models to generate text, code, and more.
8+
- Integrate with the Apollo API to search for contacts and retrieve detailed information.
9+
- Pass prompts and settings to the OpenAI API with just a few clicks.
10+
- Output is displayed directly in Prompt Mixer.
11+
- Test OpenAI functions to ensure they work as expected.
12+
- Includes a testing function that simulates a database request returning a user list from the database.
13+
14+
## Installation
15+
16+
To install:
17+
18+
1. In Prompt Mixer, go to **Connectors > All Connectors**.
19+
2. Find the OpenAI Connector with Apollo API Function Calling and click **Install**.
20+
3. Go to **Connectors > Installed > OpenAI with Apollo API Function Calling** to configure your API keys.
21+
22+
## Usage
23+
24+
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.
25+
26+
### Function Calling
27+
28+
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.
29+
30+
For more details on how this works, consult the OpenAI documentation: [OpenAI Function Calling](https://platform.openai.com/docs/guides/function-calling)
31+
32+
To test your functions, please fork this repository, then add and describe your functions.
33+
34+
### Apollo API Integration
35+
36+
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)
37+
38+
## Step-by-Step Instructions
39+
40+
### Configuring API Keys
41+
42+
1. Open Prompt Mixer and navigate to **Connectors > Installed > OpenAI with Apollo API Function Calling**.
43+
2. Enter your OpenAI API key and Apollo API key in the respective fields.
44+
3. Click **Save** to apply the changes.
45+
46+
### Using the Connector
47+
48+
1. Open the assistant panel in Prompt Mixer.
49+
2. Select the OpenAI model you wish to use.
50+
3. Enter your prompt and any necessary settings.
51+
4. If using Apollo API functions, specify the required parameters.
52+
5. Click **Run** to execute the API call and view the output.
53+
54+
## Troubleshooting and FAQs
55+
56+
### Common Issues
57+
58+
- **Invalid API Key**: Ensure that you have entered the correct API keys for both OpenAI and Apollo.
59+
- **Function Not Found**: Verify that the function name and parameters are correct.
60+
61+
### Frequently Asked Questions
62+
63+
1. **How do I get my OpenAI API key?**
64+
- Visit the OpenAI website and sign in to your account. Navigate to the API section to generate and copy your API key.
65+
66+
2. **How do I get my Apollo API key?**
67+
- Visit the Apollo website and sign in to your account. Navigate to the API section to generate and copy your API key.
68+
69+
3. **Can I use both OpenAI and Apollo APIs simultaneously?**
70+
- Yes, you can use both APIs simultaneously by specifying the functions and parameters for each API in your prompts.
71+
72+
## Contributing
73+
74+
Pull requests and issues are welcome! Let me know if you have any problems using the connector or ideas for improvements.
75+
76+
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)
77+
78+
## License
79+
80+
MIT

config.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export interface ModelConfig {
2+
connectorName: string;
3+
models: string[];
4+
properties: Property[];
5+
settings: Setting[];
6+
iconBase64: string;
7+
description?: string;
8+
author?: string;
9+
}
10+
11+
export interface Property {
12+
id: string;
13+
name: string;
14+
value: string | number | boolean | string[];
15+
type: 'string' | 'number' | 'boolean' | 'array';
16+
}
17+
18+
export interface Setting {
19+
id: string;
20+
name: string;
21+
value: string;
22+
type: 'string';
23+
}
24+
25+
export declare const config: ModelConfig;

config.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
export const config = {
2+
connectorName: 'OpenAI with Apollo',
3+
connectorVersion: '1.0.0',
4+
models: [
5+
'gpt-4o',
6+
'gpt-4-turbo',
7+
'gpt-3.5-turbo',
8+
],
9+
description:
10+
'OpenAI Connector with Apollo Search Function',
11+
author: 'Prompt Mixer',
12+
properties: [
13+
{
14+
id: 'prompt',
15+
name: 'System Prompt',
16+
value: 'You are a helpful assistant.',
17+
type: 'string',
18+
},
19+
{
20+
id: 'max_tokens',
21+
name: 'Max Tokens',
22+
value: 4096,
23+
type: 'number',
24+
},
25+
{
26+
id: 'temperature',
27+
name: 'Temperature',
28+
value: 0.7,
29+
type: 'number',
30+
},
31+
{
32+
id: 'top_p',
33+
name: 'Top P',
34+
value: 1,
35+
type: 'number',
36+
},
37+
{
38+
id: 'frequency_penalty',
39+
name: 'Frequency Penalty',
40+
value: 0.5,
41+
type: 'number',
42+
},
43+
{
44+
id: 'presence_penalty',
45+
name: 'Presence Penalty',
46+
value: 0.5,
47+
type: 'number',
48+
},
49+
{
50+
id: 'stop',
51+
name: 'Stop Sequences',
52+
value: ['\n'],
53+
type: 'array',
54+
},
55+
{
56+
id: 'echo',
57+
name: 'Echo',
58+
value: false,
59+
type: 'boolean',
60+
},
61+
{
62+
id: 'best_of',
63+
name: 'Best Of',
64+
value: 1,
65+
type: 'number',
66+
},
67+
{
68+
id: 'logprobs',
69+
name: 'LogProbs',
70+
value: false,
71+
type: 'boolean',
72+
},
73+
],
74+
settings: [
75+
{
76+
id: 'OPENAI_API_KEY',
77+
name: 'OpenAI API Key',
78+
value: '',
79+
type: 'string',
80+
},
81+
{
82+
id: 'APOLLO_KEY',
83+
name: 'Apollo API Key',
84+
value: '',
85+
type: 'string',
86+
},
87+
],
88+
iconBase64:
89+
'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',
90+
};

esbuild.config.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import esbuild from 'esbuild';
2+
import process from 'process';
3+
4+
const prod = process.argv[2] === 'production';
5+
6+
const context = await esbuild.context({
7+
entryPoints: ['main.ts'],
8+
bundle: true,
9+
platform: 'node',
10+
target: 'es2022',
11+
outfile: './build/main.js',
12+
});
13+
14+
if (prod) {
15+
await context.rebuild();
16+
process.exit(0);
17+
} else {
18+
await context.watch();
19+
}

0 commit comments

Comments
 (0)