obsidian-copilot icon indicating copy to clipboard operation
obsidian-copilot copied to clipboard

TypeError: Cannot read properties of undefined (reading 'parts')

Open deanberwick opened this issue 1 year ago • 3 comments

Describe the bug Exception thrown parsing Gemini output json

To Reproduce sorry not sure, hopefully this stack trace is more useful than nothing.

Expected behavior expected my conversation to finish the response, instead it froze mid stream.

Log: app.js:1 Obsidian Developer Console VM194 plugin:copilot:64640 New LLM chain created. VM194 plugin:copilot:73829 Setting model to GPT-4 TURBO: gpt-4-turbo-preview VM196 plugin:copilot:64640 New LLM chain created. VM196 plugin:copilot:73829 Setting model to GPT-4 TURBO: gpt-4-turbo-preview VM198 plugin:copilot:64640 New LLM chain created. VM198 plugin:copilot:73829 Setting model to GPT-4 TURBO: gpt-4-turbo-preview VM198 plugin:copilot:64640 New LLM chain created. api.openai.com/v1/chat/completions:1 Failed to load resource: the server responded with a status of 404 () VM198 plugin:copilot:74035 You do not have access to this model or the model does not exist, please check with your API provider. runChain @ VM198 plugin:copilot:74035 VM198 plugin:copilot:64640 New LLM chain created. VM198 plugin:copilot:73829 Setting model to GPT-3.5: gpt-3.5-turbo VM198 plugin:copilot:64640 New LLM chain created. VM198 plugin:copilot:64640 New LLM chain created. VM198 plugin:copilot:73829 Setting model to GPT-4 TURBO: gpt-4-turbo-preview VM198 plugin:copilot:64640 New LLM chain created. api.openai.com/v1/chat/completions:1 Failed to load resource: the server responded with a status of 404 () VM198 plugin:copilot:74035 You do not have access to this model or the model does not exist, please check with your API provider. runChain @ VM198 plugin:copilot:74035 plugin:copilot:64640 New LLM chain created. plugin:copilot:73829 Setting model to GEMINI PRO: gemini-pro plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:65748 No vectors found in VectorDB for dochash: e4d43a5dc9401841bf92f20915f7acae plugin:copilot:74074 Creating vector store... plugin:copilot:74090 Vector store created successfully. plugin:copilot:64723 New Conversational Retrieval QA Chain created. plugin:copilot:73920 New conversational retrieval qa chain with multi-query retriever created for document hash: e4d43a5dc9401841bf92f20915f7acae plugin:copilot:73926 Set chain: retrieval_qa plugin:copilot:64640 New LLM chain created. plugin:copilot:73746 clearing chat memory plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:73746 clearing chat memory plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:64640 New LLM chain created. plugin:copilot:74038 TypeError: Cannot read properties of undefined (reading 'parts') at convertResponseContentToChatGenerationChunk (plugin:copilot:72102:39) at ChatGoogleGenerativeAI._streamResponseChunks (plugin:copilot:72297:21) at async ChatGoogleGenerativeAI._streamIterator (plugin:copilot:69668:26) at async ChatGoogleGenerativeAI.transform (plugin:copilot:6021:9) at async RunnableBinding.transform (plugin:copilot:6204:9) at async RunnableSequence._streamIterator (plugin:copilot:6506:28) at async Object.pull (plugin:copilot:5077:37) runChain @ plugin:copilot:74038 plugin:copilot:64640 New LLM chain created.

Additional context Perhaps it has to do with the fact that I kinda asked two questions in one message and the API returns the pieces in parts? here the last 2 message of out conversation, first me, then the partial response:

ME: Great, yes it seems to has a strong focus on active control of the interaction with the student, hand holding them through material.

(as an aside, could you adjust your own tone and delivery style to match my more causal conversational style, focusing on brevity and clarity, feel free to stay one level more intelligent than me)

COPILOT: Sure, I can adjust my tone and delivery style to match your more casual conversational

deanberwick avatar Feb 12 '24 05:02 deanberwick

@deanberwick I'm using langchainjs's ChatGoogleGenerativeAI module and this one seems like a bug on their side, will take a look. Is it consistently like this when you use Gemini?

logancyang avatar Feb 15 '24 04:02 logancyang

Haven't seen it twice, will let you know if i see it again.

deanberwick avatar Feb 15 '24 13:02 deanberwick

Just FYI, I've seen it once too but not reproducible.

logancyang avatar Mar 05 '24 01:03 logancyang