Hands on with the Vercel AI SDK 3.1

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024

Комментарии • 94

  • @DS-ow2ge
    @DS-ow2ge 4 месяца назад +58

    Each new generative UI example from you guys is implemented in a different pattern. From manually intercepting response types to the latest streamui+tools. Does the team feel this present pattern is mature or are they unhappy with it and will be redoing it next month?

    • @fagnersales532
      @fagnersales532 4 месяца назад +4

      Nice observation

    • @carloslfu
      @carloslfu 4 месяца назад +3

      Yeah, but this is why it experimental. Use at your own risk!

    • @shuding
      @shuding 4 месяца назад +9

      Hey, AI SDK maintainer here! I'm not sure what you're referring to regarding "intercepting response types", but `streamUI` is pretty stable. It's the same as the previous experimental `render` function, but with a more consistent name as other APIs like `streamText` and `streamObject`.
      Also worth mentioning that the Generative UI APIs are designed to be general enough and fit into any UI patterns and AI pipelines, which means that there isn't only one way to do Generative UI. For example, you can just use `streamUI` + tools to handle LLM + UI, or combine low-level utilities like `createStreamableUI`/`createStreamableValue` and your existing pipeline for flexibility.
      Happy to answer any questions!

    • @wshewm
      @wshewm 4 месяца назад

      @@shuding What are your recommendations for maintaining type-safety in the application, especially surrounding the server actions and use of the `useActions` hook? Unless I'm missing something, it seems like the required use of the hook defeats one of the major benefits of server actions: end to end type safety. Is there maybe a lower-level approach that I could take to bypass the hook?

    • @itszachhan
      @itszachhan 4 месяца назад +4

      ​@@shuding Can you use libraries like shadcn and nextui for the streamed components? Last time I tried, it wasnt working

  • @MilindMishra
    @MilindMishra 4 месяца назад +11

    Thanks for the walkthough! Looking fwd to build generative ui stuff :)

    • @whovivekshukla
      @whovivekshukla 4 месяца назад +1

      I tried out their streaming ui a few months ago! that was pretty dope!

    • @syndg
      @syndg 4 месяца назад +1

      Was just about to send you this video for our reference. Glad to see you already watched it!

  • @TomAsh519
    @TomAsh519 4 месяца назад +24

    Could you please do a tutorial on the combined use of ai ask with long chain adapter that utilizes eg. simple RAG? From your documentation it is not clear how to implement it properly.

    • @jervx829
      @jervx829 27 дней назад

      U need vectors

  • @TheJuava
    @TheJuava 4 месяца назад +3

    Great Overview!
    A Video incorporating RAG with Vercel AI SDK would be awesome!

    • @nicoalbanese10
      @nicoalbanese10 3 месяца назад +2

      Thanks for the suggestion - this is on our list!

    • @0xOmzi
      @0xOmzi 3 месяца назад

      Hyped! 🥳

  • @yaseerokino
    @yaseerokino 4 месяца назад +1

    Vercel always coming through for developers

  • @michaelo4u
    @michaelo4u 4 месяца назад +1

    Thanks! Great job simplifying it.

  • @ahmadbilalfarooqi
    @ahmadbilalfarooqi 4 месяца назад +1

    great explain by AI SDK of Vercel its really helpful and easiest for building application with the use of predefined function and method

  • @TomAsh519
    @TomAsh519 4 месяца назад +3

    it is me only or this tutorial and the repo does not work? I got Error: `useUIState` must be used inside an provider. to resolve it add import { AI } from "./action"; to root layout:
    export default function RootLayout({
    children,
    }: Readonly) {
    return (

    {children}

    );
    }

    • @ShaneCrenshaw
      @ShaneCrenshaw 3 месяца назад

      If you are calling getAiState or useUIState, it has to happen inside of So you could create a new component and do something like

      and inside of Chat, that's where you would use uiUIState

  • @wshewm
    @wshewm 4 месяца назад +1

    This is cool and all, but it seems that around every corner in this SDK (especially with the rsc stuff) all the types are just 'any'. In my opinion, you can't really call your library "The AI Framework for TypeScript" and then not have strong types. This is especially annoying because in my eyes it defeats one of the major benefits of server actions: end-to-end type safety. Is there a way to bypass some of the abstractions, like the useActions hook?

  • @0xOmzi
    @0xOmzi 4 месяца назад +1

    Thanks for this great video! Looking forward to trying my hands out on the latest release!
    Kudos to the Vercel AI team too!

  • @usagisan79
    @usagisan79 4 месяца назад +3

    ilove ai sdk and kirimase both!

  • @asimalqasmi7316
    @asimalqasmi7316 4 месяца назад +6

    Let me recall the kirimase dream I had

  • @BhagawanNityanandaOfGaneshpuri
    @BhagawanNityanandaOfGaneshpuri 4 месяца назад +1

    Thank you guys!

  • @jrmumm
    @jrmumm 3 месяца назад +1

    how does it stream a structured object? doesn't the stream come back as JSON? how can it parse it if it's not fully complete?

  • @fezkhanna6900
    @fezkhanna6900 2 месяца назад

    fantastic!

  • @daniloitj
    @daniloitj 3 месяца назад

    Very good explanation. If possible, could you connect streamUI with assistants? I also had a lot of difficulty separating the tools into other files.

  • @郭伽政
    @郭伽政 2 месяца назад

    For example, a Ai has a getWeather tool
    The context of the conversation achieves the following effects:
    user: hello
    ai: Hello! How can I assist you today?
    user: How's the weather today?
    tool: getWeather("local")
    tool_result: {“weather”:"sunny","maxTemperature":35,"minTemperature":0}
    ai: The weather is good today, but the temperature difference is a bit large, so please keep warm.
    I hope that on the client page, users can see in sequence: Ai wants to use the getWeather tool, the call result of the getWeather tool, and Ai's answer based on the call result.
    How can I achieve this?

  • @simpingsyndrome
    @simpingsyndrome 4 месяца назад +5

    will it work for React Native?, i wanna build my ai chatbot mobile app.

  • @jrmumm
    @jrmumm 3 месяца назад

    when you stream an object, you get a partial. how do you get the final/full response (not partial)?

  • @xberna8156
    @xberna8156 4 месяца назад +1

    I could not find an example in the Docs where the model can use Tools and return RSC while also being able to Stream a response when no Tool is used.
    All the example I could find use generateText() or streamUi() so the text response Is not a Stream.
    Should I use a combination of streamText() + Tools + createStreamableUi() to Stream text and have Tools that can return RSC?

    • @hakarsheikh7853
      @hakarsheikh7853 4 месяца назад +1

      Great question im interested to know too

    • @nicoalbanese10
      @nicoalbanese10 3 месяца назад +1

      Hey! With `streamUI`, if no tool is used, the text response is streamed via the component returned from the `text` function. Is that what you're looking to do?

    • @xberna8156
      @xberna8156 3 месяца назад

      @@nicoalbanese10 Yes, that's correct. I would like to stream the text token by token when the model does not use a tool. Can I achieve that using streamUI?

  • @raphauy
    @raphauy 4 месяца назад +1

    Awesome!

  • @Samuelsward96
    @Samuelsward96 3 месяца назад

    Hey i'm struggling a bit with the useChat for multiple conversations. How can i keep multiple conversations active at once? Any tips?

  • @rhyscampbell4178
    @rhyscampbell4178 3 месяца назад +1

    NICO!!!!!

  • @mymorningjacket_
    @mymorningjacket_ 4 месяца назад +1

    Anyone have a great example on how to get the user's actual location here?

    • @nicoalbanese10
      @nicoalbanese10 3 месяца назад +3

      You can run any asynchronous javascript code within a tools' execute function. So you would first want to find the exact location based on the search query (eg. openstreetmap). Then pass that to a weather api (eg. open-meteo) and return the resulting temperature 😊

    • @mymorningjacket_
      @mymorningjacket_ 3 месяца назад

      @@nicoalbanese10 thanks for the suggestion, nico!

  • @andru5054
    @andru5054 3 месяца назад

    Hey, awesome demo - thanks. We're using llamaindex in Python for our LLM backend that uses RAG. I want to use tools that pass react components to the frontend - how would I accomplish this? Thank you

  • @ShaneCrenshaw
    @ShaneCrenshaw 3 месяца назад

    Is there an example with streamUI and error handling for things like finishReason and usage?

  • @GAllium14
    @GAllium14 3 месяца назад +1

    Vercel ai sdk + RAG tutorial

  • @remiib18
    @remiib18 4 месяца назад

    Is it still not possible to use both the regular tools to fetch data and the tools to return components ?

  • @yarapolana
    @yarapolana 4 месяца назад +3

    I added $10 to test open ai and ai sdk and I had 100% of “unknown error” calls and $8 used?! What in the world it wasnt like this before.
    Loads of retries in the background (should be opted out from the start)

  • @RoccoGhielmini
    @RoccoGhielmini 4 месяца назад +3

    I can't concentrate because they keep saying next

    • @nicoalbanese10
      @nicoalbanese10 3 месяца назад +2

      Sorry about that, will work on it for the next one!

  • @journeyofc6200
    @journeyofc6200 4 месяца назад +1

    dope!!

  •  3 месяца назад

    Someone knows how to Improve the response using the API of openAI? Seems like the chat-gtp web app the results are a lot better.
    Using the API returns very similar responses, in this case, asking "tell me a joke" answer the same thing over and over again.
    Another great API btw

  • @Jake-bh1hm
    @Jake-bh1hm 4 месяца назад +2

    is this compatible with sveltekit 5?

  • @maharshiguin7813
    @maharshiguin7813 4 месяца назад +2

    New version of ai package has too much abstractions

    • @wshewm
      @wshewm 4 месяца назад +2

      Agreed. It destroys the type-safety, especially with RSC and the useActions hook.

  • @LutherDePapier
    @LutherDePapier 4 месяца назад +2

    Where's Lee?

    • @leerob
      @leerob 4 месяца назад +1

      I'm here :)

  • @ShouryanNikam
    @ShouryanNikam 4 месяца назад +4

    how do you make the code animations?

  • @andreschou9560
    @andreschou9560 4 месяца назад +1

    sick

  • @smitty7326
    @smitty7326 3 месяца назад

    god i wish i knew about vercel ai like 6 months ago lol

  • @imDeeva
    @imDeeva 2 месяца назад

    No need to add any openAi api key?

  • @FelixWaigner
    @FelixWaigner 4 месяца назад

    When will i be able to use this with langchain?

  • @JeomonGeorge
    @JeomonGeorge 3 месяца назад

    can I use ai vercel in vue.js

  • @aneesmanzoor7340
    @aneesmanzoor7340 4 месяца назад

    how to create these coding videos with animations like this kindly create a video on that as well @vercel

  • @nenadbanjeglav2081
    @nenadbanjeglav2081 4 месяца назад

    Can I use this in next.js out of the box?

  • @rutvijdoshi9664
    @rutvijdoshi9664 4 месяца назад

    Can we fine tune this model ?

  • @JustOmmShah
    @JustOmmShah 4 месяца назад

    Where do you keep the API Key?

  • @malaytiwari3207
    @malaytiwari3207 3 месяца назад +1

    How do I pass the API key?

    • @Nick__X
      @Nick__X Месяц назад

      Just add it to the env vars the lib will do the rest

  • @yogeshrathod953
    @yogeshrathod953 4 месяца назад

    Can it work with ollama

  • @AtomicPixels
    @AtomicPixels 4 месяца назад

    Ugh I hate using gpt. Why isn’t anyone doing Gemini especially since it’s in free beta

  • @CarlottaRiganti
    @CarlottaRiganti 4 месяца назад

    But how do you npm?

  • @The_kids-c2j
    @The_kids-c2j 4 месяца назад

    I made 8 subscribers 😊

  • @andriisukhariev
    @andriisukhariev 4 месяца назад

    train without stops

  • @karamanabdullah
    @karamanabdullah 4 месяца назад +2

    is it free?

    • @mohammednasser2159
      @mohammednasser2159 4 месяца назад +2

      It's just a library, using it is free, however using the models, Like Gemini and GPT4o requires a token, which will almost always cost money

    • @karamanabdullah
      @karamanabdullah 4 месяца назад

      @@mohammednasser2159 thank you

    • @leerob
      @leerob 4 месяца назад

      @@mohammednasser2159 thank you! Yes exactly.

  • @sanukjoseph
    @sanukjoseph 4 месяца назад

    🤩❣...

  • @jasonjefferson6596
    @jasonjefferson6596 3 месяца назад

    Is this a real human or synthetic?

    • @slavalu74
      @slavalu74 3 месяца назад

      looks like a bio robot for me

  • @slavalu74
    @slavalu74 3 месяца назад

    As always by Next over engineered and over complicated. We just need 4 functions. streamUI, receiveUI, streamText, receiveText. Everything else much easier to do without your helper functions.

  • @Archibong.samuel
    @Archibong.samuel 2 месяца назад

    I wish I could be part of nextjs team. This is insane 😩 why am I just seeing this? Thanks @team_nextjs