gptscript-ai / knowledge

Knowledge for GPTScript
https://gptscript-ai.github.io/knowledge/
Apache License 2.0
29 stars 14 forks source link

add: pgvector vectorstore #140

Closed iwilltry42 closed 1 month ago

iwilltry42 commented 1 month ago

Comparison (using the exact same setup, just switching from chromem-go to pgvector - both using the same flow, embedding model and cosine similarity). Only the README.md of knowledge has been ingested. Query:

Top Results

chromem

Setup: default, no changes needed

{
          "id": "eeff81fc-1443-4266-9102-eda0eb532fa1",
          "content": "# GPTScript Knowledge Tool\n## Supported File Types\n- `.pdf`\n- `.html`\n- `.md`\n- `.txt`\n- `.docx`\n- `.odt`\n- `.rtf`\n- `.csv`\n- `.ipynb`\n- `.json`",
          "metadata": {
            "absPath": "/home/thklein/git/github.com/gptscript-ai/knowledge/README.md",
            "filename": "README.md"
          },
          "similarity_score": 0.8255993
        },

pgvector

Setup:

  1. Spin up pgvector locally via docker-compose (compose file provided in repo root): docker compose up
  2. Make knowledge use pgvector: export KNOW_VECTOR_DSN="pgvector://knowledge:knowledge@localhost:5432/knowledge?sslmode=disable"
 {
          "id": "931916aa-a192-4a5a-b54f-908c68453c65",
          "content": "# GPTScript Knowledge Tool\n## Supported File Types\n- `.pdf`\n- `.html`\n- `.md`\n- `.txt`\n- `.docx`\n- `.odt`\n- `.rtf`\n- `.csv`\n- `.ipynb`\n- `.json`",
          "metadata": {
            "absPath": "/home/thklein/git/github.com/gptscript-ai/knowledge/README.md",
            "filename": "README.md"
          },
          "similarity_score": 0.8421717
        },