Dellboy commited on
Commit
c77cde2
·
verified ·
1 Parent(s): d926558

gr.api requires type hints on every parameter

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -133,7 +133,7 @@ if RAG_ENABLED:
133
 
134
  # ----------------------------------------------------------------- generation
135
 
136
- def build_messages(message: str, history) -> list[dict]:
137
  """Assemble the prompt. The system message is injected here and here only —
138
  a client-supplied one is never trusted."""
139
  messages = [{"role": "system", "content": SYSTEM_PROMPT}]
@@ -162,8 +162,9 @@ def build_messages(message: str, history) -> list[dict]:
162
 
163
 
164
  @spaces.GPU(duration=60)
165
- def chat(message: str, history, temperature: float = 0.7, top_p: float = 0.9,
166
- repetition_penalty: float = 1.05, max_new_tokens: int = 512):
 
167
  """Stream an answer. Yields the answer *so far* on each step, which is what
168
  Gradio's streaming contract expects and what hf_client.py diffs into deltas."""
169
  message = (message or "").strip()
 
133
 
134
  # ----------------------------------------------------------------- generation
135
 
136
+ def build_messages(message: str, history: list | None) -> list[dict]:
137
  """Assemble the prompt. The system message is injected here and here only —
138
  a client-supplied one is never trusted."""
139
  messages = [{"role": "system", "content": SYSTEM_PROMPT}]
 
162
 
163
 
164
  @spaces.GPU(duration=60)
165
+ def chat(message: str, history: list | None = None, temperature: float = 0.7,
166
+ top_p: float = 0.9, repetition_penalty: float = 1.05,
167
+ max_new_tokens: int = 512):
168
  """Stream an answer. Yields the answer *so far* on each step, which is what
169
  Gradio's streaming contract expects and what hf_client.py diffs into deltas."""
170
  message = (message or "").strip()