generated from habedi/template-python-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
121 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
[tool.poetry] | ||
name = "easy-letters" | ||
version = "0.1.8" | ||
description = "A Python package for generating draft application letters using generative AI" | ||
description = "A Python library for generating draft application letters using generative AI" | ||
authors = ["Hassan Abedi <[email protected]>"] | ||
maintainers = ["Hassan Abedi <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{ include = "easy_letters", from = "." }] | ||
include = ["README.md", "LICENSE"] | ||
include = ["README.md"] | ||
license = "MIT" | ||
repository = "https://github.com/habedi/easy-letters" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
openai = "^1.16.1" | ||
qdrant-client = "^1.8.2" | ||
numpy = "^2.2.3" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
jupyter = "^1.0.0" | ||
poetry-dynamic-versioning = "^1.4.0" | ||
pytest = "^8.2.2" | ||
black = ">=24.4.2,<26.0.0" | ||
pytest-mock = "^3.14.0" | ||
pytest-cov = ">=5,<7" | ||
poetry-dynamic-versioning = "^1.4.0" | ||
tiktoken = ">=0.7,<0.10" | ||
pandas = "^2.2.2" | ||
pytest-mock = "^3.14.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
jupyter = "^1.0.0" | ||
tiktoken = ">=0.7,<0.10" | ||
ruff = "^0.9.9" | ||
|
||
[tool.poetry-dynamic-versioning] | ||
enable = true | ||
vcs = "git" | ||
versioning = "semver" # Semantic Versioning | ||
|
||
#[build-system] | ||
#requires = ["poetry-core"] | ||
#build-backend = "poetry.core.masonry.api" | ||
|
||
#[build-system] | ||
#requires = ["pdm-backend"] | ||
#build-backend = "pdm.backend" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import numpy as np | ||
|
||
from easy_letters import Ranker | ||
|
||
# Sample documents and their embeddings for testing | ||
documents_with_embeddings = { | ||
'text': ["Document 1", "Document 2"], | ||
'embedding': [np.array([0.1, 0.2, 0.3]), np.array([0.4, 0.5, 0.6])] | ||
} | ||
|
||
# Sample embedding to search for similar documents | ||
embedding_to_search = np.array([0.1, 0.2, 0.3]) | ||
|
||
# The expected response (score is Cosine similarity) | ||
search_response = [ | ||
{"id": 0, "score": 1.0, "payload": {"text": "Document 1"}}, | ||
{"id": 1, "score": 0.9746, "payload": {"text": "Document 2"}} | ||
] | ||
|
||
|
||
def test_make_collection(): | ||
""" | ||
Test the make_collection method of the Ranker class. | ||
This test checks if the collection is created successfully with the correct | ||
parameters. | ||
""" | ||
# Arrange | ||
ranker = Ranker() | ||
collection_name = "test_collection" | ||
|
||
# Act | ||
ranker.make_collection(documents_with_embeddings, collection_name) | ||
|
||
# Assert | ||
coll = ranker.client.get_collection(collection_name) | ||
assert coll is not None | ||
assert coll.points_count == 2 | ||
assert coll.config.params.vectors.size == 3 | ||
assert coll.config.params.vectors.distance == "Cosine" |
Oops, something went wrong.