langchain-ai / langchain-nvidia

MIT License
48 stars 15 forks source link

Deprecate mode() in favor of __init__(base_url=...) #43

Closed mattf closed 3 months ago

mattf commented 3 months ago

Description

To simplify and align switching from hosted and local backends, the mode() method is deprecated in favor of using base_url passed to constructors.

The mode() method will be removed in v0.1.

Old usage -

from langchain_nvidia_ai_endpoints import ChatNVIDIA, NVIDIAEmbeddings, NVIDIARerank

llm = ChatNVIDIA().mode("nim", base_url="http://localhost:8000/v1")
embedder = NVIDIAEmbeddings().mode("nim", base_url="http://localhost:12345/v1")
ranker = NVIDIARerank().mode("nim", base_url="http://localhost:1976/v1")

New usage -

from langchain_nvidia_ai_endpoints import ChatNVIDIA, NVIDIAEmbeddings, NVIDIARerank

llm = ChatNVIDIA(base_url="http://localhost:8000/v1")
embedder = NVIDIAEmbeddings(base_url="http://localhost:12345/v1")
ranker = NVIDIARerank(base_url="http://localhost:1976/v1")

A full documentation refresh will follow. I want to get the deprecation warnings to users ASAP.