Skip to content

Commit

Permalink
Bump Version 0.5.11
Browse files Browse the repository at this point in the history
  • Loading branch information
blythed committed Jan 30, 2025
1 parent ecd5e62 commit 6ab55be
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "superduper-framework"
description = "🔮 Bring AI to your favourite database 🔮"
readme = "README.md"
version = '0.5.10'
version = '0.5.11'
license = {file = "LICENSE"}
maintainers = [{name = "superduper.io, Inc.", email = "[email protected]"}]
keywords = [
Expand Down
39 changes: 39 additions & 0 deletions snowflake_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import json

from superduper_openai import OpenAIEmbedding
from superduper import *
from superduper.components.datatype import Vector

CFG.auto_schema = True
CFG.vector_search_engine = 'snowflake'
CFG.data_backend = 'snowflake://softwareuser:SU4yv6DfUPUL0CPDdsCDDSLttVc@ngkjqqn-superduperdbeu/myuser_db/data'

m = OpenAIEmbedding(
'test',
model='text-embedding-ada-002',
example='test',
)

db = superduper()
db.cfg.auto_schema = True

with open('text.json') as f:
data = json.load(f)

db['test'].insert(data).execute()

vector_index = VectorIndex(
'test',
indexing_listener=Listener(
'test',
model=m,
select=db['test'].select(),
key='txt'
),
measure='l2'
)

db.apply(vector_index, force=True)

for r in db['test'].like({'txt': 'Axel Covin'}, n=1, vector_index='test').select().execute():
print(r['txt'])
3 changes: 3 additions & 0 deletions superduper/components/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ def _prepare_inputs_from_select(
mapping = Mapping(X, self.signature)
if in_memory:
docs = list(self.db.execute(select.select_using_ids(ids)))
pid = select.table_or_collection.primary_id
lookup = {r[pid]: r for r in docs}
docs = [lookup[id_] for id_ in ids]
X_data = list(map(lambda x: mapping(x), docs))
else:
assert isinstance(self.db, Datalayer)
Expand Down
1 change: 1 addition & 0 deletions text.json

Large diffs are not rendered by default.

0 comments on commit 6ab55be

Please sign in to comment.