Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make incognito work #44

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

barakplasma
Copy link

@barakplasma barakplasma commented Jun 17, 2024

closes #24

Implements incognito mode, and removes the groq api key floating around various places. Aggresively defaults to localai in order to avoid sending people's files to groq accidentally.

I think it's a breaking change to require ollama, which is actually needed to support image categorization.

P.S. I'm having trouble with create_file_tree, I can't figure out how to pass the incognito request to that function.

Also I did not test this outside the /batch endpoint from the api. So someone else should test the electron app / watch util if they care about it.

messages=[
{"content": FILE_PROMPT, "role": "system"},
{"content": json.dumps(summaries), "role": "user"},
{"content": WATCH_PROMPT, "role": "system"},
{"content": json.dumps(fs_events), "role": "user"},
],
model="llama3-70b-8192",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this global variable, because I think it can switch incognito mode on/off for different requests or paths. But I don't want to learn about the watch handler global function whatever, and definitely don't plan on testing it.

src/loader.py Outdated
@@ -152,7 +156,6 @@ async def summarize_image_document(doc: ImageDocument, client):
client = ollama.AsyncClient()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to switch this to litellm as well, but they don't make it easy to send a local file for vision because of a dependency on requests https://github.com/BerriAI/litellm/blob/3a35a58859a145a4a568548316a1930340e7440a/litellm/llms/prompt_templates/factory.py#L624-L635

@barakplasma barakplasma marked this pull request as draft June 17, 2024 20:09
@barakplasma barakplasma marked this pull request as draft June 17, 2024 20:09
@barakplasma barakplasma marked this pull request as draft June 17, 2024 20:09
@barakplasma
Copy link
Author

I still haven't gotten it to work consistently, so I changed it to a draft PR.

reader = SimpleDirectoryReader(input_files=[path]).iter_data()

docs = next(reader)
splitter = TokenTextSplitter(chunk_size=6144)
text = splitter.split_text("\n".join([d.text for d in docs]))[0]
doc = Document(text=text, metadata=docs[0].metadata)
summary = dispatch_summarize_document_sync(doc, client)
Copy link
Author

@barakplasma barakplasma Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these sync methods should come back for watch_util; or be replaced by a sync wrapper around the async ones (like https://stackoverflow.com/a/62949043 ) (I got rid of these out of naivety and a dislike of duplication)

@barakplasma
Copy link
Author

Ironically, my manual tests using groq finish in time, but my manual tests with ollama are too slow to finish, or it's not using a capable enough model on my machine.

refactor: remove ollama direct usage in favor of litellm direct usage
bug: didn't work on the full sample data, kept looping on the pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This is NOT running ollama, privacy issue
1 participant