jonathanjordan21 commited on
Commit
d8c1af1
·
verified ·
1 Parent(s): 8b12d82

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +28 -0
app/main.py CHANGED
@@ -127,3 +127,31 @@ async def analyze(
127
  status_code=500,
128
  detail=str(exc)
129
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  status_code=500,
128
  detail=str(exc)
129
  )
130
+
131
+
132
+
133
+
134
+
135
+ from app.embedding import generate_embeddings
136
+
137
+
138
+ @app.post("/v1/embeddings")
139
+ async def embeddings(
140
+ request: EmbeddingRequest,
141
+ x_api_key: str | None = Header(default=None)
142
+ ):
143
+ verify_api_key(x_api_key)
144
+
145
+ try:
146
+ return await run_in_threadpool(
147
+ generate_embeddings,
148
+ request
149
+ )
150
+ except HTTPException:
151
+ raise
152
+ except Exception as exc:
153
+ raise HTTPException(
154
+ status_code=500,
155
+ detail=str(exc)
156
+ )
157
+