GoogleCloudPlatform / GoogleCloudPlatform/nodejs-docs-samples
Extract embeddings values using PredictionServiceClient
- 主要言語
- JavaScript
- スター
- 3k
- フォーク
- 2k
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 44
説明
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
コントリビューションガイド
調査の方向性
参照されている行の ai-platform/snippets/predict-text-embeddings.js から始めて、PredictionServiceClient のレスポンスがどのように表現されているかを確認します。embeddings の値にアクセスする方法と、issue に示されている JSON 形式と出力を一致させるためにサンプルまたはそのドキュメントに明確化が必要かどうかを判断します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- google-cloud, javascript, node.js
- 領域
- api, machine-learning
- issue の種類
- ドキュメント
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100