anubhav77 commited on
Commit
a5d8aec
·
1 Parent(s): 21114d5

trying info endpoint

Browse files
Files changed (1) hide show
  1. main.py +18 -5
main.py CHANGED
@@ -96,6 +96,18 @@ def heartbeat():
96
  print("Received heartbeat request")
97
  return {"nanosecond heartbeat":int(time.time_ns())}
98
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  @app.post(api_base+"/reset")
100
  def reset():
101
  print("Received reset request")
@@ -122,8 +134,9 @@ def heartbeat1():
122
  return heartbeat()
123
 
124
  @app.get(api_base+"/collections")
125
- def list_collections():
126
  print("Received list_collections request")
 
127
  return bkend.list_collections()
128
 
129
  @app.post(api_base+"/collections")
@@ -154,10 +167,10 @@ def update(collection_id:str , update:UpdateEmbedding) -> None:
154
  @app.post(api_base+"/collections/{collection_id}/upsert")
155
  def upsert(collection_id:str, upsert: AddEmbedding):
156
  print("Received upsert request")
157
- try:
158
- print("Received upsert request",upsert)
159
- except Exception:
160
- pass
161
  return bkend._upsert(collection_id=_uuid(collection_id),embeddings=upsert.embeddings,metadatas=upsert.metadatas,documents=upsert.documents,ids=upsert.ids,increment_index=upsert.increment_index)
162
 
163
  @app.post(api_base+"/collections/{collection_id}/get")
 
96
  print("Received heartbeat request")
97
  return {"nanosecond heartbeat":int(time.time_ns())}
98
 
99
+ @app.get("/info")
100
+ def read_info(request: Request):
101
+ print(request)
102
+ request_method = request.method
103
+ request_headers = request.headers
104
+ request_body = request.body
105
+ return {
106
+ "request_method": request_method,
107
+ "request_headers": request_headers,
108
+ "request_body": request_body,
109
+ }
110
+
111
  @app.post(api_base+"/reset")
112
  def reset():
113
  print("Received reset request")
 
134
  return heartbeat()
135
 
136
  @app.get(api_base+"/collections")
137
+ def list_collections(request: Request):
138
  print("Received list_collections request")
139
+ print(request)
140
  return bkend.list_collections()
141
 
142
  @app.post(api_base+"/collections")
 
167
  @app.post(api_base+"/collections/{collection_id}/upsert")
168
  def upsert(collection_id:str, upsert: AddEmbedding):
169
  print("Received upsert request")
170
+ #try:
171
+ # print("Received upsert request",upsert)
172
+ #except Exception:
173
+ # pass
174
  return bkend._upsert(collection_id=_uuid(collection_id),embeddings=upsert.embeddings,metadatas=upsert.metadatas,documents=upsert.documents,ids=upsert.ids,increment_index=upsert.increment_index)
175
 
176
  @app.post(api_base+"/collections/{collection_id}/get")