MohitGupta41 commited on
Commit
f384afc
·
1 Parent(s): 2fc2a36

Add application file

Browse files
Files changed (2) hide show
  1. Constants.py +1 -0
  2. app.py +4 -2
Constants.py ADDED
@@ -0,0 +1 @@
 
 
1
+ CONTEXT = 7000
app.py CHANGED
@@ -9,6 +9,8 @@ from fastapi.middleware.cors import CORSMiddleware
9
  from pydantic import BaseModel, Field, ConfigDict
10
  import httpx
11
 
 
 
12
  # ---------- Config ----------
13
  logging.basicConfig(level=logging.INFO)
14
  logger = logging.getLogger("voice-agent")
@@ -65,7 +67,7 @@ async def call_gemini(
65
  Calls Google Gemini via the official python SDK if available; falls back to REST if not.
66
  We DON'T log the API key.
67
  """
68
- generation_config = generation_config or {"temperature": 0.2, "max_output_tokens": 512}
69
 
70
  try:
71
  # Prefer python SDK (google-generativeai)
@@ -122,7 +124,7 @@ async def call_huggingface_inference(
122
  Calls Hugging Face Inference API for text generation models (e.g., google/gemma-3-27b-it).
123
  """
124
  parameters = parameters or {
125
- "max_new_tokens": 512,
126
  "temperature": 0.2,
127
  "return_full_text": False,
128
  "repetition_penalty": 1.1,
 
9
  from pydantic import BaseModel, Field, ConfigDict
10
  import httpx
11
 
12
+ from Constants import CONTEXT
13
+
14
  # ---------- Config ----------
15
  logging.basicConfig(level=logging.INFO)
16
  logger = logging.getLogger("voice-agent")
 
67
  Calls Google Gemini via the official python SDK if available; falls back to REST if not.
68
  We DON'T log the API key.
69
  """
70
+ generation_config = generation_config or {"temperature": 0.2, "max_output_tokens": CONTEXT}
71
 
72
  try:
73
  # Prefer python SDK (google-generativeai)
 
124
  Calls Hugging Face Inference API for text generation models (e.g., google/gemma-3-27b-it).
125
  """
126
  parameters = parameters or {
127
+ "max_new_tokens": CONTEXT,
128
  "temperature": 0.2,
129
  "return_full_text": False,
130
  "repetition_penalty": 1.1,