added gitnore
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
uvicorn
|
uvicorn
|
||||||
fastapi
|
fastapi
|
||||||
|
openai
|
||||||
@@ -1,12 +1,41 @@
|
|||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI, HTTPException
|
||||||
|
from openai import OpenAI
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
class Item(BaseModel):
|
||||||
|
ask: str
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
def central_function():
|
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__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, port=3035,host="0.0.0.0")
|
uvicorn.run(app, port=3035,host="0.0.0.0")
|
||||||
@@ -11,5 +11,6 @@ services:
|
|||||||
- 3035:3035
|
- 3035:3035
|
||||||
environment:
|
environment:
|
||||||
- PORT=3035
|
- PORT=3035
|
||||||
|
- OPENAI_API_KEY=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
|
||||||
volumes:
|
volumes:
|
||||||
src:
|
src:
|
||||||
Reference in New Issue
Block a user