Skip to content

Commit 031967c

Browse files
still modfiying
1 parent 064dce0 commit 031967c

File tree

7 files changed

+273
-413
lines changed

7 files changed

+273
-413
lines changed

module_4_rag/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ Then run
2121
```bash
2222
python batch_score_documents.py
2323
```
24-
Which will output data to `city_wikipedia_summaries_with_embeddings.parquet`
24+
Which will output data to `data/city_wikipedia_summaries_with_embeddings.parquet`
2525

26+
Next we'll need to do some Feast work and move the data into a repo created by
27+
Feast.
2628
## Feast
2729

2830
To get started, make sure to have Feast installed and PostGreSQL.

module_4_rag/app.py

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,13 @@
66
)
77
from flasgger import Swagger
88
from datetime import datetime
9-
from get_features import (
10-
get_onboarding_features,
11-
get_onboarding_score,
12-
get_daily_features,
13-
get_daily_score,
14-
)
15-
from ml import make_risk_decision
169

1710
app = Flask(__name__)
1811
swagger = Swagger(app)
1912

2013

21-
@app.route("/")
22-
def onboarding_page():
23-
return render_template("index.html")
24-
25-
26-
@app.route("/home")
27-
def home_page():
28-
return render_template("home.html")
29-
30-
31-
@app.route("/onboarding-risk-features/", methods=["POST"])
32-
def onboarding_features():
14+
@app.route("/get_documents")
15+
def get_documents():
3316
"""Example endpoint returning features by id
3417
This is using docstrings for specifications.
3518
---
@@ -39,60 +22,27 @@ def onboarding_features():
3922
in: query
4023
required: true
4124
default: NJ
42-
43-
- name: ssn
44-
type: string
45-
in: query
46-
required: true
47-
default: 123-45-6789
48-
49-
- name: dl
50-
type: string
51-
in: query
52-
required: true
53-
default: some-dl-number
54-
55-
- name: dob
56-
type: string
57-
in: query
58-
required: true
59-
default: 12-23-2000
6025
responses:
6126
200:
62-
description: A JSON of features
27+
description: A JSON of documents
6328
schema:
64-
id: OnboardingFeatures
29+
id: Document ID
6530
properties:
6631
is_gt_18_years_old:
6732
type: array
6833
items:
6934
schema:
7035
id: value
7136
type: number
72-
is_valid_state:
73-
type: array
74-
items:
75-
schema:
76-
id: value
77-
type: number
78-
is_previously_seen_ssn:
79-
type: array
80-
items:
81-
schema:
82-
id: value
83-
type: number
84-
is_previously_seen_dl:
85-
type: array
86-
items:
87-
schema:
88-
id: value
89-
type: number
9037
"""
91-
r = request.args
92-
feature_vector = get_onboarding_features(
93-
r.get("state"), r.get("ssn"), r.get("dl"), r.get("dob")
94-
)
95-
return jsonify(feature_vector)
38+
question = request.form["question"]
39+
documents = store.get_online_documents(query)
40+
return render_template("documents.html", documents=documents)
41+
42+
43+
@app.route("/")
44+
def home():
45+
return render_template("home.html")
9646

9747

9848
if __name__ == "__main__":

module_4_rag/feature_repo/data/city_wikipedia_summaries.csv

Lines changed: 256 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.

module_4_rag/feature_repo/feature_store.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ online_store:
1010
host: 127.0.0.1
1111
port: 5432
1212
database: feast
13-
user: ""
13+
user: "demo_user"
1414
password: ""
1515

1616

module_4_rag/feature_repo/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from entities import item
1010

1111

12-
parquet_file_path = "../data/city_wikipedia_summaries_with_embeddings.parquet"
12+
parquet_file_path = "./data/city_wikipedia_summaries_with_embeddings.parquet"
1313

1414
source = FileSource(
1515
file_format=ParquetFormat(),

0 commit comments

Comments
 (0)