Access user info from within a plugin defined in LangChain #1763
-
Hi, I created a custom plugin in LangChainJS and want to access the current users information such as user_id, since I want to use that information when making requests to an API endpoint. How would I go about that? So retrieving the info defined at |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Absolutely, I believe the userId is passed to every tool on initialization already. This happens in See If you need more user info, you will have to mess with what is passed to |
Beta Was this translation helpful? Give feedback.
-
Awesome, easy enough. Thank you for your quick answer 👍 |
Beta Was this translation helpful? Give feedback.
Absolutely, I believe the userId is passed to every tool on initialization already. This happens in
api/app/clients/tools/util/handleTools.js
within theloadToolWithAuth
function.See
api/app/clients/tools/DALL-E.js
andapi/app/clients/tools/structured/DALLE3.js
for reference, which use this value.If you need more user info, you will have to mess with what is passed to
loadTools
and change the connecting layers of logic accordingly.