langchain_dartmouth
– LangChain components for Dartmouth’s on-premise models
This package contains components to facilitate the use of models deployed in Dartmouth College’s compute infrastructure or third-party models made accessible by Dartmouth. The components are fully compatible with LangChain, allowing seamless integration and plug-and-play compatibility with the vast number of components in the ecosystem.
There are three main components currently implemented:
- Embedding models
Used to generate embeddings for text documents.
- Large Language Models:
Used to generate text in response to a text prompt.
- Reranking models
Used to rerank retrieved documents based on their relevance to a query.
Note
These components provide access to the models deployed in Dartmouth’s compute infrastructure using a RESTful API, and to third-party models made accessible by Dartmouth. To see which models are available, check the respective list()
method of each class.
Installation
You can install the latest release of the library from PyPI using pip:
pip install langchain_dartmouth
Alternatively, you can clone the library repository from GitHub.
Getting Started
Using Dartmouth’s compute infrastructure or the third-party models paid for by Dartmouth requires authentication. The components in this library handle authentication “under-the-hood”, but require valid Dartmouth API keys. For the on-premise models, you can obtain a key from Dartmouth’s Developer Portal. For the third-party models, you can find instructions on how to obtain a key here.`
Even though you can pass your key to each component using the dartmouth_api_key
or dartmouth_chat_api_key
parameter, it is good practice to not include the API key in your code directly. Instead, you should set the environment variable DARTMOUTH_API_KEY
or DARTMOUTH_CHAT_API_KEY
to your key. This will ensure that the key is not exposed in your code.
Note
We recommend using python-dotenv to manage your environment variables with an .env
file.
User Guide
While this documentation contains the technical API reference, you can find a collection of tutorials (or recipes) on how to use the components in this library in the LangChain Dartmouth Cookbook.
Feedback and Comments
For questions, comments, or improvements, email Research Computing.
License
Created by Simon Stone for Dartmouth College under Creative Commons CC BY-NC 4.0 License


Except where otherwise noted, the example programs are made available under the OSI-approved MIT license.