Spaces:
Sleeping
Sleeping
ego commited on
Commit ·
cf10bac
1
Parent(s): 4681215
Switch embedding model from Google to NVIDIA NIM (llama-nemotron-embed-1b-v2)
Browse files- app.py +1 -1
- core/models.py +8 -9
app.py
CHANGED
|
@@ -228,7 +228,7 @@ def show_home():
|
|
| 228 |
</div>
|
| 229 |
<div style="border-left: 1px solid #eee;">
|
| 230 |
<h4>🧬 Models</h4>
|
| 231 |
-
<p style="font-size: 0.85rem; color: #666;">NVIDIA Nemotron-3 (Reasoning)<br>
|
| 232 |
</div>
|
| 233 |
</div>
|
| 234 |
</div>
|
|
|
|
| 228 |
</div>
|
| 229 |
<div style="border-left: 1px solid #eee;">
|
| 230 |
<h4>🧬 Models</h4>
|
| 231 |
+
<p style="font-size: 0.85rem; color: #666;">NVIDIA Nemotron-3 (Reasoning)<br>NVIDIA Nemotron Embed-1B (Vector)<br>Gemini 2.5 Flash (Audio/TTS)</p>
|
| 232 |
</div>
|
| 233 |
</div>
|
| 234 |
</div>
|
core/models.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
-
from langchain_nvidia_ai_endpoints import ChatNVIDIA
|
| 4 |
-
from langchain_google_genai import GoogleGenerativeAIEmbeddings, ChatGoogleGenerativeAI
|
| 5 |
from google import genai
|
| 6 |
|
| 7 |
def get_llm(model_name: str = "nvidia/nemotron-3-nano-30b-a3b"):
|
|
@@ -22,14 +21,14 @@ def get_llm(model_name: str = "nvidia/nemotron-3-nano-30b-a3b"):
|
|
| 22 |
)
|
| 23 |
|
| 24 |
def get_embeddings():
|
| 25 |
-
api_key = os.getenv("
|
| 26 |
-
if not api_key and "
|
| 27 |
-
api_key = st.secrets["
|
| 28 |
-
|
| 29 |
if not api_key:
|
| 30 |
-
raise ValueError("
|
| 31 |
-
|
| 32 |
-
return
|
| 33 |
|
| 34 |
from google.genai import types
|
| 35 |
|
|
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
+
from langchain_nvidia_ai_endpoints import ChatNVIDIA, NVIDIAEmbeddings
|
|
|
|
| 4 |
from google import genai
|
| 5 |
|
| 6 |
def get_llm(model_name: str = "nvidia/nemotron-3-nano-30b-a3b"):
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
def get_embeddings():
|
| 24 |
+
api_key = os.getenv("NV_API_KEY")
|
| 25 |
+
if not api_key and "NV_API_KEY" in st.secrets:
|
| 26 |
+
api_key = st.secrets["NV_API_KEY"]
|
| 27 |
+
|
| 28 |
if not api_key:
|
| 29 |
+
raise ValueError("NV_API_KEY not found in environment or secrets.")
|
| 30 |
+
|
| 31 |
+
return NVIDIAEmbeddings(model="nvidia/llama-nemotron-embed-1b-v2", api_key=api_key)
|
| 32 |
|
| 33 |
from google.genai import types
|
| 34 |
|