logancyang / obsidian-copilot

THE Copilot in Obsidian
GNU Affero General Public License v3.0
2.8k stars 192 forks source link

[FR] Context expansion via direct links in a context note #648

Open MMoMM-org opened 1 month ago

MMoMM-org commented 1 month ago

As an example: I have a Name in my activeNote, and I would like the prompt to search for the Note associated with that Name.

I tried to move a chatGPT assistant prompt over which was using a Vector Store, but it is failing at that part. I changed the filenames to [[NoteNames]] and tried other changes but.... It will tell me to look for the Note... but it never finds it. If I add the note manually to the prompt via [[Name]] it is being found

Does somebody have a clue on where my mistake is? I can post the prompt and supporting files but they are messy... btw: chatGPTs suggestion dont work either..

logancyang commented 1 month ago

Not sure if I understand your question. Some more details might help.

MMoMM-org commented 1 month ago

In the prompt I let chatGPT include other information from referenced notes in the {activeNote} e.g. the activeNote contains

is friend of [[CharacterB]] and has the same height

the prompt has the commands to retrieve the height in this case from [[CharacterB]] the output from the prompt does say that it does that... but just makes stuff up. If I add [[CharacterB]] in the chat manually and ask again to get the height it works.

the other problem is that searching for a Note on partial matches doesn't work either.. it works in the Vector Store.. but that is a question for another day.

MMoMM-org commented 1 month ago

let me clarify it more about what works and what doesn't work, I can also share the 5 required notes if necessary.

what works

Having a note linked inside the prompt works, the content of that note is handled Having added a note inside the chat works, the content of that note is handled

what doesn't work

having a note linked inside the activeNote doesn't work, the prompt can't retrieve any information from that note letting the prompt create a link to a note automatically and then accessing that note doesn't work

Usecase

I have a note Character B, which contains Height 186 Age 24

I have activeNote for Character A, which contains Height as [[Character B]] Age 25

The prompt is instructed to access the information in the activeNote and then gather further information from other notes if required.

In this case the prompt should access the [[Character B]] note to retrieve the Height. And the prompt does that... at least it is saying that is does it... but it can't and makes up the value for height.

If I now add the [[Character B]] note into chat and ask to prompt to look for the height again it works.

I thought that max sources is the issue but I have it at 8

Emt-lin commented 1 month ago

@MMoMM-org If [[xx]] is in the ordinary note, it's not work. Because the [[xx]] does not link the actual note.

I think that you can pre-send the required sources and then ask for question.

logancyang commented 1 month ago

In this case the prompt should access the [[Character B]] note to retrieve the Height.

Intuitively it should, BUT it's not how it works right now. It only has access to the notes explicitly linked in the prompt using custom prompt templating.

What you are asking for here is context expansion via direct note links, and it may be implemented in the next few iterations for Vault QA.

MMoMM-org commented 2 weeks ago

than it makes sense, would just like that chatGPT wouldn't lie that much, it did never tell me that it couldn't access the files, just made stuff up. send me down a totally wrong path till I figured it out, thanks for the information.