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

Smart Chat is not answering simple queries correctly (or does not have the data) #441

Closed
annie-elequin opened this issue Feb 3, 2024 · 2 comments

Comments

@annie-elequin
Copy link

annie-elequin commented Feb 3, 2024

Hello, I'm having some trouble with Smart Chat. I have an extremely small vault, I actually decided to start using Obsidian BECAUSE of Smart Connections.

Lets say I have a note with a gate code to a vacation home. The note will have in it:

"The gate code to the mountain cabin is 1234."

I ask Smart Chat "What is the gate code to the mountain cabin?"

Expected Behavior:

Smart Chat answers "The gate code is 1234."

Actual Behavior:

Smart Chat answers "Based on your notes, there is no information provided about a code for the lakehouse."


It's true that the prompt (using the copy feature in smart chat) does not seem to have the note in question.

Settings info:

image image

perhaps this is some kind of embeddings issue? How can I ensure that all my notes are embedded correctly? Or is there something else going on here?

Here is a screenshot where the error linked me to in the code - line 4427.
image

VM330:1 Uncaught SyntaxError: Expected ',' or ']' after array element in JSON at position 223
    at JSON.parse (<anonymous>)
    at eval (plugin:smart-connections:4427:33)
    at eval (plugin:smart-connections:3794:13)
    at Array.every (<anonymous>)
    at ScStreamer.dispatchEvent (plugin:smart-connections:3793:45)
    at ScStreamer.eval (plugin:smart-connections:3836:18)
    at Array.forEach (<anonymous>)
    at ScStreamer._onStreamProgress (plugin:smart-connections:3834:40)
eval @ plugin:smart-connections:4427
eval @ plugin:smart-connections:3794
dispatchEvent @ plugin:smart-connections:3793
eval @ plugin:smart-connections:3836
_onStreamProgress @ plugin:smart-connections:3834
XMLHttpRequest.send (async)
stream @ plugin:smart-connections:3900
full_str @ plugin:smart-connections:4453
request_chatgpt_completion @ plugin:smart-connections:4402
initialize_response @ plugin:smart-connections:4216
await in initialize_response (async)
eval @ plugin:smart-connections:4188
VM332:1 Uncaught SyntaxError: Expected ',' or ']' after array element in JSON at position 223
    at JSON.parse (<anonymous>)
    at eval (plugin:smart-connections:4427:33)
    at eval (plugin:smart-connections:3794:13)
    at Array.every (<anonymous>)
    at ScStreamer.dispatchEvent (plugin:smart-connections:3793:45)
    at ScStreamer.eval (plugin:smart-connections:3836:18)
    at Array.forEach (<anonymous>)
    at ScStreamer._onStreamProgress (plugin:smart-connections:3834:40)
    at ScStreamer._onStreamLoaded (plugin:smart-connections:3845:14)
    ```
@brianpetro
Copy link
Owner

Hey @annie-elequin & welcome to the community 😊

Thanks for the detailed insights into this issue. You might like to know that the Debug at startup time will implement source maps, making the logs a little easier to navigate:

Screenshot 2024-02-02 at 10 34 25 PM

For the specific gatecode query, I just tested it a bit in my test vault and similarly received poor results.

Now that v2.0 is in general release, I am changing focus to improve the Smart Chat (v2.1). So, issues like this will be a priority in the short term. I'm still clarifying the exact roadmap, but seeing weak points like this will go a long way in helping me recognize what will have the biggest impact.

And while I don't think that the parsing error is related to the poor-performing query (though it could be), I do appreciate you providing the detailed error report. It looks like the error might be caused by a patch I added last week to compensate for inconsistent formatting coming from OpenAI's streaming APIs.

Back to the gatecode query:

perhaps this is some kind of embeddings issue? How can I ensure that all my notes are embedded correctly? Or is there something else going on here?

I think I found the issue!

Results for the Smart Chat weren't being properly sorted. And the effect of this would actually be more pronounced on a small vault, as the Top 20 results would have much more variance, making sorting more important, than it would if it were the top 20 from a large vault.

🤞 I think if you update to v2.0.107, then your query will work, with one exception:

You'll need to change:

What is the gate code to the mountain cabin?

to

What is the gate code to my mountain cabin?

or

Based on my notes, what is the gate code to the mountain cabin?

You probably already knew that and were just providing an example, but I wanted to point this out just in case: the current Smart Chat (still a v1 relic) requires a self-referential pronoun to trigger note retrieval.

Ok, so I'm running on fumes and apologize for the lack of coherence above. Hopefully, things work a little better for you, starting with v2.0.107.

Thanks for helping to make Smart Connections the best it can be!

PS- I'm going to tweet that awesome testimonial from your second sentence 😊

🌴

@annie-elequin
Copy link
Author

First of all, where can I buy you a coffee for your awesome response time and detailed notes on this issue?

I updated to .107 and immediately started seeing better results (3 queries in a row on mundane topics in my tiny vault worked just as I expected them to).

I'm excited to start querying the heck out of my notes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants