Text-to-SQL proof of concept (#5788)

Added:
- An "Ask AI" command to the command menu.
- A simple GraphQL resolver that converts the user's question into a
relevant SQL query using an LLM, runs the query, and returns the result.

<img width="428" alt="Screenshot 2024-06-09 at 20 53 09"
src="https://github.com/twentyhq/twenty/assets/171685816/57127f37-d4a6-498d-b253-733ffa0d209f">

No security concerns have been addressed, this is only a
proof-of-concept and not intended to be enabled in production.

All changes are behind a feature flag called `IS_ASK_AI_ENABLED`.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
ad-elias
2024-07-04 08:57:26 +02:00
committed by GitHub
parent 25fce27fe3
commit 4c642a0bb8
46 changed files with 1463 additions and 40 deletions

View File

@ -15,6 +15,8 @@
},
"dependencies": {
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga-nestjs-npm-2.1.0-cb509e6047.patch",
"@langchain/mistralai": "^0.0.24",
"@langchain/openai": "^0.1.3",
"@nestjs/cache-manager": "^2.2.1",
"@nestjs/devtools-integration": "^0.1.6",
"@nestjs/graphql": "patch:@nestjs/graphql@12.1.1#./patches/@nestjs+graphql+12.1.1.patch",
@ -25,13 +27,16 @@
"graphql-middleware": "^6.1.35",
"jsdom": "~22.1.0",
"jwt-decode": "^4.0.0",
"langchain": "^0.2.6",
"langfuse-langchain": "^3.11.2",
"lodash.differencewith": "^4.5.0",
"lodash.omitby": "^4.6.0",
"lodash.uniq": "^4.5.0",
"lodash.uniqby": "^4.7.0",
"passport": "^0.7.0",
"psl": "^1.9.0",
"tsconfig-paths": "^4.2.0"
"tsconfig-paths": "^4.2.0",
"zod-to-json-schema": "^3.23.1"
},
"devDependencies": {
"@nestjs/cli": "10.3.0",