Giter VIP home page Giter VIP logo

Comments (5)

themaximalist avatar themaximalist commented on June 15, 2024

Hey Andy, thanks for letting me know. AI.js is still in active development and I'll look into getting Claude v2 working.

I haven't promoted AI.js much, but I should, I find it very helpful for my projects as well.

If you're able to produce an error, please let me know what you're seeing, otherwise I will aim to get an update out for Claude2 soon!

from ai.js.

aaweb avatar aaweb commented on June 15, 2024

Thanks for the awesome work!

It does work in CLI:

> ai the color of the sky is --service anthropic --model claude-2 

I think the problem might be streaming though. Here the error I get when I change the model from GPT to claude (1 or 2).

image

I do get the same BTW when using it with claude-1, so it probably is more of a streaming issue than a claude-2 one. Is that something that is supposed to work already in the library?

from ai.js.

aaweb avatar aaweb commented on June 15, 2024

@themaximal1st Hey there. Just wanted to check if you had a quick feedback on whether streaming is supposed to work for Claude (also v1) or if I should keep debugging on my end.

Thanks a lot! Have a wonderful day.

from ai.js.

themaximalist avatar themaximalist commented on June 15, 2024

from ai.js.

aaweb avatar aaweb commented on June 15, 2024

Thanks, I narrowed it down. Claude has no notion of a system message, which is why this did not work and cause the error mentioned above (which is not very descriptive unfortunately):

      const messages = [
        { role: "system", content: "Give all answers in uppercase." },
        { role: "user", content: "Tell a one liner joke." },
      ];
      const ai = new AI(messages, options);
      const stream = await ai.send();

To make it work for both openai and anthropic, I just iterate the messages and change system roles to user. Like this is also works with claude-2.

Thanks a lot for the help!

Maybe worth a note in the README or even better a test/check that informs the API user similar to when trying to use other unsupported features (like functions).

from ai.js.

Related Issues (1)

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.