Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
|
@@ -15,6 +15,7 @@ llm = Llama(
|
|
| 15 |
class Validation(BaseModel):
|
| 16 |
user_prompt: str # User's input prompt
|
| 17 |
system_prompt: str # System's guiding prompt
|
|
|
|
| 18 |
|
| 19 |
# FastAPI application initialization
|
| 20 |
app = FastAPI()
|
|
@@ -28,7 +29,7 @@ async def generate_response(item: Validation):
|
|
| 28 |
{ item.user_prompt }<|eot_id|> \n <|start_header_id|>assistant<|end_header_id|>"""
|
| 29 |
|
| 30 |
# Call the Llama model to generate a response
|
| 31 |
-
output = llm(prompt, echo=True) # Update parameters as needed
|
| 32 |
|
| 33 |
# Extract and return the text from the response
|
| 34 |
return output['choices'][0]['text']
|
|
|
|
| 15 |
class Validation(BaseModel):
|
| 16 |
user_prompt: str # User's input prompt
|
| 17 |
system_prompt: str # System's guiding prompt
|
| 18 |
+
max_tokens: int
|
| 19 |
|
| 20 |
# FastAPI application initialization
|
| 21 |
app = FastAPI()
|
|
|
|
| 29 |
{ item.user_prompt }<|eot_id|> \n <|start_header_id|>assistant<|end_header_id|>"""
|
| 30 |
|
| 31 |
# Call the Llama model to generate a response
|
| 32 |
+
output = llm(prompt, max_tokens = item.max_tokens,echo=True) # Update parameters as needed
|
| 33 |
|
| 34 |
# Extract and return the text from the response
|
| 35 |
return output['choices'][0]['text']
|