Skip to content

Commit 8cf81c9

Browse files
CopilotVinciGit00
andcommitted
Add documentation explaining __new__ usage in Nvidia class
Co-authored-by: VinciGit00 <[email protected]>
1 parent f23072c commit 8cf81c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scrapegraphai/models/nvidia.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ class Nvidia:
88
A wrapper for the ChatNVIDIA class that provides default configuration
99
and could be extended with additional methods if needed.
1010
11+
Note: This class uses __new__ instead of __init__ because langchain_nvidia_ai_endpoints
12+
is an optional dependency. We cannot inherit from ChatNVIDIA at class definition time
13+
since the module may not be installed. The __new__ method allows us to lazily import
14+
and return a ChatNVIDIA instance only when Nvidia() is instantiated.
15+
1116
Args:
1217
llm_config (dict): Configuration parameters for the language model.
1318
"""

0 commit comments

Comments
 (0)