#debugging
1 messages · Page 1 of 1 (latest)
thanks! I didn't know I was supposed to make a thread, I apologize
$ curl -w "%{http_code}" -H 'Content-Type: application/json' -X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key='${GOOGLE_API_KEY} -d '{"contents": [{"parts":[{"text": "dear%20GPT%2C%20beans"}]}],"safetySettings": [{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","threshold": "BLOCK_ONLY_HIGH"}],"generationConfig": {"stopSequences": ["Title"],"temperature": 1.0,"maxOutputTokens": 800,"topP": 0.8,"topK": 10}}'
{
"candidates": [
{
"content": {
"parts": [
{
"text": "Beans are a delicious and nutritious food that can be enjoyed in many different ways. [redacted for size]"
}
],
"role": "model"
},
"finishReason": "STOP",
"index": 0,
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
],
"citationMetadata": {
"citationSources": [
{
"startIndex": 26,
"endIndex": 149,
"uri": "https://www.healingplantfoods.com/the-disappearing-lima-bean/",
"license": ""
}
]
}
}
],
"promptFeedback": {
"safetyRatings": [ ... redacted for size
]
}
}
200
you don't have to, i'm just cutting down on noise for everyone else
Thank you, but my biggest confusion is that I have the exact same jsonBody as you do
I compared them, one to one, and they 100% match
so, it could not be something in jsonBody, that jsonBody is actually even returning as well the other parts (the escape URL and message) so not those parts either, which means it has to be something in here?
llHTTPRequest(url, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json", HTTP_BODY_MAXLENGTH, 4096], jsonBody);````
but then, I'm confused on what there would be wrong
while you're debugging it can help to turn the temperature down to 0 too, so you get consistent output
sure I can give it 0, at the moment though it is not even returning me a single message, only error 400
yeah, so the point of my repro was to ensure the API itself is behaving correctly, which it is, so it's definitely in your code
400 is "bad request" which implies you're putting something invalid somewhere
so I would strip away as much as possible and just get your request down to the very basics
would I be able to do it with the original one that you use for Bison per chance?
like the new API key and address but the Bison example curl which worked for me, personally
this piece here -H 'Content-Type: application/json'
-d '{ "prompt": { "text": "Write a story about a magic backpack"} }' \
minus the ! I did try it and it gave me 404
with this URL
which, I did not change, before it was giving 400, simply changing jsonBody made it go to 404
so I didn't know what to do so I added HTTP EXTENDED ERROR to the request, it still went through, and I tried to return what the extended error would be as you mentioned 400 should return more, but even when I try to return it, it only says 400
if the Google server were to output more than just "400!" then it would return to me a large blob of text as a json with some additional fields, probably exactly what was wrong
(this is from going back to the one before that should work theoretically, but doesn't, but doesn't give a 404)
this was what I tried to use to add to the code
OK I was able to get it!
This is the exact error code I am receiving.
[21:24] Gemini bot: Extended error info: {
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"contents\": Cannot find field.\nInvalid JSON payload received. Unknown name \"generationConfig\": Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"contents\": Cannot find field."
},
{
"description": "Invalid JSON payload received. Unknown name \"generationConfig\": Cannot find field."
}
]
}
]
}
}```
in LSL, you need to sanitize the quotes with slashes, how do you suggest I sanitize it? if I remove the slashes, it ruins the code, and code won't run if there is not slashes to prevent it from being improperly recognized as the end of the code
its a field, and if you go like this " " " " it thinks the quotes inside of that are the end of the field and the start of a new field, you have to put slashes through them for it to recognize it as "sanitized"
it's saying it cant find "generationConfig"
there are slashes because the output is json
I see, what would this indicate then? If it worked for you, with the same fields, yet not for me
this indicates that the request you are using is not the same as the one I posted
you definitely have the right API / URL / endpoint?
exactly
This is what I have in my studio
I'm sorry, what do you mean? It said it doesnt understand the fields I put in, which are the fields you put in as well
It worked for you, but not for me, with the same 100% fields
as comparing yours to mine, they were 100% identical
you definitely have the right API / URL / endpoint?
what I did was, I took this:
https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateText?key=
and I put my key at the end of that
is this the incorrect URL? It would certainly explain
gemin-pro doesn't support generateText
oh... oh no
maybe it does? but it shouldn't?
how may I get only text, and no other forms of anything but text, from the new AI from Google? Second Life only supports HTTP response in form of text
and, UTF-8
most times, it is sending PHP stuff, but I have seen people with ... the other products available online (don't want to get in trouble!) who got those products to work, although I am unsure whether or not the ... other products ... are offering UTF-8 text. I assume yes, but I can't ask people how they're doing it, they are extremely protective of their own code
oh! I finally got it! but is it normal for it to respond with no response at all?
(sorry was doing an interview)
you using generateContent now?
is it normal for it to respond with no response at all?
It's not "normal" but it is expected. For your prompt specifically, calling the model "GPT" is likely the problem. Most of the time you will see details in the prompt feedback section, but when it's OTHER you won't
Welcome back from your interview. I was able to fully complete it from start to finish now and it now functions entirely 100% in Second Life!
He really hates to be corrected and flags it as a highest possible violation which is extremely funny but otherwise, fully works.
if the AI replies that it was a violation, it just prunes the entire thing so the end user does not see that part, which means it tripped something on the highest setting
I heard this is a known issue with Gemini from the Reddit... so I will assume nothing to worry about for my account standing, just making sure, right?
yeah unless you are doing some serious dodgy stuff, the safety filters do not affect your google account
if you want partial repsonses, you can try the streaming api, where it sends you chunks, then you can see the text up to the point it blocked
you can turn the filters down if that's appropriate for your usecase too
funny enough, this is what I have it set to, is there another option I missed that even if the AI is, I guess offended deeply, it won't block it?