added gitnore
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.idea
|
||||
@@ -1,2 +1,3 @@
|
||||
uvicorn
|
||||
fastapi
|
||||
fastapi
|
||||
openai
|
||||
@@ -1,12 +1,41 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from openai import OpenAI
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
class Item(BaseModel):
|
||||
ask: str
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def central_function():
|
||||
return {"Neural":"Nine"}
|
||||
client = OpenAI()
|
||||
stream = client.chat.completions.create(
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "create 10 science questions with answers"}
|
||||
]
|
||||
)
|
||||
return {"Neural":"Nine", "TOTAL": stream }
|
||||
|
||||
|
||||
@app.get("/askai")
|
||||
def central_function(item: Item):
|
||||
#print(item.ask)
|
||||
client = OpenAI()
|
||||
stream = client.chat.completions.create(
|
||||
model="gpt-4o",
|
||||
messages=[
|
||||
{"role": "user", "content": "create 10 science questions with answers"}
|
||||
]
|
||||
)
|
||||
return {"Neural":"Nine", "TOTAL": stream }
|
||||
|
||||
|
||||
|
||||
# return {"Neural":"Nine", "Res2":chunk.choices[0].delta.content, "TOTAL": stream }
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(app, port=3035,host="0.0.0.0")
|
||||
@@ -11,5 +11,6 @@ services:
|
||||
- 3035:3035
|
||||
environment:
|
||||
- PORT=3035
|
||||
- OPENAI_API_KEY=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
|
||||
volumes:
|
||||
src:
|
||||
Reference in New Issue
Block a user