Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/llm/langchain-core-0.1.35
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJimmyNowak authored Mar 29, 2024
2 parents d6a38c3 + a3d7b88 commit 36df3b5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion api/chunks/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-25 19:36
# Generated by Django 5.0.2 on 2024-03-29 09:07

import django.db.models.deletion
import pgvector.django
Expand Down
1 change: 0 additions & 1 deletion api/chunks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
def create_document():
return Document.objects.create(
text="example",
embedding=list(range(1, 11)),
)


Expand Down
2 changes: 1 addition & 1 deletion api/documents/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-25 19:36
# Generated by Django 5.0.2 on 2024-03-29 09:07

import pgvector.django
from django.db import migrations, models
Expand Down
16 changes: 16 additions & 0 deletions api/documents/migrations/0002_remove_document_embedding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 5.0.2 on 2024-03-29 09:08

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("documents", "0001_initial"),
]

operations = [
migrations.RemoveField(
model_name="document",
name="embedding",
),
]
2 changes: 0 additions & 2 deletions api/documents/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from django.db import models
from pgvector.django import VectorField


class Document(models.Model):
text = models.TextField[str, str]()
embedding = VectorField[list[float], VectorField](dimensions=10)
2 changes: 0 additions & 2 deletions api/documents/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

class DocumentIn(Schema):
text: str
embedding: list[float]


class DocumentOut(Schema):
id: int
text: str
embedding: list[float]
8 changes: 4 additions & 4 deletions api/documents/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def create_document():
return Document.objects.create(text="example", embedding=list(range(1, 11)))
return Document.objects.create(text="example")


class DocumentModelTests(TestCase):
Expand All @@ -31,9 +31,9 @@ def test_put_method(self):
).exists(), "Can't create document object"
document.text = "notexample"
document.save()
assert all(
a == b for a, b in zip(document.embedding, range(1, 10))
), "Can't update document object"
assert Document.objects.filter(
text="notexample"
).exists(), "Can't update document object"

@pytest.mark.django_db
def test_delete_method(self):
Expand Down
10 changes: 5 additions & 5 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
django = "^4.2.7"
django = "^4.2.11"
uvicorn = "^0.24.0.post1"
channels = "^4.0.0"
psycopg2-binary = "^2.9.9"
Expand Down

0 comments on commit 36df3b5

Please sign in to comment.