diff --git a/README.md b/README.md index 8e0f518f7..c78c5a42f 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Now you can open the browser of your choice and open `http://127.0.0.1:8000`. - OpenAI - Anthropic -- Google (Gemini, PaLM2) +- Google Gemini - DeepSeek - HuggingFace (Inference and Endpoints) - Together.ai diff --git a/chainforge/react-server/package-lock.json b/chainforge/react-server/package-lock.json index 64621179e..57ab72576 100644 --- a/chainforge/react-server/package-lock.json +++ b/chainforge/react-server/package-lock.json @@ -15,8 +15,7 @@ "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", "@fontsource/geist-mono": "^5.0.1", - "@google-ai/generativelanguage": "^0.2.0", - "@google/generative-ai": "^0.21.0", + "@google/genai": "^1.19.0", "@mantine/core": "^6.0.9", "@mantine/dates": "^6.0.13", "@mantine/dropzone": "^6.0.19", @@ -68,7 +67,7 @@ "lz-string": "^1.5.0", "mantine-contextmenu": "^6.1.0", "mantine-react-table": "^1.3.4", - "markdown-it": "^13.0.1", + "markdown-it": "^13.0.2", "mathjs": "^11.8.2", "mdast-util-from-markdown": "^2.0.0", "net": "^1.0.2", @@ -110,6 +109,7 @@ "devDependencies": { "@craco/craco": "^7.1.0", "@types/lodash": "^4.17.0", + "@types/markdown-it": "^14.1.2", "@types/papaparse": "^5.3.14", "@types/react-beautiful-dnd": "^13.1.8", "@types/react-edit-text": "^5.0.4", @@ -3776,52 +3776,140 @@ "node": ">=16.15" } }, - "node_modules/@google-ai/generativelanguage": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@google-ai/generativelanguage/-/generativelanguage-0.2.1.tgz", - "integrity": "sha512-oqEQScnGO6UoEqdKMIGiRfLWNpc83RtLWcO/g/VH3+2PnqIwEqJThDAMCHmRZ9B3zUiiL2cd4FaHx3ZU93CXEA==", + "node_modules/@google/genai": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.19.0.tgz", + "integrity": "sha512-mIMV3M/KfzzFA//0fziK472wKBJ1TdJLhozIUJKTPLyTDN1NotU+hyoHW/N0cfrcEWUK20YA0GxCeHC4z0SbMA==", "dependencies": { - "google-gax": "^3.5.8" + "google-auth-library": "^9.14.2", + "ws": "^8.18.0" }, "engines": { - "node": ">=12.0.0" + "node": ">=20.0.0" + }, + "peerDependencies": { + "@modelcontextprotocol/sdk": "^1.11.4" + }, + "peerDependenciesMeta": { + "@modelcontextprotocol/sdk": { + "optional": true + } } }, - "node_modules/@google/generative-ai": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@google/generative-ai/-/generative-ai-0.21.0.tgz", - "integrity": "sha512-7XhUbtnlkSEZK15kN3t+tzIMxsbKm/dSkKBFalj+20NvPKe1kBY7mR2P7vuijEn+f06z5+A8bVGKO0v39cr6Wg==", + "node_modules/@google/genai/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", "engines": { - "node": ">=18.0.0" + "node": ">= 14" } }, - "node_modules/@grpc/grpc-js": { - "version": "1.8.21", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.21.tgz", - "integrity": "sha512-KeyQeZpxeEBSqFVTi3q2K7PiPXmgBfECc4updA1ejCLjYmoAlvvM3ZMp5ztTDUCUQmoY3CpDxvchjO1+rFkoHg==", + "node_modules/@google/genai/node_modules/gaxios": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", + "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==", + "license": "Apache-2.0", "dependencies": { - "@grpc/proto-loader": "^0.7.0", - "@types/node": ">=12.12.47" + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "is-stream": "^2.0.0", + "node-fetch": "^2.6.9", + "uuid": "^9.0.1" }, "engines": { - "node": "^8.13.0 || >=10.10.0" + "node": ">=14" } }, - "node_modules/@grpc/proto-loader": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", - "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", + "node_modules/@google/genai/node_modules/gcp-metadata": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", + "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", + "license": "Apache-2.0", "dependencies": { - "lodash.camelcase": "^4.3.0", - "long": "^5.0.0", - "protobufjs": "^7.2.4", - "yargs": "^17.7.2" + "gaxios": "^6.1.1", + "google-logging-utils": "^0.0.2", + "json-bigint": "^1.0.0" }, - "bin": { - "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + "engines": { + "node": ">=14" + } + }, + "node_modules/@google/genai/node_modules/google-auth-library": { + "version": "9.15.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", + "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^6.1.1", + "gcp-metadata": "^6.1.0", + "gtoken": "^7.0.0", + "jws": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=14" + } + }, + "node_modules/@google/genai/node_modules/gtoken": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", + "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", + "license": "MIT", + "dependencies": { + "gaxios": "^6.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google/genai/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@google/genai/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@google/genai/node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/@humanwhocodes/config-array": { @@ -4426,17 +4514,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@jsdoc/salty": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.5.tgz", - "integrity": "sha512-TfRP53RqunNe2HBobVBJ0VLhK1HbfvBYeTC1ahnN64PWvyYyGebmMiPkuwvD9fpw2ZbkoPb8Q7mwy0aR8Z9rvw==", - "dependencies": { - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=v12.0.0" - } - }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", @@ -4902,60 +4979,6 @@ "url": "https://opencollective.com/popperjs" } }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, "node_modules/@radix-ui/number": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.0.tgz", @@ -6801,15 +6824,6 @@ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.11.tgz", "integrity": "sha512-L7A0AINMXQpVwxHJ4jxD6/XjZ4NDufaRlUJHjNIFKYUFBH1SvOW+neaqb0VTRSLW5suSrSu19ObFEFnfNcr+qg==" }, - "node_modules/@types/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", - "dependencies": { - "@types/minimatch": "^5.1.2", - "@types/node": "*" - } - }, "node_modules/@types/graceful-fs": { "version": "4.1.7", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.7.tgz", @@ -6910,9 +6924,10 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" }, "node_modules/@types/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-pTjcqY9E4nOI55Wgpz7eiI8+LzdYnw3qxXCfHyBDdPbYvbyLgWLJGh8EdPvqawwMK1Uo1794AUkkR38Fr0g+2g==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "dev": true }, "node_modules/@types/lodash": { "version": "4.17.0", @@ -6920,18 +6935,14 @@ "integrity": "sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==", "dev": true }, - "node_modules/@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" - }, "node_modules/@types/markdown-it": { - "version": "12.2.3", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", - "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "dev": true, "dependencies": { - "@types/linkify-it": "*", - "@types/mdurl": "*" + "@types/linkify-it": "^5", + "@types/mdurl": "^2" } }, "node_modules/@types/mdast": { @@ -6943,20 +6954,16 @@ } }, "node_modules/@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "dev": true }, "node_modules/@types/mime": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==" - }, "node_modules/@types/ms": { "version": "0.7.34", "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", @@ -7082,15 +7089,6 @@ "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" }, - "node_modules/@types/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==", - "dependencies": { - "@types/glob": "*", - "@types/node": "*" - } - }, "node_modules/@types/scheduler": { "version": "0.16.3", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", @@ -7673,17 +7671,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, "node_modules/abs-svg-path": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/abs-svg-path/-/abs-svg-path-0.1.1.tgz", @@ -9123,17 +9110,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" }, - "node_modules/catharsis": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", - "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", - "dependencies": { - "lodash": "^4.17.15" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/cfb": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", @@ -9290,19 +9266,6 @@ "node": ">=0.10.0" } }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/clone-deep": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", @@ -11110,17 +11073,6 @@ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" }, - "node_modules/duplexify": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", - "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", - "dependencies": { - "end-of-stream": "^1.4.1", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1", - "stream-shift": "^1.0.0" - } - }, "node_modules/earcut": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", @@ -12415,14 +12367,6 @@ "node": ">= 0.6" } }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "engines": { - "node": ">=6" - } - }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -13842,33 +13786,13 @@ "node": ">=12" } }, - "node_modules/google-gax": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-3.6.1.tgz", - "integrity": "sha512-g/lcUjGcB6DSw2HxgEmCDOrI/CByOwqRvsuUvNalHUK2iPPPlmAIpbMbl62u0YufGMr8zgE3JL7th6dCb1Ry+w==", - "dependencies": { - "@grpc/grpc-js": "~1.8.0", - "@grpc/proto-loader": "^0.7.0", - "@types/long": "^4.0.0", - "@types/rimraf": "^3.0.2", - "abort-controller": "^3.0.0", - "duplexify": "^4.0.0", - "fast-text-encoding": "^1.0.3", - "google-auth-library": "^8.0.2", - "is-stream-ended": "^0.1.4", - "node-fetch": "^2.6.1", - "object-hash": "^3.0.0", - "proto3-json-serializer": "^1.0.0", - "protobufjs": "7.2.4", - "protobufjs-cli": "1.1.1", - "retry-request": "^5.0.0" - }, - "bin": { - "compileProtos": "build/tools/compileProtos.js", - "minifyProtoJson": "build/tools/minify.js" - }, + "node_modules/google-logging-utils": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", + "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/google-p12-pem": { @@ -15021,11 +14945,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-stream-ended": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-stream-ended/-/is-stream-ended-0.1.4.tgz", - "integrity": "sha512-xj0XPvmr7bQFTvirqnFr50o0hQIh6ZItDqloxt5aJrR4NQsYeSsyFQERYGCAzfindAcnKjINnwEEgLx4IqVzQw==" - }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -16816,91 +16735,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/js2xmlparser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", - "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", - "dependencies": { - "xmlcreate": "^2.0.4" - } - }, "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, - "node_modules/jsdoc": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.2.tgz", - "integrity": "sha512-e8cIg2z62InH7azBBi3EsSEqrKx+nUtAS5bBcYTSpZFA+vhNPyhv8PTFZ0WsjOPDj04/dOLlm08EDcQJDqaGQg==", - "dependencies": { - "@babel/parser": "^7.20.15", - "@jsdoc/salty": "^0.2.1", - "@types/markdown-it": "^12.2.3", - "bluebird": "^3.7.2", - "catharsis": "^0.9.0", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.2", - "klaw": "^3.0.0", - "markdown-it": "^12.3.2", - "markdown-it-anchor": "^8.4.1", - "marked": "^4.0.10", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "underscore": "~1.13.2" - }, - "bin": { - "jsdoc": "jsdoc.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/jsdoc/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/jsdoc/node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/jsdoc/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/jsdoc/node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", - "dependencies": { - "uc.micro": "^1.0.1" - } - }, - "node_modules/jsdoc/node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", - "dependencies": { - "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, "node_modules/jsdom": { "version": "16.7.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", @@ -17480,14 +17319,6 @@ "node": ">=0.10.0" } }, - "node_modules/klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dependencies": { - "graceful-fs": "^4.1.9" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -17622,11 +17453,6 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -17662,11 +17488,6 @@ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==" }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -17831,9 +17652,9 @@ } }, "node_modules/markdown-it": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", - "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", + "integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", "dependencies": { "argparse": "^2.0.1", "entities": "~3.0.1", @@ -17845,15 +17666,6 @@ "markdown-it": "bin/markdown-it.js" } }, - "node_modules/markdown-it-anchor": { - "version": "8.6.7", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", - "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", - "peerDependencies": { - "@types/markdown-it": "*", - "markdown-it": "*" - } - }, "node_modules/markdown-it/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -17870,17 +17682,6 @@ "react": ">= 0.14.0" } }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 12" - } - }, "node_modules/math-log2": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/math-log2/-/math-log2-1.0.1.tgz", @@ -18589,17 +18390,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/mouse-change": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/mouse-change/-/mouse-change-1.4.0.tgz", @@ -20904,189 +20694,6 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, - "node_modules/proto3-json-serializer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/proto3-json-serializer/-/proto3-json-serializer-1.1.1.tgz", - "integrity": "sha512-AwAuY4g9nxx0u52DnSMkqqgyLHaW/XaPLtaAo3y/ZCfeaQB/g4YDH4kb8Wc/mWzWvu0YjOznVnfn373MVZZrgw==", - "dependencies": { - "protobufjs": "^7.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/protobufjs": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", - "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/protobufjs-cli": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/protobufjs-cli/-/protobufjs-cli-1.1.1.tgz", - "integrity": "sha512-VPWMgIcRNyQwWUv8OLPyGQ/0lQY/QTQAVN5fh+XzfDwsVw1FZ2L3DM/bcBf8WPiRz2tNpaov9lPZfNcmNo6LXA==", - "dependencies": { - "chalk": "^4.0.0", - "escodegen": "^1.13.0", - "espree": "^9.0.0", - "estraverse": "^5.1.0", - "glob": "^8.0.0", - "jsdoc": "^4.0.0", - "minimist": "^1.2.0", - "semver": "^7.1.2", - "tmp": "^0.2.1", - "uglify-js": "^3.7.7" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "protobufjs": "^7.0.0" - } - }, - "node_modules/protobufjs-cli/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/protobufjs-cli/node_modules/escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=4.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/protobufjs-cli/node_modules/escodegen/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/protobufjs-cli/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/protobufjs-cli/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/protobufjs-cli/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/protobufjs-cli/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/protobufjs-cli/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/protobufjs-cli/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/protobufjs-cli/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/protocol-buffers-schema": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", @@ -22138,14 +21745,6 @@ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, - "node_modules/requizzle": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", - "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", - "dependencies": { - "lodash": "^4.17.21" - } - }, "node_modules/resolve": { "version": "1.22.6", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz", @@ -22269,18 +21868,6 @@ "node": ">= 4" } }, - "node_modules/retry-request": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-5.0.2.tgz", - "integrity": "sha512-wfI3pk7EE80lCIXprqh7ym48IHYdwmAAzESdbU8Q9l7pnRCk9LEhpbOTNKjz6FARLm/Bl5m+4F0ABxOkYUujSQ==", - "dependencies": { - "debug": "^4.1.1", - "extend": "^3.0.2" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -24152,17 +23739,6 @@ "resolved": "https://registry.npmjs.org/tls/-/tls-0.0.1.tgz", "integrity": "sha512-GzHpG+hwupY8VMR6rYsnAhTHqT/97zT45PG8WD5eTT1lq+dFE0nN+1PYpsoBcHJgSmTz5ceK2Cv88IkPmIPOtQ==" }, - "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dependencies": { - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=8.17.0" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -24569,17 +24145,6 @@ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -24594,11 +24159,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" - }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -25916,11 +25476,6 @@ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" }, - "node_modules/xmlcreate": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==" - }, "node_modules/xmlhttprequest-ssl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", @@ -25958,31 +25513,6 @@ "node": ">= 6" } }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "engines": { - "node": ">=12" - } - }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/chainforge/react-server/package.json b/chainforge/react-server/package.json index 229a67686..d47badb9f 100644 --- a/chainforge/react-server/package.json +++ b/chainforge/react-server/package.json @@ -13,8 +13,7 @@ "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", "@fontsource/geist-mono": "^5.0.1", - "@google-ai/generativelanguage": "^0.2.0", - "@google/generative-ai": "^0.21.0", + "@google/genai": "^1.19.0", "@mantine/core": "^6.0.9", "@mantine/dates": "^6.0.13", "@mantine/dropzone": "^6.0.19", @@ -66,7 +65,7 @@ "lz-string": "^1.5.0", "mantine-contextmenu": "^6.1.0", "mantine-react-table": "^1.3.4", - "markdown-it": "^13.0.1", + "markdown-it": "^13.0.2", "mathjs": "^11.8.2", "mdast-util-from-markdown": "^2.0.0", "net": "^1.0.2", @@ -136,6 +135,7 @@ "devDependencies": { "@craco/craco": "^7.1.0", "@types/lodash": "^4.17.0", + "@types/markdown-it": "^14.1.2", "@types/papaparse": "^5.3.14", "@types/react-beautiful-dnd": "^13.1.8", "@types/react-edit-text": "^5.0.4", diff --git a/chainforge/react-server/src/App.tsx b/chainforge/react-server/src/App.tsx index 29ca12e53..e1b5a4f54 100644 --- a/chainforge/react-server/src/App.tsx +++ b/chainforge/react-server/src/App.tsx @@ -106,10 +106,12 @@ import { // Device / Browser detection import { isMobile, + isTablet, isChrome, isFirefox, isEdgeChromium, isChromium, + isMobileSafari, } from "react-device-detect"; import MultiEvalNode from "./MultiEvalNode"; import FlowSidebar from "./FlowSidebar"; @@ -117,7 +119,6 @@ import NestedMenu, { NestedMenuItemProps } from "./NestedMenu"; import RequestClarificationModal, { RequestClarificationModalProps, } from "./RequestClarificationModal"; -import { xorBy } from "lodash"; const IS_ACCEPTED_BROWSER = (isChrome || @@ -125,7 +126,7 @@ const IS_ACCEPTED_BROWSER = isEdgeChromium || isFirefox || (navigator as any)?.brave !== undefined) && - !isMobile; + (!isMobile || (isTablet && !isMobileSafari)); // Whether we are running on localhost or not, and hence whether // we have access to the Flask backend for, e.g., Python code evaluation. @@ -185,13 +186,13 @@ const INITIAL_LLM = () => { // Prefer OpenAI for majority of local users. const chatgpt = { key: uuid(), - name: "GPT3.5", + name: "GPT-4o-mini", emoji: "🤖", - model: "gpt-3.5-turbo", - base_model: "gpt-3.5-turbo", + model: "gpt-4o-mini", + base_model: "gpt-4", temp: 1.0, - settings: getDefaultModelSettings("gpt-3.5-turbo"), - formData: getDefaultModelFormData("gpt-3.5-turbo"), + settings: getDefaultModelSettings("gpt-4"), + formData: getDefaultModelFormData("gpt-4"), } satisfies LLMSpec; chatgpt.formData.shortname = chatgpt.name; chatgpt.formData.model = chatgpt.model; diff --git a/chainforge/react-server/src/GlobalSettingsModal.tsx b/chainforge/react-server/src/GlobalSettingsModal.tsx index 3ad756560..7593b8ff0 100644 --- a/chainforge/react-server/src/GlobalSettingsModal.tsx +++ b/chainforge/react-server/src/GlobalSettingsModal.tsx @@ -537,7 +537,7 @@ const GlobalSettingsModal = forwardRef(

diff --git a/chainforge/react-server/src/ModelSettingSchemas.tsx b/chainforge/react-server/src/ModelSettingSchemas.tsx index 51138d7eb..e53d2431c 100644 --- a/chainforge/react-server/src/ModelSettingSchemas.tsx +++ b/chainforge/react-server/src/ModelSettingSchemas.tsx @@ -91,7 +91,7 @@ const ChatGPTSettings: ModelSettingsDict = { "text-davinci-002", "code-davinci-002", ], - default: "gpt-3.5-turbo", + default: "gpt-4o-mini", }, system_msg: { type: "string", @@ -318,18 +318,18 @@ const GPT4Settings: ModelSettingsDict = { title: "Nickname", description: "Unique identifier to appear in ChainForge. Keep it short.", - default: "GPT-4o", + default: "GPT-4o-mini", }, model: { ...ChatGPTSettings.schema.properties.model, - default: "gpt-4o", + default: "gpt-4o-mini", }, }, }, uiSchema: { ...ChatGPTSettings.uiSchema, model: { - "ui:help": "Defaults to gpt-4o.", + "ui:help": "Defaults to gpt-4o-mini.", "ui:widget": "datalist", }, }, @@ -833,7 +833,7 @@ const ClaudeSettings: ModelSettingsDict = { }, }; -const PaLM2Settings: ModelSettingsDict = { +const Gemini25Settings: ModelSettingsDict = { fullName: "Google AI Models (Gemini)", schema: { type: "object", @@ -850,30 +850,29 @@ const PaLM2Settings: ModelSettingsDict = { type: "string", title: "Model", description: - "Select a PaLM model to query. For more details on the differences, see the Google PaLM API documentation.", + "Select a Gemini model to query. For more details on the differences, see the Google Gemini API documentation.", enum: [ - "gemini-2.5-pro-preview-03-25", + "gemini-2.5-pro", + "gemini-2.5-flash", + "gemini-2.5-flash-lite", "gemini-2.0-flash", "gemini-2.0-flash-lite", - "gemini-1.5-flash", - "gemini-1.5-flash-8b", - "gemini-1.5-pro", - "gemini-1.0-pro", - "gemini-pro", - "text-bison-001", - "chat-bison-001", + "gemini-embedding-001", + "text-embedding-005", + "text-embedding-004", + "text-multilingual-embedding-002", ], - default: "gemini-1.5-flash", + default: "gemini-2.5-flash", shortname_map: { - "text-bison-001": "PaLM2-text", - "chat-bison-001": "PaLM2-chat", - "gemini-pro": "Gemini 1.0", - "gemini-2.5-pro-preview-03-25": "Gemini 2.5", + "gemini-2.5-pro": "Gemini 2.5 Pro", + "gemini-2.5-flash": "Gemini 2.5 Flash", + "gemini-2.5-flash-lite": "Gemini 2.5 Flash Lite", "gemini-2.0-flash": "Gemini 2.0 Flash", - "gemini-1.5-pro": "Gemini 1.5", - "gemini-1.0-pro": "Gemini 1.0", - "gemini-1.5-flash": "Gemini Flash", - "gemini-1.5-flash-8b": "Gemini Flash 8B", + "gemini-2.0-flash-lite": "Gemini 2.0 Flash Lite", + "gemini-embedding-001": "gemini-embedding-001", + "text-embedding-005": "text-embedding-005", + "text-embedding-004": "text-embedding-004", + "text-multilingual-embedding-002": "text-multilingual-embedding-002", }, }, system_msg: { @@ -887,17 +886,17 @@ const PaLM2Settings: ModelSettingsDict = { type: "number", title: "temperature", description: - "Controls the randomness of the output. Must be positive. Typical values are in the range: [0.0, 1.0]. Higher values produce a more random and varied response. A temperature of zero will be deterministic. (ChainForge only allows a max 1.0 temperature for PaLM).", - default: 0.5, + "Controls the randomness of the output. Must be positive. Typical values are in the range: [0.0, 1.0]. Higher values produce a more random and varied response. A temperature of zero will be deterministic.", + default: 0.7, minimum: 0, - maximum: 1, + maximum: 2, multipleOf: 0.01, }, top_k: { type: "integer", title: "top_k", description: - "Sets the maximum number of tokens to sample from on each step. (The PaLM API uses combined nucleus and top-k sampling.) Set to -1 to use the default value.", + "Sets the maximum number of tokens to sample from on each step. (The Gemini API uses combined nucleus and top-k sampling.) Set to -1 to use the default value.", minimum: -1, default: -1, }, @@ -905,7 +904,7 @@ const PaLM2Settings: ModelSettingsDict = { type: "number", title: "top_p", description: - "Sets the maximum cumulative probability of tokens to sample from. (The PaLM API uses combined nucleus and top-k sampling.) Set to -1 to use the default value.", + "Sets the maximum cumulative probability of tokens to sample from. (The Gemini API uses combined nucleus and top-k sampling.) Set to -1 to use the default value.", default: -1, minimum: -1, maximum: 1, @@ -935,14 +934,14 @@ const PaLM2Settings: ModelSettingsDict = { "ui:autofocus": true, }, model: { - "ui:help": "Defaults to gemini-pro.", + "ui:help": "Defaults to gemini-2.5-flash.", "ui:widget": "datalist", }, system_msg: { "ui:widget": "textarea", }, temperature: { - "ui:help": "Defaults to 0.5.", + "ui:help": "Defaults to 0.7.", "ui:widget": "range", }, max_output_tokens: { @@ -2481,7 +2480,7 @@ export const ModelSettings: Dict = { "dall-e": DalleSettings, "gpt-image-1": GPTImage1Settings, "claude-v1": ClaudeSettings, - "palm2-bison": PaLM2Settings, + "gemini-2.5": Gemini25Settings, "azure-openai": AzureOpenAISettings, hf: HuggingFaceTextInferenceSettings, "luminous-base": AlephAlphaLuminousSettings, @@ -2508,7 +2507,7 @@ export function baseModelToProvider(base_model: string): LLMProvider { "dall-e": LLMProvider.OpenAI, "gpt-image-1": LLMProvider.OpenAI, "claude-v1": LLMProvider.Anthropic, - "palm2-bison": LLMProvider.Google, + "gemini-2.5": LLMProvider.Google, "azure-openai": LLMProvider.Azure_OpenAI, hf: LLMProvider.HuggingFace, "luminous-base": LLMProvider.Aleph_Alpha, @@ -2537,7 +2536,7 @@ export function getSettingsSchemaForLLM( } = { [LLMProvider.OpenAI]: GPT4Settings, [LLMProvider.Anthropic]: ClaudeSettings, - [LLMProvider.Google]: PaLM2Settings, + [LLMProvider.Google]: Gemini25Settings, [LLMProvider.Azure_OpenAI]: AzureOpenAISettings, [LLMProvider.HuggingFace]: HuggingFaceTextInferenceSettings, [LLMProvider.Aleph_Alpha]: AlephAlphaLuminousSettings, diff --git a/chainforge/react-server/src/backend/__test__/backend.test.ts b/chainforge/react-server/src/backend/__test__/backend.test.ts index 04dc4ed93..dbbf76da8 100644 --- a/chainforge/react-server/src/backend/__test__/backend.test.ts +++ b/chainforge/react-server/src/backend/__test__/backend.test.ts @@ -68,7 +68,7 @@ test("call three LLMs with a single prompt", async () => { const llms = [ NativeLLM.OpenAI_ChatGPT, NativeLLM.Claude_v1, - NativeLLM.PaLM2_Chat_Bison, + NativeLLM.GEMINI_v2_5_flash, ]; const n = 1; const progress_listener = (progress: { [key: symbol]: any }) => { diff --git a/chainforge/react-server/src/backend/__test__/query.test.ts b/chainforge/react-server/src/backend/__test__/query.test.ts index 1373aa1cc..9e6439186 100644 --- a/chainforge/react-server/src/backend/__test__/query.test.ts +++ b/chainforge/react-server/src/backend/__test__/query.test.ts @@ -94,6 +94,6 @@ test("basic prompt pipeline with anthropic", async () => { await prompt_model(NativeLLM.Claude_v1, LLMProvider.Anthropic); }, 40000); -test("basic prompt pipeline with google palm2", async () => { - await prompt_model(NativeLLM.PaLM2_Chat_Bison, LLMProvider.Google); +test("basic prompt pipeline with google gemini 2.5 flash", async () => { + await prompt_model(NativeLLM.GEMINI_v2_5_flash, LLMProvider.Google); }, 40000); diff --git a/chainforge/react-server/src/backend/__test__/utils.test.ts b/chainforge/react-server/src/backend/__test__/utils.test.ts index 43aac93ad..09bb0d7c1 100644 --- a/chainforge/react-server/src/backend/__test__/utils.test.ts +++ b/chainforge/react-server/src/backend/__test__/utils.test.ts @@ -5,7 +5,6 @@ import { call_alephalpha, call_anthropic, call_chatgpt, - call_google_palm, extract_responses, merge_response_objs, } from "../utils"; @@ -116,48 +115,6 @@ test("anthropic models", async () => { expect(typeof resps[0]).toBe("string"); }, 20000); -test("google palm2 models", async () => { - // Call Google's PaLM Chat API with a basic question - let [query, response] = await call_google_palm( - "Who invented modern playing cards?", - NativeLLM.PaLM2_Chat_Bison, - 3, - 0.7, - ); - expect(response.candidates).toHaveLength(3); - expect(query).toHaveProperty("candidateCount"); - - // Extract responses, check their type - let resps = extract_responses( - response, - NativeLLM.PaLM2_Chat_Bison, - LLMProvider.Google, - ); - expect(resps).toHaveLength(3); - expect(typeof resps[0]).toBe("string"); - console.log(JSON.stringify(resps)); - - // Call Google's PaLM Text Completions API with a basic question - [query, response] = await call_google_palm( - "Who invented modern playing cards? The answer ", - NativeLLM.PaLM2_Text_Bison, - 3, - 0.7, - ); - expect(response.candidates).toHaveLength(3); - expect(query).toHaveProperty("maxOutputTokens"); - - // Extract responses, check their type - resps = extract_responses( - response, - NativeLLM.PaLM2_Chat_Bison, - LLMProvider.Google, - ); - expect(resps).toHaveLength(3); - expect(typeof resps[0]).toBe("string"); - console.log(JSON.stringify(resps)); -}, 40000); - test("aleph alpha model", async () => { let [query, response] = await call_alephalpha( "Who invented modern playing cards?", @@ -177,7 +134,6 @@ test("aleph alpha model", async () => { expect(typeof resps[0]).toBe("string"); console.log(JSON.stringify(resps)); - // Call Google's PaLM Text Completions API with a basic question // eslint-disable-next-line [query, response] = await call_alephalpha( "Who invented modern playing cards? The answer ", diff --git a/chainforge/react-server/src/backend/models.ts b/chainforge/react-server/src/backend/models.ts index efd972bcb..f938509a8 100644 --- a/chainforge/react-server/src/backend/models.ts +++ b/chainforge/react-server/src/backend/models.ts @@ -74,16 +74,14 @@ export enum NativeLLM { Claude_v1_instant = "claude-instant-v1", // Google models - PaLM2_Text_Bison = "text-bison-001", // it's really models/text-bison-001, but that's confusing - PaLM2_Chat_Bison = "chat-bison-001", - GEMINI_PRO = "gemini-pro", - GEMINI_v2_5_pro_prev = "gemini-2.5-pro-preview-03-25", + GEMINI_v2_5_pro = "gemini-2.5-pro", + GEMINI_v2_5_flash = "gemini-2.5-flash", + GEMINI_v2_5_flash_lite = "gemini-2.5-flash-lite", GEMINI_v2_flash = "gemini-2.0-flash", GEMINI_v2_flash_lite = "gemini-2.0-flash-lite", GEMINI_v1_5_flash = "gemini-1.5-flash", GEMINI_v1_5_flash_8B = "gemini-1.5-flash-8b", GEMINI_v1_5_pro = "gemini-1.5-pro", - GEMINI_v1_pro = "gemini-1.0-pro", // DeepSeek DeepSeek_Chat = "deepseek-chat", @@ -253,8 +251,7 @@ export function getProvider(llm: LLM): LLMProvider | undefined { const llm_name = getEnumName(NativeLLM, llm.toString()); if (llm_name?.startsWith("OpenAI")) return LLMProvider.OpenAI; else if (llm_name?.startsWith("Azure")) return LLMProvider.Azure_OpenAI; - else if (llm_name?.startsWith("PaLM2") || llm_name?.startsWith("GEMINI")) - return LLMProvider.Google; + else if (llm_name?.startsWith("GEMINI")) return LLMProvider.Google; else if (llm_name?.startsWith("HF_")) return LLMProvider.HuggingFace; else if (llm.toString().startsWith("claude")) return LLMProvider.Anthropic; else if (llm_name?.startsWith("Aleph_Alpha")) return LLMProvider.Aleph_Alpha; @@ -290,9 +287,9 @@ export const RATE_LIMIT_BY_MODEL: { [key in LLM]?: number } = { [NativeLLM.OpenAI_DallE_2]: 10, // Should be 5 images per minute (1 img per every 10 seconds); here, we've been a bit lenient with it. [NativeLLM.OpenAI_DallE_3]: 10, // This differs per tier, see https://platform.openai.com/docs/guides/rate-limits/usage-tiers?context=tier-one [NativeLLM.Azure_OpenAI]: 500, // conservative - [NativeLLM.PaLM2_Text_Bison]: 60, // max 60 requests per minute as of Mar 2023 - [NativeLLM.PaLM2_Chat_Bison]: 60, - [NativeLLM.GEMINI_PRO]: 60, + [NativeLLM.GEMINI_v2_5_pro]: 150, + [NativeLLM.GEMINI_v2_5_flash]: 1000, + [NativeLLM.GEMINI_v2_5_flash_lite]: 4000, [NativeLLM.Bedrock_Jurassic_Mid]: 400, [NativeLLM.Bedrock_Jurassic_Ultra]: 25, [NativeLLM.Bedrock_Titan_Light]: 800, diff --git a/chainforge/react-server/src/backend/typing.ts b/chainforge/react-server/src/backend/typing.ts index 2559782db..4b10e7280 100644 --- a/chainforge/react-server/src/backend/typing.ts +++ b/chainforge/react-server/src/backend/typing.ts @@ -110,17 +110,6 @@ export interface ChatMessage { } export type ChatHistory = ChatMessage[]; -/** Google PaLM chat message format */ -export interface PaLMChatMessage { - author: string; // usually, 0=user and 1=AI - content: string; -} -export interface PaLMChatContext { - messages: PaLMChatMessage[]; - context?: string; - examples?: Dict[]; -} - export interface GeminiChatMessage { role: string; parts: [{ text: string }]; diff --git a/chainforge/react-server/src/backend/utils.ts b/chainforge/react-server/src/backend/utils.ts index 887f8b22c..db4520322 100644 --- a/chainforge/react-server/src/backend/utils.ts +++ b/chainforge/react-server/src/backend/utils.ts @@ -11,8 +11,6 @@ import { RawLLMResponseObject, ChatHistory, ChatMessage, - PaLMChatMessage, - PaLMChatContext, HuggingFaceChatHistory, GeminiChatContext, GeminiChatMessage, @@ -46,7 +44,11 @@ import { OpenAIClient as AzureOpenAIClient, AzureKeyCredential, } from "@azure/openai"; -import { GoogleGenerativeAI, Part } from "@google/generative-ai"; +import { + GenerateContentConfig, + GoogleGenAI, + PartListUnion, +} from "@google/genai"; import { UserForcedPrematureExit } from "./errors"; import { fromModelId, @@ -894,7 +896,7 @@ export async function call_anthropic( } /** - * Calls a Google PaLM/Gemini model, based on the model selection from the user. + * Calls a Google Gemini model, based on the model selection from the user. * Returns raw query and response JSON dicts. */ export async function call_google_ai( @@ -905,188 +907,24 @@ export async function call_google_ai( params?: Dict, should_cancel?: () => boolean, images?: string[], -): Promise<[Dict, Dict]> { - if ( - model === NativeLLM.PaLM2_Chat_Bison || - model === NativeLLM.PaLM2_Text_Bison - ) - return call_google_palm( - prompt, - model, - n, - temperature, - params, - should_cancel, - images, - ); - else - return call_google_gemini( - prompt, - model, - n, - temperature, - params, - should_cancel, - images, - ); -} - -/** - * Calls a Google PaLM model. - * Returns raw query and response JSON dicts. - */ -export async function call_google_palm( - prompt: string, - model: LLM, - n = 1, - temperature = 0.7, - params?: Dict, - should_cancel?: () => boolean, - images?: string[], -): Promise<[Dict, Dict]> { - if (!GOOGLE_PALM_API_KEY) - throw new Error( - "Could not find an API key for Google PaLM models. Double-check that your API key is set in Settings or in your local environment.", - ); - const is_chat_model = model.toString().includes("chat"); - - // Required non-standard params - const max_output_tokens = params?.max_output_tokens || 800; - const chat_history = params?.chat_history; - delete params?.chat_history; - - const query: Dict = { - model: `models/${model}`, - candidate_count: n, - temperature, - max_output_tokens, - ...params, - }; - - // Remove erroneous parameters for text and chat models - if (query.top_k !== undefined && query.top_k <= 0) delete query.top_k; - if (query.top_p !== undefined && query.top_p <= 0) delete query.top_p; - if (is_chat_model && query.max_output_tokens !== undefined) - delete query.max_output_tokens; - if (is_chat_model && query.stop_sequences !== undefined) - delete query.stop_sequences; - - // For some reason Google needs to be special and have its API params be different names --camel or snake-case - // --depending on if it's the Python or Node JS API. ChainForge needs a consistent name, so we must convert snake to camel: - const casemap = { - safety_settings: "safetySettings", - stop_sequences: "stopSequences", - candidate_count: "candidateCount", - max_output_tokens: "maxOutputTokens", - top_p: "topP", - top_k: "topK", - }; - Object.entries(casemap).forEach(([key, val]) => { - if (key in query) { - query[val] = query[key]; - delete query[key]; - } - }); - - if (is_chat_model) { - // Chat completions - if (chat_history !== undefined && chat_history.length > 0) { - // Carry over any chat history, converting OpenAI formatted chat history to Google PaLM: - const palm_chat_context: PaLMChatContext = { messages: [] }; - const palm_messages: PaLMChatMessage[] = []; - for (const chat_msg of chat_history) { - if (chat_msg.role === "system") { - // Carry the system message over as PaLM's chat 'context': - palm_chat_context.context = chat_msg.content; - } else if (chat_msg.role === "user") { - palm_messages.push({ author: "0", content: chat_msg.content }); - } else palm_messages.push({ author: "1", content: chat_msg.content }); - } - palm_messages.push({ author: "0", content: prompt }); - palm_chat_context.messages = palm_messages; - query.prompt = palm_chat_context; - } else { - query.prompt = { messages: [{ content: prompt }] }; - } - } else { - // Text completions - query.prompt = { text: prompt }; - } - - console.log( - `Calling Google PaLM model '${model}' with prompt '${prompt}' (n=${n}). Please be patient...`, - ); - - // Call the correct model client - const method = is_chat_model ? "generateMessage" : "generateText"; - const url = `https://generativelanguage.googleapis.com/v1beta2/models/${model}:${method}?key=${GOOGLE_PALM_API_KEY}`; - const headers = { "Content-Type": "application/json" }; - const res = await fetch(url, { - method: "POST", - headers, - body: JSON.stringify(query), - }); - const completion: Dict = await res.json(); - - // Sometimes the REST call will give us an error; bubble this up the chain: - if (completion.error !== undefined) { - throw new Error(JSON.stringify(completion.error)); - } - - // Google PaLM, unlike other chat models, will output empty - // responses for any response it deems unsafe (blocks). Although the text completions - // API has a (relatively undocumented) 'safety_settings' parameter, - // the current chat completions API provides users no control over the blocking. - // We need to detect this and fill the response with the safety reasoning: - if (completion.filters && completion.filters.length > 0) { - // Request was blocked. Output why in the response text, repairing the candidate dict to mock up 'n' responses - const block_error_msg = `[[BLOCKED_REQUEST]] Request was blocked because it triggered safety filters: ${JSON.stringify( - completion.filters, - )}`; - completion.candidates = new Array(n).fill({ - author: "1", - content: block_error_msg, - }); - } - - // Weirdly, google ignores candidate_count if temperature is 0. - // We have to check for this and manually append the n-1 responses: - if (n > 1 && completion.candidates?.length === 1) { - completion.candidates = new Array(n).fill(completion.candidates[0]); - } - - return [query, completion]; -} - -export async function call_google_gemini( - prompt: string, - model: LLM, - n = 1, - temperature = 0.7, - params?: Dict, - should_cancel?: () => boolean, - images?: string[], ): Promise<[Dict, Dict]> { if (!GOOGLE_PALM_API_KEY) throw new Error( "Could not find an API key for Google Gemini models. Double-check that your API key is set in Settings or in your local environment.", ); - // Required non-standard params const max_output_tokens = params?.max_output_tokens || 1000; const chat_history: ChatHistory = params?.chat_history; const system_msg = params?.system_msg; delete params?.chat_history; delete params?.system_msg; - const genAI = new GoogleGenerativeAI(GOOGLE_PALM_API_KEY); - const gemini_model = genAI.getGenerativeModel({ - model: model.toString(), - systemInstruction: - typeof system_msg === "string" && chat_history === undefined - ? system_msg - : undefined, - }); + const gemini_client = new GoogleGenAI({ apiKey: GOOGLE_PALM_API_KEY }); + + const gemini_config: GenerateContentConfig = { + candidateCount: 1, + systemInstruction: system_msg, + }; const query: Dict = { model: `models/${model}`, @@ -1098,7 +936,7 @@ export async function call_google_gemini( // For some reason Google needs to be special and have its API params be different names --camel or snake-case // --depending on if it's the Python or Node JS API. ChainForge needs a consistent name, so we must convert snake to camel: - const casemap = { + const casemap: Record = { safety_settings: "safetySettings", stop_sequences: "stopSequences", candidate_count: "candidateCount", @@ -1107,53 +945,53 @@ export async function call_google_gemini( top_k: "topK", }; - const gen_Config: Dict = { candidateCount: 1 }; - Object.entries(casemap).forEach(([key, val]) => { if (key in query) { - gen_Config[val] = query[key]; - query[val] = query[key]; + gemini_config[val] = query[key]; + query[val as string | number] = query[key]; delete query[key]; } }); - // Gemini only supports candidate_count of 1 - gen_Config.candidateCount = 1; + gemini_config.candidateCount = 1; // Gemini only supports 1 candidate - // By default for topK is none, and topP is 1.0 - if ("topK" in gen_Config && gen_Config.topK === -1) { - delete gen_Config.topK; + // -1 is not a sensible value, so assume default is intended + if ("topK" in gemini_config && gemini_config.topK === -1) { + delete gemini_config.topK; } - if ("topP" in gen_Config && gen_Config.topP === -1) { - gen_Config.topP = 1.0; + if ("topP" in gemini_config && gemini_config.topP === -1) { + gemini_config.topP = 1.0; } - const gemini_chat_context: GeminiChatContext = { history: [] }; + const gemini_chat_history: GeminiChatContext = { history: [] }; + + const openai_gemini_role_map: Record = { + user: "user", + assistant: "model", + system: "model", + }; // Chat completions if (chat_history !== undefined && chat_history.length > 0) { - // Carry over any chat history, converting OpenAI formatted chat history to Google PaLM: - - const gemini_messages: GeminiChatMessage[] = []; + // Carry over any chat history, converting OpenAI formatted chat history to Gemini: for (const chat_msg of chat_history) { + // Carry over system message to systemInstruction instead, on Gemini's config + // NOTE: This will override any systemInstruction already present in gemini_config. + // If the user is passing a chat history, it means they are using a Chat Turn node. if (chat_msg.role === "system") { - // Carry the system message over as PaLM's chat 'context': - gemini_messages.push({ - role: "model", - parts: [{ text: chat_msg.content }], - }); - } else if (chat_msg.role === "user") { - gemini_messages.push({ - role: "user", - parts: [{ text: chat_msg.content }], - }); - } else - gemini_messages.push({ - role: "model", - parts: [{ text: chat_msg.content }], - }); + if (system_msg !== undefined) { + console.warn( + "Warning: Both a system message and a chat history with a system message were provided to Google Gemini (typically, this occurs when a system message is defined in a Prompt Node and passed into a later Chat Turn node). The system message in the chat history will override the standalone system message.", + ); + } + gemini_config.systemInstruction = chat_msg.content; + } + const prompt_part: GeminiChatMessage = { + role: openai_gemini_role_map[chat_msg.role], + parts: [{ text: chat_msg.content }], + }; + gemini_chat_history.history.push(prompt_part); } - gemini_chat_context.history = gemini_messages; } console.log( @@ -1161,7 +999,7 @@ export async function call_google_gemini( ); const responses: Array = []; - const prompt_parts: Array = [{ text: prompt }]; + const prompt_parts: PartListUnion = [{ text: prompt }]; if (images && images.length > 0) { const image_data_urls: string[] = await imagesToBase64(images); for (const image of image_data_urls) { @@ -1174,27 +1012,22 @@ export async function call_google_gemini( } } - // TODO: to finish - // if (prompt.includes(IMAGE_IDENTIFIER) && typeof prompt === "string") { - // prompt = resolve_image_in_user_messages([{role : 'user', content : prompt}], 'gemini'); - // } - while (responses.length < n) { if (should_cancel && should_cancel()) throw new UserForcedPrematureExit(); - const chat = gemini_model.startChat({ - history: gemini_chat_context.history, - generationConfig: gen_Config, + const chat = gemini_client.chats.create({ + model, + history: gemini_chat_history.history, + config: gemini_config, }); - const chatResult = await chat.sendMessage(prompt_parts); - const chatResponse = await chatResult.response; - const response = { - text: chatResponse.text(), - candidates: chatResponse.candidates, - promptFeedback: chatResponse.promptFeedback, - }; - responses.push(response); + const chat_response = await chat.sendMessage({ message: prompt_parts }); + + responses.push({ + text: chat_response.text, + candidates: chat_response.candidates, + promptFeedback: chat_response.promptFeedback, + }); } return [query, responses]; @@ -1942,24 +1775,7 @@ function _extract_google_ai_responses( response: Dict, llm: LLM | string, ): Array { - switch (llm) { - case NativeLLM.PaLM2_Chat_Bison: - return _extract_palm_responses(response); - case NativeLLM.PaLM2_Text_Bison: - return _extract_palm_responses(response); - default: - return _extract_gemini_responses(response as Array); - } -} - -/** - * Extracts the text part of a 'Completion' object from Google PaLM2 `generate_text` or `chat`. - * - * NOTE: The candidate object for `generate_text` has a key 'output' which contains the response, - * while the `chat` API uses a key 'content'. This checks for either. - */ -function _extract_palm_responses(completion: Dict): Array { - return completion.candidates.map((c: Dict) => c.output || c.content); + return _extract_gemini_responses(response as Array); } /** diff --git a/chainforge/react-server/src/store.tsx b/chainforge/react-server/src/store.tsx index bb381416e..763a0a429 100644 --- a/chainforge/react-server/src/store.tsx +++ b/chainforge/react-server/src/store.tsx @@ -102,9 +102,9 @@ export const initLLMProviderMenu: (LLMSpec | LLMGroup)[] = [ emoji: "🤖", items: [ { - name: "GPT-4o", - emoji: "🤖", - model: "gpt-4o", + name: "GPT-4o-mini", + emoji: "🔬", + model: "gpt-4o-mini", base_model: "gpt-4", temp: 1.0, }, @@ -123,9 +123,9 @@ export const initLLMProviderMenu: (LLMSpec | LLMGroup)[] = [ temp: 0.0, }, { - name: "GPT4o-mini", - emoji: "🔬", - model: "gpt-4o-mini", + name: "GPT-4o", + emoji: "🤖", + model: "gpt-4o", base_model: "gpt-4", temp: 1.0, }, @@ -198,24 +198,31 @@ export const initLLMProviderMenu: (LLMSpec | LLMGroup)[] = [ emoji: "♊", items: [ { - name: "Gemini 1.5", + name: "Gemini 2.5 Pro", emoji: "♊", - model: "gemini-1.5-pro", - base_model: "palm2-bison", + model: "gemini-2.5-pro", + base_model: "gemini-2.5", temp: 0.7, }, { - name: "Gemini 1.5 Flash", - emoji: "📸", - model: "gemini-1.5-flash", - base_model: "palm2-bison", + name: "Gemini 2.5 Flash", + emoji: "⚡️", + model: "gemini-2.5-flash", + base_model: "gemini-2.5", + temp: 0.7, + }, + { + name: "Gemini 2.5 Flash Lite", + emoji: "💨", + model: "gemini-2.5-flash-lite", + base_model: "gemini-2.5", temp: 0.7, }, { - name: "Gemini 1.5 Flash 8B", + name: "Gemini 2.0 Flash", emoji: "⚡️", - model: "gemini-1.5-flash-8b", - base_model: "palm2-bison", + model: "gemini-2.0-flash", + base_model: "gemini-2.5", temp: 0.7, }, ], diff --git a/chainforge/react-server/src/styles.css b/chainforge/react-server/src/styles.css index b4a478f9e..98a53d806 100644 --- a/chainforge/react-server/src/styles.css +++ b/chainforge/react-server/src/styles.css @@ -1371,7 +1371,7 @@ html[data-mantine-color-scheme="dark"] .ai-button:active { /* Chat history bubbles */ .chat-bubble { --r: 15px; /* the radius */ - --t: 25px; /* the size of the tail */ + --t: 10px; /* the size of the tail */ max-width: 80%; padding: calc(2 * var(--r) / 3); @@ -1406,6 +1406,9 @@ html[data-mantine-color-scheme="dark"] .chat-bubble textarea { margin-left: var(--t); place-self: end; } +.chat-msg-right textarea { + max-width: 88%; +} .chat-history { margin: 0; min-height: 10vh; diff --git a/setup.py b/setup.py index 5fb604591..de1388b75 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ def readme(): setup( name="chainforge", - version="0.3.6.2", + version="0.3.6.3", packages=find_packages(), author="Ian Arawjo", description="A Visual Programming Environment for Prompt Engineering",