Created
April 22, 2024 15:55
-
-
Save ahmednuaman/0f4a828d22d2f6297c064e47be1e2b59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.post("/api/invoke-prompt") | |
async def invoke_prompt(req: Request): | |
try: | |
body = await req.json() | |
return { | |
"response": await invoke_model_stream( | |
{ | |
"messages": body["messages"], | |
"max_tokens": 3100, | |
"temperature": 0.5, | |
"top_k": 150, | |
"top_p": 0.5, | |
"system": body.get( | |
"system", | |
"You are an expert focusing on the insurance claims industry.", | |
), | |
"anthropic_version": "bedrock-2023-05-31", | |
}, | |
"anthropic.claude-3-haiku-20240307-v1:0", | |
) | |
} | |
except Exception as e: | |
raise HTTPException(status_code=400, detail=f"Call to Bedrock failed: {str(e)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment