Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ChatGPT Plugins/OpenAPI specs for Plugins Endpoint #620

Merged
merged 33 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
152e20a
wip: proof of concept for openapi chain
danny-avila Jul 5, 2023
ddfb2ee
chore(api): update langchain dependency to version 0.0.105
danny-avila Jul 9, 2023
a9c8c36
feat(Plugins): use ChatGPT Plugins/OpenAPI specs (first pass)
danny-avila Jul 10, 2023
985553c
chore(manifest.json): update pluginKey for "Browser" tool to "web-bro…
danny-avila Jul 10, 2023
75ae5c8
fix(handleSubmit.js): set unfinished property to false for all endpoints
danny-avila Jul 10, 2023
1d7e33a
fix(handlers.js): remove unnecessary capitalizeWords function and use…
danny-avila Jul 10, 2023
1c7280d
feat(endpoints): add plugins selector to endpoints file
danny-avila Jul 10, 2023
0b9aedf
fix(OpenAPIPlugin.js): rename readYamlFile function to readSpecFile
danny-avila Jul 10, 2023
7dd27f9
feat(api): add new tools
danny-avila Jul 11, 2023
4bacbfa
feat(PluginsClient.js): import findMessageContent function from utils
danny-avila Jul 11, 2023
9b869d4
fix(PluginStoreDialog.tsx): update z-index value for the dialog conta…
danny-avila Jul 11, 2023
04238b0
chore(web_pilot.json): add "params" field with "user_has_request" par…
danny-avila Jul 11, 2023
44d2728
chore(eslintrc.js): update eslint rules
danny-avila Jul 12, 2023
d6fa947
fix(package-lock.json): update langchain dependency to version ^0.0.105
danny-avila Jul 12, 2023
a694305
fix(OpenAPIPlugin.js): change header key from 'id' to 'librechat_user…
danny-avila Jul 12, 2023
4af56a1
fix(OpenAPIPlugin.js): update SUFFIX variable to provide a clearer de…
danny-avila Jul 12, 2023
2289b84
feat(PluginsClient.js): sendIntermediateMessage on successful Agent load
danny-avila Jul 12, 2023
425f306
Update chatgpt_plugins_openapi.md
danny-avila Jul 13, 2023
2dc4220
chore: rebuild package-lock file
danny-avila Jul 14, 2023
ab9a88d
chore: format/lint all files with new rules
danny-avila Jul 14, 2023
c981102
chore: format all files
danny-avila Jul 14, 2023
0bc6f71
chore(README.md): update AI model selection list
danny-avila Jul 14, 2023
5863f08
fix(Plugin.tsx): type issue
danny-avila Jul 14, 2023
e3e9f07
feat(tools): add new tool WebPilot
danny-avila Jul 14, 2023
33f6aab
feat(OpenAPIPlugin.js): add getSpec and readSpecFile functions
danny-avila Jul 14, 2023
6772438
chore(agent-demo-1.js): remove unused code and dependencies
danny-avila Jul 14, 2023
65824d4
feat(addOpenAPISpecs): add function to transform OpenAPI specs into d…
danny-avila Jul 14, 2023
4722289
feat(loadSpecs.spec.js): add unit tests for ManifestDefinition, valid…
danny-avila Jul 14, 2023
2ba240e
fix: package file resolution bug
danny-avila Jul 14, 2023
1ae0348
chore: move scholarly_graph_link manifest to 'has-issues'
danny-avila Jul 14, 2023
f67ae4a
refactor(client/hooks): convert to TS and export from index
danny-avila Jul 15, 2023
dbcc3ef
Update introduction.md
danny-avila Jul 15, 2023
1b552be
Update chatgpt_plugins_openapi.md
danny-avila Jul 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(addOpenAPISpecs): add function to transform OpenAPI specs into d…
…esired format

feat(addOpenAPISpecs.spec): add tests for transformSpec function
fix(loadSpecs): remove debugging code
  • Loading branch information
danny-avila committed Jul 15, 2023
commit 65824d4b3fc47d1ffce4e993e851f7ef8faca4c9
1 change: 1 addition & 0 deletions api/app/clients/tools/util/addOpenAPISpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ async function addOpenAPISpecs(availableTools) {
}

module.exports = {
transformSpec,
addOpenAPISpecs,
};
76 changes: 76 additions & 0 deletions api/app/clients/tools/util/addOpenAPISpecs.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const { addOpenAPISpecs, transformSpec } = require('./addOpenAPISpecs');
const { loadSpecs } = require('./loadSpecs');
const { createOpenAPIPlugin } = require('../dynamic/OpenAPIPlugin');

jest.mock('./loadSpecs');
jest.mock('../dynamic/OpenAPIPlugin');

describe('transformSpec', () => {
it('should transform input spec to a desired format', () => {
const input = {
name_for_human: 'Human Name',
name_for_model: 'Model Name',
description_for_human: 'Human Description',
logo_url: 'https://example.com/logo.png',
};

const expectedOutput = {
name: 'Human Name',
pluginKey: 'Model Name',
description: 'Human Description',
icon: 'https://example.com/logo.png',
isAuthRequired: 'false',
authConfig: [],
};

expect(transformSpec(input)).toEqual(expectedOutput);
});

it('should use default icon if logo_url is not provided', () => {
const input = {
name_for_human: 'Human Name',
name_for_model: 'Model Name',
description_for_human: 'Human Description',
};

const expectedOutput = {
name: 'Human Name',
pluginKey: 'Model Name',
description: 'Human Description',
icon: 'https://placehold.co/70x70.png',
isAuthRequired: 'false',
authConfig: [],
};

expect(transformSpec(input)).toEqual(expectedOutput);
});
});

describe('addOpenAPISpecs', () => {
it('should add specs to available tools', async () => {
const availableTools = ['Tool1', 'Tool2'];
const specs = [
{
name_for_human: 'Human Name',
name_for_model: 'Model Name',
description_for_human: 'Human Description',
logo_url: 'https://example.com/logo.png',
},
];

loadSpecs.mockResolvedValue(specs);
createOpenAPIPlugin.mockReturnValue('Plugin');

const result = await addOpenAPISpecs(availableTools);
expect(result).toEqual([...specs.map(transformSpec), ...availableTools]);
});

it('should return available tools if specs loading fails', async () => {
const availableTools = ['Tool1', 'Tool2'];

loadSpecs.mockRejectedValue(new Error('Failed to load specs'));

const result = await addOpenAPISpecs(availableTools);
expect(result).toEqual(availableTools);
});
});
3 changes: 0 additions & 3 deletions api/app/clients/tools/util/loadSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,3 @@ module.exports = {
validateJson,
ManifestDefinition,
};

// debugging
// loadSpecs({ llm: { hi: 'hello' }, map: true, verbose: true }).catch(console.error);