Skip to content

Conversation

@Simon-Stone
Copy link
Collaborator

@Simon-Stone Simon-Stone commented Oct 7, 2025

🎯 Overview

This PR introduces version 0.3.0, a major update that unifies the API interface, improves model management, and enhances the overall developer experience. The release consolidates chat model interfaces and modernizes the embeddings system while maintaining backward compatibility through deprecation warnings.

🚀 Major Changes

1. Unified Chat Model Interface

Consolidated ChatDartmouth and ChatDartmouthCloud

  • ChatDartmouth now handles both on-premises and cloud-based models
  • ChatDartmouthCloud deprecated with graceful fallback to ChatDartmouth
  • Default model changed from "llama-3-1-8b-instruct" to "openai.gpt-oss-120b"
  • Single, consistent API for all chat models regardless of hosting location

Before:

from langchain_dartmouth.llms import ChatDartmouth, ChatDartmouthCloud

on_prem = ChatDartmouth(model_name="llama-3-1-8b-instruct")
cloud = ChatDartmouthCloud(model_name="openai.gpt-4.1-mini-2025-04-14")

After:

from langchain_dartmouth.llms import ChatDartmouth

on_prem = ChatDartmouth(model_name="meta.llama-3-1-8b-instruct")
cloud = ChatDartmouth(model_name="openai.gpt-4.1-mini-2025-04-14")

2. Enhanced Model Listing

New ModelInfo Pydantic Class

  • Structured model information with type safety
  • Rich metadata including capabilities, cost indicators, and hosting location
  • Automatic validation and extraction of model properties

Key Attributes:

  • id: Model identifier for API calls
  • name: Human-readable display name
  • description: Detailed model description
  • capabilities: List of features (vision, tool calling, reasoning, etc.)
  • is_local: Boolean indicating on-premises vs cloud hosting
  • cost: Relative cost indicator ("free", "$" to "$$$$")
  • is_embedding: Flag for embedding models

Return Type Changes:

3. Embeddings Modernization

Infrastructure Changes:

  • Base class changed from HuggingFaceEndpointEmbeddings to OpenAIEmbeddings
  • Authentication switched from DARTMOUTH_API_KEY to DARTMOUTH_CHAT_API_KEY
  • API endpoint changed to cloud-based service
  • Model names now use provider prefixes (e.g., "baai.bge-large-en-v1-5")

New Features:

  • Added dimensions parameter for controlling output embedding size
  • Support for additional cloud-based embedding models
  • Improved async support

4. Documentation Enhancements

New Migration Guide (docs/migration.rst)

  • Comprehensive migration instructions from v0.2.x to v0.3.x
  • Side-by-side code comparisons
  • Troubleshooting section

feat!: migrate embeddings to Cloud API infrastructure

Migrate DartmouthEmbeddings from HuggingFace-based endpoints to the new 
Cloud API infrastructure using OpenAI-compatible interface. This aligns 
the embeddings implementation with ChatDartmouthCloud for consistency.

Key changes:
- Replace HuggingFaceEndpointEmbeddings base class with OpenAIEmbeddings
- Switch from JWT authentication to API key-based auth
- Update model listing to use CloudModelListing with tag/capability filtering
- Add filter_dartmouth_chat_models() utility for advanced model filtering
- Improve test coverage with parametrized embedding model tests
- Fix redirect handling by disabling follow_redirects in HTTP clients

BREAKING CHANGE: Authentication now requires DARTMOUTH_CHAT_API_KEY 
environment variable instead of DARTMOUTH_API_KEY. Constructor parameter 
renamed from dartmouth_api_key to dartmouth_chat_api_key.
)

- Merge ChatDartmouthCloud into ChatDartmouth as unified interface
- ChatDartmouth now serves both free on-prem and paid cloud models
- Update default model to openai.gpt-oss-120b

- Update test suite
  - Consolidate chat model tests to use unified ChatDartmouth interface
  - Remove duplicate cloud-specific test cases
  - Update test assertions and model references

This consolidation simplifies the API surface and makes it clearer that
ChatDartmouth is the single entry point for all chat model access,
regardless of whether models are hosted on-prem or in the cloud.

BREAKING CHANGE: The model IDs for users of the old ChatDartmouth have
changed. Use ChatDartmouth.list() to find the new one.
* refactor!: consolidate chat model interfaces and improve type hints

- Merge ChatDartmouthCloud into ChatDartmouth as unified interface
- ChatDartmouth now serves both free on-prem and paid cloud models
- Update default model to openai.gpt-oss-120b

- Update test suite
  - Consolidate chat model tests to use unified ChatDartmouth interface
  - Remove duplicate cloud-specific test cases
  - Update test assertions and model references

This consolidation simplifies the API surface and makes it clearer that
ChatDartmouth is the single entry point for all chat model access,
regardless of whether models are hosted on-prem or in the cloud.

BREAKING CHANGE: The model IDs for users of the old ChatDartmouth have
changed. Use ChatDartmouth.list() to find the new one.

* remove mentions of ChatDartmouthCloud
refactor!: introduce ModelInfo class for type-safe model representation

Replace dictionary-based model listings with a structured ModelInfo Pydantic
class to improve type safety, validation, and developer experience.

BREAKING CHANGE: Model listing methods now return list[ModelInfo] instead of
list[dict]. Code using dictionary access (model["id"]) must be updated to use
attribute access (model.id).

Changes:
- Add ModelInfo Pydantic model with properties: id, name, description,
  is_embedding, capabilities, is_local, and cost
- Implement smart validators to flatten nested metadata and extract tags
- Update ChatDartmouth.list() return type to list[ModelInfo]
- Update DartmouthEmbeddings.list() return type to list[ModelInfo]
- Update CloudModelListing.list() return type to list[ModelInfo]
- Remove filter_dartmouth_chat_models() utility function (58 lines)
- Simplify filtering logic using is_embedding property
- Update tests to use attribute access

Benefits:
- Pydantic validation ensures data conformity
- Better IDE autocomplete and type hints
- Reduced code complexity (-58 lines of filtering logic)
- Centralized model representation
- Clearer API with documented properties

Files changed: 5 files (+112, -81)
@Simon-Stone Simon-Stone marked this pull request as ready for review October 16, 2025 13:10
@Simon-Stone Simon-Stone merged commit f74000a into main Oct 16, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants