Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pgvector support for Haskell

License

NotificationsYou must be signed in to change notification settings

pgvector/pgvector-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgvector support for Haskell

Supportspostgresql-simple

Build Status

Getting Started

Add this line to your application’s.cabal file underbuild-depends:

pgvector >= 0.1 && < 0.2

And follow the instructions for your database library:

postgresql-simple

Import the library

importPgvector

Enable the extension

execute_ conn"CREATE EXTENSION IF NOT EXISTS vector"

Create a table

execute_ conn"CREATE TABLE items (embedding vector(3))"

Insert a vector

execute conn"INSERT INTO items (embedding) VALUES (?)"    [Vector [1,1,1]]

Get the nearest neighbors

let q="SELECT embedding FROM items ORDER BY embedding <-> ? LIMIT 5"forEach conn q [Vector [1,1,1]]$\(Only embedding)->putStrLn$show (embedding::Vector)

Add an approximate index

execute_ conn"CREATE INDEX ON items USING hnsw (embedding vector_l2_ops)"-- orexecute_ conn"CREATE INDEX ON items USING ivfflat (embedding vector_l2_ops) WITH (lists = 100)"

Usevector_ip_ops for inner product andvector_cosine_ops for cosine distance

See afull example

History

View thechangelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/pgvector/pgvector-haskell.gitcd pgvector-haskellcreatedb pgvector_haskell_testcabaltest

About

pgvector support for Haskell

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp