I have being able to successfully use my credentials to use a tuned model for instance, but when trying to call genai.list_tuned_models() it outputs an error: 403 Request had insufficient authentication scopes. [reason: “ACCESS_TOKEN_SCOPE_INSUFFICIENT”
import pprint
import google.generativeai as genai
from load_creds import load_creds
creds = load_creds()
genai.configure(credentials=creds)
generation_config = {
"temperature": 0.9,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 1024,
"response_mime_type": "text/plain",
}
# Convert the generator to a list
list1 = list(genai.list_tuned_models())
# Use pprint to print the list in a readable format
pprint.pprint(list1)
Hello @sps thank you for your reply. What it feels weird is that the code bellow uses OAth and prompts the tuned model without a problem…
import pprint
import google.generativeai as genai
from load_creds import load_creds
creds = load_creds()
genai.configure(credentials=creds)
generation_config = {
"temperature": 0.9,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 1024,
"response_mime_type": "text/plain",
}
# Create a GenerativeModel instance
model = genai.GenerativeModel(
model_name="tunedModels/custom-interact-sentiment-analysis-zn037",
generation_config=generation_config,
)
# Start a chat session
chat_session = model.start_chat(enable_automatic_function_calling=True)
# Send a message to the chat session including the file URI
response = chat_session.send_message(f"'Estou feliz'. Apenas classifique positivo, neutro, ou negativo, nenhuma explicação é necessária.")
# Print the response
print(response.text)
But when I call the method to list the tuned models
import pprint
import google.generativeai as genai
from load_creds import load_creds
creds = load_creds()
genai.configure(credentials=creds)
for m in genai.list_tuned_models():
print(m.name)
It gives me PermissionDenied: 403 Request had insufficient authentication scopes. [reason: “ACCESS_TOKEN_SCOPE_INSUFFICIENT”