GoogleCloudPlatform / GoogleCloudPlatform/nodejs-docs-samples
Extract embeddings values using PredictionServiceClient
- Ngôn ngữ chính
- JavaScript
- Star
- 3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 44
Mô tả
Hi! I'm trying to find how to extract the embeddings values to add them to a json files following this format following the example https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/62253bb75d6068e1b44047eac5572246dfaa217b/ai-platform/snippets/predict-text-embeddings.js#L76C69-L76C69:
{"id":"0","embedding":[0.005268869,-0.019839672,0.0035084013,0.0536439,-0.028307509,0.0037563213, ...]}
But not sure how to access or put them into an array. The type is google.protobuf.IValue so in the example it iterates over an array google.protobuf.IValue[]. I'm doing:
```
const predictions = response.predictions;
for (const prediction of predictions) {
const value: google.protobuf.IValue = prediction;
console.log(`\t\tPrediction`, value.structValue); // structValue is the only one not returning undefined
// this returns: **fields: { embeddings: { structValue: [Object], kind: 'structValue' } }**
}
```
Thanks
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với ai-platform/snippets/predict-text-embeddings.js tại dòng được tham chiếu và kiểm tra cách các phản hồi của PredictionServiceClient được biểu diễn. Xác định cách truy cập các giá trị embeddings và liệu ví dụ hoặc tài liệu của nó có cần được làm rõ để đầu ra khớp với định dạng JSON được hiển thị trong issue hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- google-cloud, javascript, node.js
- Lĩnh vực
- api, machine-learning
- Loại issue
- Tài liệu
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100