#copyright error handling in python

1 messages · Page 1 of 1 (latest)

signal hill
#

based on the following code I sometimes run into an issue that makes it stop, which I don't want, I want to handle the error but not the process to stop entirely, the error goes along the LLM api of gemini encountering some copyright issue with its input or something around that. How to fix it?

signal hill
#

should an exception block fix this?

signal hill
#

Im dealing with this using exception blocks. Am I missing something here?

#

The response.text quick accessor requires the response to contain a valid Part, but none were returned. The candidate's finish_reason is 4.

#

there's one error I get

median tree
signal hill
#

right

median tree
signal hill
#

it is working for now tho

#

using exception

signal hill
median tree
#

I guess it depends on your try / except block and what is throwing the exception

signal hill
#

wym reason/feedback

#

with that wht is it sorry?

#

An unexpected error occurred for concept 'incorrect parameter count in the call to native function datediff?': Invalid operation: The response.text quick accessor requires the response to contain a valid Part, but none were returned. The candidate's finish_reason is 4. Meaning that the model was reciting from copyrighted material.

#

another one

#

An unexpected error occurred for concept 'python mcmc fit to data with variable uncertainties using lmfit?': Invalid operation: The response.text quick accessor requires the response to contain a valid Part, but none were returned. The candidate's finish_reason is 4. Meaning that the model was reciting from copyrighted material.

#

to contain a valid Part

median tree
#

the response object will contain other information besides text so you can have additional logic to check the appropriateness of the response before continuing

signal hill
#

right

median tree
#

as you noted, you are getting finish_reason 4 so you can handle that in your logic

signal hill
#

here it is saying something about "Part" I'm looking at the docs on it