Skip to content

Commit

Permalink
🚧 fix(wip): indexing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchinegod committed Jul 11, 2024
1 parent 57cfa34 commit 139f966
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = 'magnet'
copyright = '2023, Prismadic, LLC'
author = 'Prismadic, LLC.'
release = '0.3.11'
release = '0.3.12'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -29,7 +29,7 @@
display_github = True
html_logo = "../magnet.png"
pygments_style = 'dracula'
version = "v0.3.11"
version = "v0.3.12"
release = "latest"
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
Expand Down
2 changes: 1 addition & 1 deletion magnet/ic/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ async def deliver_messages(msgs):
loop.create_task(cb(self.magnet.os, e))
await asyncio.sleep(1)
else:
_f("info", f'consuming delta from [{self.magnet.config.category}] on\n🛰️ stream: {self.magnet.config.stream_name}\n🧲 session: "{self.magnet.config.session}"')
while True:
try:
msgs = await self.sub.fetch(batch=1, timeout=60)
Expand All @@ -302,7 +303,6 @@ async def deliver_messages(msgs):
_f("warn", f'retrying connection to {self.magnet.config.host.split("@")[1]}\n{e}')
_f("info", "this can also be a problem with your callback")
await asyncio.sleep(1)
_f("info", f'consuming delta from [{self.magnet.config.category}] on\n🛰️ stream: {self.magnet.config.stream_name}\n🧲 session: "{self.magnet.config.session}"')


async def worker(self, cb=print):
Expand Down
8 changes: 5 additions & 3 deletions magnet/ize/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def on(self, create: bool = False, initialize: bool = False):
if initialize:
self.db.initialize()

async def index(self, payload, msg, field=None, v=False, instruction="Represent this information for searching relevant passages: "):
async def index(self, payload=None, msg=None, field=None, v=False, instruction="Represent this information for searching relevant passages: "):
if not msg or not payload:
return _f('fatal', 'no field message and/or payload to ack!')
if field:
Expand Down Expand Up @@ -64,8 +64,10 @@ async def index(self, payload, msg, field=None, v=False, instruction="Represent
text=_chunk,
document=payload.document
)
_f('info', f'sending payload\n{_chunk}') if v else None
_f('info', f'sending payload\n{_chunk}')
await self.field.pulse(payload)
else:
_f('warn', f'embedding exists') if v else None
else:
embedding = self._model.encode(text_to_encode, normalize_embeddings=True)
if not self.is_dupe(q=embedding):
Expand All @@ -84,7 +86,7 @@ async def index(self, payload, msg, field=None, v=False, instruction="Represent
_f('info', f'sending payload\n{payload}') if v else None
await self.field.pulse(payload)
else:
_f('warn', f'embedding exists\n{payload}')
_f('warn', f'embedding exists') if v else None
await msg.ack_sync()
except Exception as e:
_f('fatal', e)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "llm_magnet"
version = "0.3.11"
version = "0.3.12"
description = "the small distributed language model toolkit. fine-tune state-of-the-art LLMs anywhere, rapidly."
readme = "dynamic"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='llm_magnet',
version='0.3.11',
version='0.3.12',
description="the small distributed language model toolkit. fine-tune state-of-the-art LLMs anywhere, rapidly.",
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 139f966

Please sign in to comment.