Repository navigation
Expand file tree
/
Copy pathDocumentationService.ts
More file actions
223 lines (163 loc) · 3.8 KB
/
Copy pathDocumentationService.ts
File metadata and controls
223 lines (163 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
const DocumentationService = {
async fetchCLIDocumentation(): Promise<string> {
try {
return `# Feast CLI Reference
## feast apply
Apply changes to a feature store. This command should be run after modifying
feature definitions.
**Usage:**
\`\`\`
feast apply
\`\`\`
**Options:**
- \`--skip-source-validation\`: Skip validation of data sources.
---
## feast materialize
Materialize features from an offline store into an online store.
**Usage:**
\`\`\`
feast materialize START_TS END_TS
\`\`\`
**Options:**
- \`--views\`: Feature views to materialize.
---
## feast registry-dump
Dump registry contents to local file.
**Usage:**
\`\`\`
feast registry-dump REGISTRY_PATH
\`\`\`
---
## feast serve
Start a feature server.
**Usage:**
\`\`\`
feast serve
\`\`\`
**Options:**
- \`--host\`: Specify host for the server.
- \`--port\`: Specify port for the server.
`;
} catch (error) {
console.error("Error fetching CLI documentation:", error);
return "# Error\nFailed to load CLI documentation.";
}
},
async fetchSDKDocumentation(): Promise<string> {
try {
return `# Feast SDK Reference
## FeatureStore
The main entry point for interacting with Feast.
\`\`\`python
from feast import FeatureStore
fs = FeatureStore(repo_path="path/to/feature_repo")
\`\`\`
### Methods
- \`apply()\`: Register feature definitions to the feature store.
- \`get_historical_features()\`: Retrieve historical feature values.
- \`get_online_features()\`: Retrieve the latest feature values.
- \`materialize()\`: Materialize features from offline to online store.
## FeatureView
Define a group of features that share the same data source and entities.
\`\`\`python
from feast import FeatureView, Feature, Entity, ValueType
driver = Entity(name="driver_id", value_type=ValueType.INT64)
driver_stats_view = FeatureView(
name="driver_stats",
entities=[driver],
ttl=timedelta(days=1),
features=[
Feature(name="conv_rate", dtype=ValueType.FLOAT),
Feature(name="acc_rate", dtype=ValueType.FLOAT),
],
batch_source=FileSource(path="path/to/data.parquet"),
)
\`\`\`
## Entity
Define an entity to join feature values with.
\`\`\`python
from feast import Entity, ValueType
driver = Entity(
name="driver_id",
value_type=ValueType.INT64,
description="Driver ID",
)
\`\`\`
`;
} catch (error) {
console.error("Error fetching SDK documentation:", error);
return "# Error\nFailed to load SDK documentation.";
}
},
async fetchAPIDocumentation(): Promise<string> {
try {
return `# Feast REST API Reference
## Feature Server Endpoints
### GET /health
Health check endpoint.
**Response:**
\`\`\`json
{
"status": "ok"
}
\`\`\`
### POST /get-online-features
Retrieve the latest feature values.
**Request:**
\`\`\`json
{
"features": [
"driver_stats:conv_rate",
"driver_stats:acc_rate"
],
"entities": {
"driver_id": [1001, 1002]
}
}
\`\`\`
**Response:**
\`\`\`json
{
"metadata": {
"feature_names": ["driver_stats:conv_rate", "driver_stats:acc_rate"]
},
"results": [
{
"values": [0.95, 0.79],
"statuses": ["PRESENT", "PRESENT"]
},
{
"values": [0.83, 0.85],
"statuses": ["PRESENT", "PRESENT"]
}
]
}
\`\`\`
### POST /push
Push feature values to the online store.
**Request:**
\`\`\`json
{
"push_source_name": "driver_stats_push_source",
"df": {
"driver_id": [1001, 1002],
"conv_rate": [0.95, 0.83],
"acc_rate": [0.79, 0.85],
"event_timestamp": ["2022-01-01T00:00:00Z", "2022-01-01T00:00:00Z"]
}
}
\`\`\`
**Response:**
\`\`\`json
{
"status": "success"
}
\`\`\`
`;
} catch (error) {
console.error("Error fetching API documentation:", error);
return "# Error\nFailed to load API documentation.";
}
},
};
export default DocumentationService;