Giter VIP home page Giter VIP logo

Comments (3)

lgrammel avatar lgrammel commented on July 28, 2024

@Morphexe tried to reproduce it locally (without AWS lambda) and noticed that you attached a catch to the generate text.

The following worked for me:

import dotenv from "dotenv";
import {
  DefaultRun,
  OpenAIChatPrompt,
  generateText,
  openai,
} from "modelfusion";

dotenv.config();

async function myFunction(prompt: OpenAIChatPrompt) {
  try {
    const run = new DefaultRun();
    return await generateText({
      model: openai.ChatTextGenerator({
        model: "gpt-4-vision-preview",
        temperature: 0,
        maxGenerationTokens: 2500,
      }),
      prompt,
      fullResponse: true,
      run,
    });
  } catch (err) {
    console.error("Error generating text", err);
    return null;
  }
}

async function main() {
  console.log(
    await myFunction([
      {
        role: "user",
        content: "print something",
      },
    ])
  );
}

main().catch(console.error);

Can you see if it's related to how you perform the catch (i.e., change it into a try..catch around the awaited statement)?

from modelfusion.

Morphexe avatar Morphexe commented on July 28, 2024

This seems to have been caused by a recent update somehow, but I also seems to not be modelfusion specific, but seems to be more a bundling issue on my side, which was pulled forward by something in latestest modelfusion.

Initial debugging today , threw me in the web-stream-pollyfill based on some other issues I found while searching online.

So apologies, this might not be something you need to solve, literally bad timing since I updated the lib and this started happening, so I might have pulled the trigger in thinking it was related modelfusion.

from modelfusion.

lgrammel avatar lgrammel commented on July 28, 2024

No worries. I'll close this issue for now. Please re-open if you discover it's related to ModelFusion. Thanks!

from modelfusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.