Closed halie412 closed 7 months ago
Thank you for raising!
Is this running in a browser? I'll get a team mate more experienced there to weigh in, but env vars may be tricky there (no process.env) meaning it may need to be manually traced with the LangChain tracer.
How are you specifying the environment variables in your runtime?
Great, thanks for take your time and fast reply, i already have an file .env with my environment variables who works for openai, mistral and pinecone, i excecuted couple of tests and varables are reading pretty well
This is the content of my file .env on root of project
LANGCHAIN_TRACING_V2=true LANGCHAIN_API_KEY=my_key_from_langsmith_ui LANGCHAIN_ENDPOINT=https://api.smith.langchain.com LANGCHAIN_PROJECT=default
PINECONE_API_KEY=pinecone_working_key
OPENAI_API_KEY=openai_working_key
MISTRAL_API_KEY=mistral_working_key
ANTHROPIC_API_KEY=antrhopic_working_key
@hinthornw Yes this is running in a browser (Chrome) for testing and developing, i use parcel
Does this work?
I'm sure you know what you're doing, but I'd be remiss if I didn't warn that if the app architecture puts a langsmith API key on a user's browser, it means they could get write access to your tenant
@hinthornw I´m trying to follow your instructions, yes for sure on browser is only for testing, for production will be managed as API, no as UI for browser
That don´t work, i test print in console variable and looks fine:
console.log(process.env.LANGCHAIN_API_KEY);
hmm will investigate
Could you confirm if you run
import { Client } from "langsmith";
const client = new Client({
apiUrl: "https://api.smith.langchain.com",
apiKey: "YOUR_API_KEY_HERE",
});
await client.createRun({
name: "test_run",
run_type: "chaihn",
inputs: { text: "hello world" },
});
no request is attempted?
and similarly with this:
import { Client } from "langsmith";
import { LangChainTracer } from "langchain/callbacks";
import { ChatOpenAI } from "@langchain/openai";
const callbacks = [
new LangChainTracer({
client: new Client({
apiUrl: "https://api.smith.langchain.com",
apiKey: "YOUR_API_KEY_HERE",
}),
}),
];
const llm = new ChatOpenAI({});
await llm.invoke("Hello, world!", { callbacks });
Feel free to re-open if the issue persists! We have a lot of JS usage so I don't believe this is a fundamental bug in our tracer.
Issue you'd like to raise.
Hi Langsmith team, i spent 4 hours trying to make work Langsmith before opening this issue
The main problem: Langchain work pretty well but i can´t get data on langsmith, i already test this things: ✔️ Enviroment variables (all work well) ✔️ Langsmith installed (npm install langsmith) ✔️ Project name on UI Langsmith and my code same as variable LANGCHAIN_PROJECT=default ✔️ API key from UI Langsmith same as variable LANGCHAIN_API_KEY=my_key ✔️ Variable LANGCHAIN_TRACING_V2=true ✔️ Variable LANGCHAIN_ENDPOINT=https://api.smith.langchain.com ✔️ Readed couple of time docs and there no mention to import or initialice any thing to make this work
The issue: Langchain work pretty well but not send data to langsmith, this is an example of networks connection at run time
In console i don´t see any error or warning
This is my package.json { "name": "js-langchain", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "parcel index.html", "build": "parcel build index.html" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "buffer": "^6.0.3", "lite-server": "^2.6.1", "parcel": "^2.12.0", "process": "^0.11.10", "ts-node": "^10.9.2", "typescript": "^5.4.3" }, "dependencies": { "@langchain/anthropic": "^0.1.8", "@langchain/community": "^0.0.41", "@langchain/mistralai": "^0.0.15", "@langchain/openai": "^0.0.23", "axios": "^1.6.8", "cheerio": "^1.0.0-rc.12", "langchain": "^0.1.28", "langsmith": "^0.1.14", "uuid": "^9.0.1" } }
Suggestion:
No response