googleapis / googleapis/nodejs-agentplatform

How to create datastore using node js sdk?

Open
#513 1 comment 0 reactions 0 assignees View on GitHub
api: aiplatform priority: p3 type: question
Dominant language
TypeScript
Stars
182
Forks
69
Avg merge
1d 8h
Merged PRs (30d)
10

Description

Thanks for stopping by to ask us a question! Please make sure to include:
- What you're trying to do
I am trying to add multiple files and create a datstore, and then use the datastore to create an app which can be used for querying.
- What code you've already tried
```JS
const axios = require('axios');

const token = 'REDACTED'; // from above
const projectId = 'REDACTED'; // your project ID
const location = 'global';
const dataStoreId = 'storage-bucket_1744041034889';
const branch = 'default_branch'; // usually default
const schemaId = 'default_schema';

const parent = `projects/${projectId}/locations/${location}/collections/default_collection/dataStores/${dataStoreId}/branches/${branch}`;

// Sample unstructured data from your API
const yourUnstructuredText = "Speaker 0 (00:35): Okay, so, um, I'm gonna navigate to the platform base.com and I'll click get started. So, um, it's opening set all, um, of this and yeah, I'm going to be click on get started and I'll register on the platform. So I'm gonna register with my, um, email address\nSpeaker 0 (01:29): And I'm gonna be, um, putting in, um, my password as well. And, um, oh, I have to get started not signing, 'cause I don't, I do not have an account there. I don't wanna say. So I'm gonna input my first name and my last name, then my email address as requested. Yeah. Then set the password for myself. Yeah. Then I create an account. No, I don't wanna save it. So I'm gonna just click on my email to, let me see. I'll open my email. A um, a link has been sent to verify my Okay. I verify my email, email address, my account through my email. So, uh, my email has been verified so I can't then return to my accounts. So I have to sign in with, um, the email and password I just created since my account has been verified. Okay. I just sign in. No, I don't wanna save it. So, um, I'm asked to upload a video file an audio file. A text file or a PDF. Okay. Post and look. Okay. I'm just gonna click here and browse through my, um, looking for, um, a document to, to upload. I'm trying to, um, let me look for something. I can just upload and Yeah. Something that, that's not, that is not so confidential. Okay. I'm just gonna,\nSpeaker 0 (05:04): So I'm just, um, just gonna upload. Okay. Yeah. Oh, it's supposed to be a PDF. Okay. And just save it as a PDF just as long. Save it as a PDF. Yeah. Save as a PDF, save it and um, yeah, go back to where, okay. Okay. Yeah, upload. Okay. It's been uploaded but a meeting using the patient integrations. Okay. So, um, I've been asked to record or using the, um, link of the meeting. Okay. Let me just copy the link of the meeting from here. I'm just gonna come here and paste. I'm just gonna record, start recording. Okay. Um, um, record. I don't know if, okay, it has started record. We request to join your meeting. Please admit and let them. Okay, so I have to admit the either bot, either bots, so I'm looking for when ADA bot is gonna join the meeting. ADA bot, where are you waiting for you to join the meeting? So once the ADA bot joins the meeting, I'm gonna interact with the ADA chat feature to summarize and synthesize a single source. We are waiting for the either box. Either box is not coming up or joining the meeting. I don't know. Um, let's try to start the recording again. So I'm just gonna piece, uh, the link of the meeting and, um, sorry, let me recopy, um, the zoom link? Yeah, this is the zoom link. Um,\nSpeaker 0 (09:29): Okay. Um, the, um, the Zoom link. Let me just, we were just gonna, um, just trying to copy the link of the meeting so that, um, yeah, this is the meeting. This is the meeting. Yeah. So, um, I don't know, um, my Zoom seems to be giving me some issues. Okay. So, um, I'm trying to navigate and figure it out. So just, um, I'm just gonna paste link of the meeting here. Yeah, that's too. So we are asking, joined the meeting. Oh, okay. So I'm waiting for the IDA bots. I can't seem to find the IDA bots anywhere here, but this kind of, it's kind of not easy to to navigate honestly. Look at and play. Oh, I'm back to the meeting. This is my screen, so I'm just gonna, yeah, this is the either bot, but I can't, seems to find the, um, recording. I can't, seems to record a meeting. Okay. Record the meeting using the locate and play recorded meeting. I don't, I honestly don't know where the recorded meeting is and, um, knowing Okay. Recordings. Yeah. Record meeting. Let me paste the record. Okay. Joining call session is being recorded is,\nSpeaker 0 (14:08): I can't seem to find the iPods. I don't know where that is. I thought it was gonna pop up once I um, okay. Recording as such, no sources found, no resources found. Okay. No resources has been found. Okay. Um, I, and play recorded meeting. I can't seem to find that. Interact with the, I I'm trying to record, I don't know. Let me try to paste the link one more time. These are there.\nSpeaker 0 (15:25): Okay, so no resources found, I don't know why. Okay. And download the transcription of the notes. Adjust application settings. Okay. Um, let me adjust the application setting. Dark mode, light mode. The contrast, no con, no contrast. Um, okay. Navigate the layouts. Okay. If we want it like this, we want it in the middle, we want it by the side, we want it the way. Oh, okay. That makes sense. We want it compact. We don't want it compact. Left. Oh, okay. This moves to the left or to the right. Sorry. And this comes to the left. So that's what that does. The different mode of presentation can present like this, present like this resets, resets, family popping the size. It can reduce the size, it can increase it, you can have a more big without picture size. I think that's what that is for. Then the font size, we can have different font size. Then you can have a full screen you can press escape to. I can close this and join this. So, um, I don't know my,\nSpeaker 1 (17:32): I,\nSpeaker 0 (18:14): So it's just me. I'm the host. There's no either chats box account, seems to find the either chat box. So let me try to reach the instruction again. Maybe I could figure it out. But honestly figuring this out is not is the instructions. The instructions aren't straightforward at all. Record the meeting using the integration. Okay, let me go. Integration. This is the record button. Yes, I guess. Okay. Yeah. Meeting you are, yeah, that's the meeting code. Is it? I've got that. So I just, um, I don't know. So I'm just trying to figure out where, um, recordings, um, I guess, um, the, um, either bot is hidden somewhere. I don't know what does this or English gonna be assessed.\nSpeaker 1 (21:25): So\nSpeaker 0 (21:28): I have to go back, have to go back, go back to return to dashboard. I can't seem to return to dashboard. That's, that's crazy. But dashboard is work. I think this still needs a lot of working now because I can't see, I can't seem to be able to get the text. Same recording started successful.\nSpeaker 0 (22:06): Lemme try it again and join meeting. Oh, okay. Is not share that. Okay. So anybody's joined. I'm still waiting to see if either box is going to be joining. So I honestly don't know what's going on. The, um, the whole screen as the whole stuff has mumbled up. My, um, zoom meeting. I don't know which is working again. Is it the, is this my normal meeting or is this, is this the IDA Bots meeting? I think it's here is the, for the IDA Bots. I don't know. Okay. So if that is, it's, so when is, um, either bots going to join us. Hi IBots.\nSpeaker 0 (24:36): There's no I bots. I, anyway. Could it be the I bots? Is I, I have no idea. I think I'm honestly don't know what's going on. One sources, one sources. Um, let's see the recording. Lemme try one more time and see if I would, um, be lucky this time. Now I honestly don't know what's going on to be honest. I do not know what's going on. So I think, um, this platform still needs, um, still needs to be worked on and a lot needs to be corrected and and stopped. And this is where I had the meeting, I pray. I hope it's recording.";

const documentId = '1232';
const documentPayload = {
id: documentId,
schemaId: schemaId,
structData: {
fields: {
content: { stringValue: yourUnstructuredText },
mimeType: { stringValue: 'text/plain' }
}
}
};

// 🚀 Send it as the body directly — no wrapping object
axios.post(
`https://discoveryengine.googleapis.com/v1beta/${parent}/documents?documentId=${documentId}`,
documentPayload,
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
}
}
)
.then(res => {
console.log('✅ Uploaded:', res.data.name);
})
.catch(err => {
console.error('❌ Error:', err.response?.data || err.message);
});
```
- Any error messages you're getting
When creating datastore like I am not able to query it, it returns the json itself and not the summary.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.