Skip to content

Commit a1feb1b

Browse files
authored
Merge pull request #173 from HolobiomicsLab/dev_madina
Add how to run evaluation.py (LangSmith api key is needed)
2 parents 10af7b6 + b708280 commit a1feb1b

4 files changed

Lines changed: 27 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ python -m app.core.main -c "Which lab extracts show inhibition above 50% against
168168

169169
MetaboT saves all result sets to CSV files in a temporary folder and returns the file path. When results are small, they are also displayed inline; for large result sets, only the file path is returned to avoid exceeding the LLM context window.
170170

171+
### LangSmith automated evaluation (benchmark)
172+
173+
This repository includes a LangSmith-based automated evaluation script at `app/core/tests/evaluation.py`. To run it locally you need a LangSmith API key (`LANGCHAIN_API_KEY` or `LANGSMITH_API_KEY`) and an LLM provider key (e.g. `OPENAI_API_KEY`). See [docs/examples/langsmith-evaluation.md](docs/examples/langsmith-evaluation.md).
174+
171175
### Streamlit web app
172176

173177
The repository also includes a Streamlit interface:

app/core/tests/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
openai_key = os.getenv("OPENAI_API_KEY")
2525

2626
if not api_key:
27-
raise ValueError("Missing LANGCHAIN_API_KEY. Please copy .env.template to .env and add your key.")
27+
raise ValueError("Missing LANGCHAIN_API_KEY (or LANGSMITH_API_KEY). Please add it to your repo-root .env (see docs/user-guide/configuration.md).")
2828
if not openai_key:
2929
raise ValueError("Missing OPENAI_API_KEY. Please copy .env.template to .env and add your key.")
3030

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# LangSmith automated evaluation
2+
3+
To run the automated evaluation you need a **LangSmith API key**. Create an account and generate an API key using the LangSmith docs: [Create an account and API key](https://docs.langchain.com/langsmith/create-account-api-key).
4+
5+
Add the key to your repo-root `.env` (do not commit it), along with your LLM provider key:
6+
7+
```env
8+
LANGCHAIN_API_KEY=your_langsmith_key # or LANGSMITH_API_KEY
9+
LANGCHAIN_PROJECT=MetaboT_Test_Run
10+
OPENAI_API_KEY=your_openai_key
11+
```
12+
13+
Then run (from the repository root):
14+
15+
```bash
16+
python -m app.core.tests.evaluation
17+
```
18+
19+
This starts the benchmark evaluation (running MetaboT on ~50 questions). LLM-based evaluators compare the generated answers with the reference answers. A link to the evaluation run will appear once the evaluation starts, and you can also find it later in your LangSmith account.
20+

docs/user-guide/configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
142142

143143
If no tracing key is present, MetaboT disables tracing automatically.
144144

145+
For running the repository's LangSmith-based automated benchmark evaluation, see [docs/examples/langsmith-evaluation.md](../examples/langsmith-evaluation.md).
146+
145147
## SPARQL and Schema Configuration
146148

147149
`app/config/sparql.ini` contains helper queries used to inspect or work with the graph schema. These are especially important when MetaboT needs to construct schema-aware prompts from an endpoint rather than from assumptions.

0 commit comments

Comments
 (0)