heymenn commited on
Commit
db78288
·
verified ·
1 Parent(s): dd7eda0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -17,16 +17,28 @@ class InputData(BaseModel):
17
  class InputConstraints(BaseModel):
18
  constraints: Dict[str, str]
19
 
20
- class OutputData(BaseModel):
21
- technologies: list
22
-
23
- @app.post("/process", response_model=OutputData)
 
 
 
 
 
 
 
 
 
 
 
 
24
  async def process(data: InputData):
25
  result = process_input(data, global_tech, global_tech_embeddings)
26
  return {"technologies": result}
27
 
28
 
29
- @app.post("/process-constraints", response_model=OutputData)
30
  async def process_constraints(constraints: InputConstraints):
31
  result = process_input_from_constraints(constraints.constraints, global_tech, global_tech_embeddings)
32
  return {"technologies": result}
 
17
  class InputConstraints(BaseModel):
18
  constraints: Dict[str, str]
19
 
20
+ # This schema defines the structure for a single technology object
21
+ class Technology(BaseModel):
22
+ """Represents a single technology entry with its details."""
23
+ title: str
24
+ purpose: str
25
+ key_components: str
26
+ advantages: str
27
+ limitations: str
28
+ id: int
29
+
30
+ # This schema defines the root structure of the JSON
31
+ class TechnologyData(BaseModel):
32
+ """Represents the top-level object containing a list of technologies."""
33
+ technologies: List[Technology]
34
+
35
+ @app.post("/process", response_model=TechnologyData)
36
  async def process(data: InputData):
37
  result = process_input(data, global_tech, global_tech_embeddings)
38
  return {"technologies": result}
39
 
40
 
41
+ @app.post("/process-constraints", response_model=TechnologyData)
42
  async def process_constraints(constraints: InputConstraints):
43
  result = process_input_from_constraints(constraints.constraints, global_tech, global_tech_embeddings)
44
  return {"technologies": result}