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

Documentation of Langchain with Javascript is not good at all #562

Open
yours7himanshu opened this issue Dec 3, 2024 · 4 comments
Open

Comments

@yours7himanshu
Copy link

@akira @nfcampos
Facing issue on passing the Grok api key and langchain api key here is the code i had wrote but its showing invalid api key eventhough i passed it correctly...check the code attached with the screenshot-
image

@hinthornw
Copy link
Collaborator

hinthornw commented Dec 3, 2024

Hi @yours7himanshu , what are you looking to accomplish?

The langchain api key isn't somethign ChatGroq expects.

To activate tracing you'd set both LANGCHAIN_API_KEY (or LANGSMITH_API_KEY) and LANGSMITH_TRACING=true in your environment, but your code doesn't have to be aware of that

@yours7himanshu
Copy link
Author

@hinthornw i had removed that too but still don't know i am getting this warning and and error with invalid api key don't know why even though in my opinion i am doing correctly i had used .env file to store api keys and using it.
Error i am getting-
[DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39
return new AuthenticationError(status, error, message, headers);
^

AuthenticationError: 401 {"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}}
at APIError.generate (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39:20)
at Groq.makeStatusError (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:268:25)
at Groq.makeRequest (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:311:30)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async RetryOperation._fn (C:\Users\dinka\Documents\LangChain\node_modules\p-retry\index.js:50:12) {
status: 401,
headers: {
'alt-svc': 'h3=":443"; ma=86400',
'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '8ec99310bdd97fe9-MAA',
connection: 'keep-alive',
'content-length': '96',
'content-type': 'application/json',
date: 'Wed, 04 Dec 2024 06:00:09 GMT',
server: 'cloudflare',
'set-cookie': '__cf_bm=HLiCJzsEGAJ.Ek3hUyHMz39rCRkb3LCS2PmtRukXXuI-1733292009-1.0.1.1-v1ri.qFuAqahDYRj6DHyFr89pUgZxM5tm8rCY6Cytmg7VElplbnGlMIzObRd7UN1V7Lx8uUv82ooNw1FTsFIZg; path=/; expires=Wed, 04-Dec-24 06:30:09 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None',
vary: 'Origin',
via: '1.1 google',
'x-request-id': 'req_01je8429rcfqa87khvkd6vqbqb'
},
error: {
error: {
message: 'Invalid API Key',
type: 'invalid_request_error',
code: 'invalid_api_key'
}
},
attemptNumber: 1,
retriesLeft: 6
}

Attached sreenshot-
image

@hinthornw
Copy link
Collaborator

And is the API key correct?

@yours7himanshu
Copy link
Author

yours7himanshu commented Dec 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants