Spaces:
Running
Running
Upload 10 files
Browse files- src/services/gemini.js +3 -3
src/services/gemini.js
CHANGED
|
@@ -5,7 +5,7 @@ import { db } from "./firebase.js";
|
|
| 5 |
import { doc, getDoc } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js";
|
| 6 |
|
| 7 |
let apiKey = null;
|
| 8 |
-
const MODEL_NAME = "gemini-pro"; //
|
| 9 |
|
| 10 |
// System Instructions for the Socratic Tutor
|
| 11 |
const TUTOR_INSTRUCTION = `
|
|
@@ -58,8 +58,8 @@ export async function initGemini(key) {
|
|
| 58 |
async function callGeminiAPI(messages, jsonMode = false) {
|
| 59 |
if (!apiKey) throw new Error("API Key not set");
|
| 60 |
|
| 61 |
-
// Use
|
| 62 |
-
const endpoint = `https://generativelanguage.googleapis.com/
|
| 63 |
|
| 64 |
const payload = {
|
| 65 |
contents: messages,
|
|
|
|
| 5 |
import { doc, getDoc } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js";
|
| 6 |
|
| 7 |
let apiKey = null;
|
| 8 |
+
const MODEL_NAME = "gemini-1.5-pro"; // Use latest Pro model
|
| 9 |
|
| 10 |
// System Instructions for the Socratic Tutor
|
| 11 |
const TUTOR_INSTRUCTION = `
|
|
|
|
| 58 |
async function callGeminiAPI(messages, jsonMode = false) {
|
| 59 |
if (!apiKey) throw new Error("API Key not set");
|
| 60 |
|
| 61 |
+
// Use v1beta for gemini-1.5-pro
|
| 62 |
+
const endpoint = `https://generativelanguage.googleapis.com/v1beta/models/${MODEL_NAME}:generateContent?key=${apiKey}`;
|
| 63 |
|
| 64 |
const payload = {
|
| 65 |
contents: messages,
|