Comments (7)
I looked into a couple ways of doing this. Let me know if you had a preferred method in mind.
One is to add a dependency nbmake, which is a pytest plugin that lets you execute notebooks. You can see an implementation here: master...ccurme:langchain:cc/test_notebooks
The pro is that this is a simple solution built for this use-case. You can list all the notebooks you want to test, or use --ignore
to exclude certain notebooks.
One con is that the error handling looked cumbersome to me. If you expect a specific error to be raised, for example, you need to add metadata to cells in the notebook JSON, which can get overwritten. I added an example on that branch.
Another option is to use nbclient, which is already included in dependencies. I added an example here: master...ccurme:langchain:cc/test_notebooks_nbclient
This is neat because you can write the tests in python and work with errors programmatically. But it's arguably more complicated than just passing --nbmake
to pytest.
Let me know if you have thoughts or if I should open a PR.
from langchain.
hmmm adding the metadata is definitely cumbersome. but at the same time... how many notebooks do we have that expect errors?
from langchain.
It doesn't look like many. My thought is to just to use nbmake
and opt-in to including notebooks in the test. So we'd need to maintain a separate list of notebooks to test; we wouldn't discover them. Does this sound good, or is it important to discover notebooks so that we don't need to maintain a list?
from langchain.
that sounds perfect!
from langchain.
its probably possible to regexs, eg /*
for everything in directory?
from langchain.
We can enumerate directories, we can also go the other way and maintain a list of notebooks we don't test.
from langchain.
Hi, @hwchase17! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, the issue is about adding tests for notebooks to ensure they are kept up to date. There was a discussion with ccurme where two options were suggested: using nbmake, a pytest plugin, or using nbclient, which is already included in dependencies. The conclusion was to use nbmake and maintain a separate list of notebooks to test. There was also a suggestion to use regex to include all notebooks in a directory.
Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your contribution to LangChain!
from langchain.
Related Issues (20)
- ChatGoogleGenerativeAI does not support streaming HOT 2
- ChatHuggingFace using local model with HuggingFacePipeline wrongly checks for available inference endpoints HOT 1
- I am getting this error HOT 4
- Prepare for pydantic 2 migration by refactoring vanilla @root_validator() usage
- DOC: <Issue related to /v0.2/docs/tutorials/rag/> HOT 11
- Add Document ID back to AzureSearch Documents HOT 1
- Spec out API for all required vs. all possible input variables HOT 1
- RedisChatMessageHistory encountering issues in Redis standalone mode on Windows.
- Standardize DocumentLoader docstrings and integration docs
- Standardize DocumentLoader docstrings and integration do HOT 1
- When using langchain-community, some PDF images will report errors during OCR
- [E:onnxruntime:Default, env.cc:228 ThreadMain] pthread_setaffinity_np failed for thread: 8353, index: 0, mask: {1, }, error code: 22 error msg: Invalid argument. Specify the number of threads explicitly so the affinity is not set.
- RPC error: [create_index], <MilvusException: (code=1100, message=create index on 104 field is not supported: invalid parameter[expected=supported field][actual=create index on 104 field])>, <Time:{'RPC start': '2024-06-14 13:38:35.242645', 'RPC error': '2024-06-14 13:38:35.247294'}> HOT 1
- DOC: <Issue related to /v0.2/docs/integrations/chat/> Ollama JSON mode seems to be marked incorrectly as NO HOT 1
- MistralAI Extraction How-To (with examples) throws an error HOT 2
- Wrong spell in DOC: <Issue related to /v0.2/docs/how_to/streaming/>
- httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol
- Failed to parse Suggestions from completion
- Invalid Milvus URI when using Milvus lite with local DB HOT 1
- Cannot import name 'create_model' from 'langchain_core.runnables.utils'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langchain.