Skip to content

Commit f7d65c3

Browse files
speedstorm1copybara-github
authored andcommitted
docs: Make small fixes to file import documentation
PiperOrigin-RevId: 658832626
1 parent 718c199 commit f7d65c3

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

vertexai/preview/rag/rag_data.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,14 @@ def import_files(
290290
```
291291
import vertexai
292292
from vertexai.preview import rag
293+
from google.protobuf import timestamp_pb2
293294
294295
vertexai.init(project="my-project")
295296
# Google Drive example
296-
paths = ["https://drive.google.com/file/123", "https://drive.google.com/file/456"]
297+
paths = [
298+
"https://drive.google.com/file/d/123",
299+
"https://drive.google.com/drive/folders/456"
300+
]
297301
# Google Cloud Storage example
298302
paths = ["gs://my_bucket/my_files_dir", ...]
299303
@@ -305,9 +309,9 @@ def import_files(
305309
)
306310
307311
# Slack example
308-
start_time = protobuf.timestamp_pb2.Timestamp()
309-
start_time.GetCurrentTime()
310-
end_time = protobuf.timestamp_pb2.Timestamp()
312+
start_time = timestamp_pb2.Timestamp()
313+
start_time.FromJsonString('2020-12-31T21:33:44Z')
314+
end_time = timestamp_pb2.Timestamp()
311315
end_time.GetCurrentTime()
312316
source = rag.SlackChannelsSource(
313317
channels = [
@@ -342,7 +346,7 @@ def import_files(
342346
corpus_name: The name of the RagCorpus resource into which to import files.
343347
Format: ``projects/{project}/locations/{location}/ragCorpora/{rag_corpus}``
344348
or ``{rag_corpus}``.
345-
paths: A list of uris. Elligible uris will be Google Cloud Storage
349+
paths: A list of uris. Eligible uris will be Google Cloud Storage
346350
directory ("gs://my-bucket/my_dir") or a Google Drive url for file
347351
(https://drive.google.com/file/... or folder
348352
"https://drive.google.com/corp/drive/folders/...").
@@ -401,11 +405,15 @@ async def import_files_async(
401405
```
402406
import vertexai
403407
from vertexai.preview import rag
408+
from google.protobuf import timestamp_pb2
404409
405410
vertexai.init(project="my-project")
406411
407412
# Google Drive example
408-
paths = ["https://drive.google.com/file/123", "https://drive.google.com/file/456"]
413+
paths = [
414+
"https://drive.google.com/file/d/123",
415+
"https://drive.google.com/drive/folders/456"
416+
]
409417
# Google Cloud Storage example
410418
paths = ["gs://my_bucket/my_files_dir", ...]
411419
@@ -417,9 +425,9 @@ async def import_files_async(
417425
)
418426
419427
# Slack example
420-
start_time = protobuf.timestamp_pb2.Timestamp()
421-
start_time.GetCurrentTime()
422-
end_time = protobuf.timestamp_pb2.Timestamp()
428+
start_time = timestamp_pb2.Timestamp()
429+
start_time.FromJsonString('2020-12-31T21:33:44Z')
430+
end_time = timestamp_pb2.Timestamp()
423431
end_time.GetCurrentTime()
424432
source = rag.SlackChannelsSource(
425433
channels = [
@@ -454,7 +462,7 @@ async def import_files_async(
454462
corpus_name: The name of the RagCorpus resource into which to import files.
455463
Format: ``projects/{project}/locations/{location}/ragCorpora/{rag_corpus}``
456464
or ``{rag_corpus}``.
457-
paths: A list of uris. Elligible uris will be Google Cloud Storage
465+
paths: A list of uris. Eligible uris will be Google Cloud Storage
458466
directory ("gs://my-bucket/my_dir") or a Google Drive url for file
459467
(https://drive.google.com/file/... or folder
460468
"https://drive.google.com/corp/drive/folders/...").

0 commit comments

Comments
 (0)