buildship icon indicating copy to clipboard operation
buildship copied to clipboard

Minified React error any time i try to use any Gemini Fine Tuned model.

Open monsterswithink opened this issue 1 year ago • 0 comments

Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7BnodeId%2C%20nodeName%2C%20stage%2C%20errorObject%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Node logic:

const {
  GoogleGenerativeAI,
} = require("@google/generative-ai");

export default async function generateResponseTextStream({
  API_KEY,
  prompt,
  modelType,
  nodeId,
  nodeName
}, { logging }) {
  const genAI = new GoogleGenerativeAI(API_KEY);

  const model = genAI.getGenerativeModel({
    model: "tunedModels/theActualModelIDFromGoogleAIStudio"
  });

  try {
    const result = await model.generateContent({ prompt, modelType });
    const text = result.text; // Ensure result has a text property
    
    logging.log(text);
    
    // Constructing the output according to the provided schema
    return {
      nodeId: nodeId, // Dynamic nodeId
      nodeName: nodeName, // Dynamic nodeName
      stage: "completed",
      errorObject: {
        warnings: [],
        errors: []
      },
      text: text // Ensure this is a string
    };
  } catch (error) {
    logging.error('Error generating content:', error);
    
    // Constructing the error output according to the provided schema
    return {
      nodeId: nodeId, // Dynamic nodeId
      nodeName: nodeName, 
      stage: "failed",
      errorObject: {
        warnings: [],
        errors: [{
          location: {
            lineText: error.message,
            file: "script.js",
            column: 0,
            line: 0,
            suggestion: "",
            namespace: "",
            length: 0
          },
          pluginName: "GoogleGenerativeAI",
          notes: [],
          id: "error-id",
          text: error.message
        }]
      }
    };
  }
}```

In fact NO fine tuned models work in BuildShip.

monsterswithink avatar Jul 27 '24 12:07 monsterswithink