-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.py
32 lines (25 loc) · 806 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from functions import fetch_nvapi_key
from functions import get_available_models
# Call the function to fetch NVIDIA API key
fetch_nvapi_key()
# Get the list of available models
get_available_models()
from fastapi import FastAPI
from langchain.prompts import ChatPromptTemplate
from langchain_nvidia_ai_endpoints import ChatNVIDIA
from langserve import add_routes
llm = ChatNVIDIA(model="mixtral_8x7b")
app = FastAPI(
title="LangChain Server",
version="1.0",
description="A simple api server using Langchain's Runnable interfaces",
)
add_routes(
app,
llm,
path="/basic_chat",
)
## Might be encountered if this were for a standalone python file...
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="localhost", port=8001)