Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chatbot-lab-groupe4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leo.pellandi
chatbot-lab-groupe4
Commits
09e5d346
Commit
09e5d346
authored
8 months ago
by
abir.chebbi
Browse files
Options
Downloads
Patches
Plain Diff
add argument local_path to main.py
parent
1ac59397
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Part 1/main.py
+5
-7
5 additions, 7 deletions
Part 1/main.py
README.md
+1
-0
1 addition, 0 deletions
README.md
with
6 additions
and
7 deletions
Part 1/main.py
+
5
−
7
View file @
09e5d346
...
...
@@ -11,9 +11,6 @@ import json
import
argparse
## Local directory for storing PDF files
LOCAL_DIR
=
"
pdfs
"
## S3_client
...
...
@@ -127,7 +124,7 @@ def generate_store_embeddings(bedrock_client, chunks,awsauth,index_name):
## main
def
main
(
bucket_name
,
endpoint
,
index_name
):
def
main
(
bucket_name
,
endpoint
,
index_name
,
local_path
):
## Opensearch Client
OpenSearch_client
=
OpenSearch
(
...
...
@@ -139,8 +136,8 @@ def main(bucket_name, endpoint,index_name):
)
download_documents
(
bucket_name
,
LOCAL_DIR
)
loader
=
PyPDFDirectoryLoader
(
LOCAL_DIR
)
download_documents
(
bucket_name
,
local_path
)
loader
=
PyPDFDirectoryLoader
(
local_path
)
docs
=
loader
.
load
()
print
(
docs
[
1
])
chunks
=
split_text
(
docs
,
1000
,
100
)
...
...
@@ -168,5 +165,6 @@ if __name__== "__main__":
parser
.
add_argument
(
"
--bucket_name
"
,
help
=
"
The S3 bucket name where documents are stored
"
)
parser
.
add_argument
(
"
--endpoint
"
,
help
=
"
The OpenSearch service endpoint
"
)
parser
.
add_argument
(
"
--index_name
"
,
help
=
"
The name of the OpenSearch index
"
)
parser
.
add_argument
(
"
--local_path
"
,
help
=
"
local path
"
)
args
=
parser
.
parse_args
()
main
(
args
.
bucket_name
,
args
.
endpoint
,
args
.
index_name
)
main
(
args
.
bucket_name
,
args
.
endpoint
,
args
.
index_name
,
args
.
local_path
)
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
09e5d346
...
...
@@ -48,6 +48,7 @@ Where:
-
**--bucket_name**
: The name of the S3 bucket containing the PDF files.
-
**--endpoint**
: Endpoint for the vector database.
-
**--index_name**
: The index_name where to store the embeddings in the collection.
-
**--local_dir**
:
The main.py script will:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment