CREATE TABLE IF NOT EXISTS public.test_example
(
id character varying(255) COLLATE pg_catalog."default" NOT NULL,
embeddings vector(1536),
CONSTRAINT test_example_pkey PRIMARY KEY (id)
)
CREATE USER myuser WITH PASSWORD 'mypassword';
CREATE DATABASE mydb;
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
退出命令行
\q
exit
安裝PgAdmin
以下為安裝的指令建議
$ sudo mkdir /var/lib/pgadmin
$ sudo mkdir /var/log/pgadmin
$ sudo chown $USER /var/lib/pgadmin
$ sudo chown $USER /var/log/pgadmin
$ python3 -m venv pgadmin4
$ source pgadmin4/bin/activate
(pgadmin4) $ pip install pgadmin4
...
(pgadmin4) $ pgadmin4
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: user@domain.com
Password:
Retype password:
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
* Serving Flask app "pgadmin" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
$ sudo mkdir /var/lib/pgadmin
$ sudo mkdir /var/log/pgadmin
$ sudo chown $USER /var/lib/pgadmin
$ sudo chown $USER /var/log/pgadmin
$ python3 -m venv pgadmin4
$ source pgadmin4/bin/activate
(pgadmin4) $ pip install pgadmin4
...
(pgadmin4) $ pgadmin4
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: user@domain.com
Password:
Retype password:
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
* Serving Flask app "pgadmin" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
retriever.retrieve('What is the difference between a stock and a bond?')
檢索出的資訊
[NodeWithScore(node=Document(id_='nHcbHdgVUJg', embedding=[0.006401017773896456, -0.02431839518249035, -0.005019601434469223, -0.03640920668840408, -0.021309370175004005, 0.02166498266160488, ......, -0.011140232905745506], metadata={'video_id': 'nHcbHdgVUJg'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={}, text="I'm a Commerce graduate I went to Vijay\nCollege which is like a Government\nCollege type so I'm also not from IIT\nI graduated from MIT Pune Pu......t for it or not and like\nnobody tell you that you're cut out to\nbe a founder or not one thing which\nwhich is common in all the founders who\nsucceed is they don't give up so that's\nwhat that's probably yeah so\nhello", start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\n\n{content}', metadata_template='{key}: {value}', metadata_seperator='\n'), score=0.7269996487772504)]