Using Mistral Large 2 in IBM watsonx.ai flows engine

IBM Developer
4 Sept 202410:40

Summary

TLDRIn this video, the presenter explores using Watson's Exploratory (Mr. Large 2) engine with large language models. Mr. Large 2 excels in reasoning and code generation, supporting a multitude of languages, including character-based ones like Chinese and Japanese. The video demonstrates creating text completion and chat flows using Watson's X Flows engine, deploying them via CLI, and interacting with them through JavaScript SDK. It showcases Mr. Large's capabilities in multilingual translation and maintaining conversation context, highlighting the ease of building applications with Watson's tools.

Takeaways

  • 🌐 The video explores integrating the Mistral Large 2 language model with the Watson Explorer engine for multilingual AI applications.
  • 💬 Mistral Large 2 is designed to be multilingual, supporting a wide range of languages including character-based languages like Chinese, Japanese, and Hindi.
  • 💡 The model excels in reasoning and code generation, making it a valuable tool for developers looking to build applications with diverse linguistic capabilities.
  • 🔗 The Watson Explorer engine is introduced as a framework for building AI flows, which can be used for various AI tasks like text completion, summarization, classification, and more.
  • 🛠️ The video demonstrates creating a text completion flow using the Watson Explorer engine, showcasing the ease of deploying AI flows to a live endpoint.
  • 🔑 The Watson Explorer CLI is used to deploy the flow, and an SDK is available for JavaScript and Python to interact with the deployed flows.
  • 🌐 The video provides an example of using Mistral Large 2 for text completion in multiple languages, showcasing its capabilities with character-based languages.
  • 💬 A chat flow is also demonstrated, where the model maintains context across multiple user inputs, simulating a conversational interface.
  • 🔧 The video suggests that for practical applications, maintaining state across interactions would be necessary, hinting at the need for client-side or server-side solutions.
  • 🔄 The script mentions future content on tool calling with Mistral Large, indicating ongoing development and exploration of the model's capabilities.

Q & A

  • What is the main focus of the video series?

    -The main focus of the video series is exploring how to use the Watson Explorer engine with different large language models, including IBM Granite and MeLLa 3.1, and in the final video, with Mistral Large 2.

  • What are the capabilities of Mistral Large 2 according to the video?

    -Mistral Large 2 is capable of reasoning and code generation. It is multilingual by design, supporting not only languages like English, Spanish, and French but also character-based languages such as Chinese, Japanese, and Hindi. It also excels at reasoning involving larger pieces of text due to its large context window of almost 130,000 tokens.

  • What is Watson Explorer Flows engine?

    -Watson Explorer Flows engine is a framework for building AI flows. It allows users to use a declarative flow language to build any AI flow ranging from text completion, summarization, classification, to retrieval augmentation, and generation.

  • How does the Watson Explorer Flows engine work with the CLI?

    -The Watson Explorer Flows engine uses the CLI to deploy flows to a live endpoint. Users can deploy their flow configurations and environment variables by running the 'WX flow deploy' command.

  • What is the purpose of the JavaScript code example in the video?

    -The JavaScript code example demonstrates how to interact with the deployed flows using the SDK. It shows how to set up the Watson Explorer endpoint and API key, and how to send requests to the flow, such as asking for translations in different languages.

  • What is the significance of the model variable in the text completion flow?

    -The model variable in the text completion flow allows the user to change the language model being used without modifying the flow itself. Although the video only uses Mistral Large, this flexibility enables the use of different models in the future.

  • How does the video demonstrate the multilingual capability of Mistral Large 2?

    -The video demonstrates the multilingual capability of Mistral Large 2 by asking it to translate the word 'computer' into five different languages, showcasing its ability to handle both alphabetic and character-based languages.

  • What is the purpose of the chat flow example in the video?

    -The chat flow example in the video is to show how Mistral Large 2 can maintain context over multiple turns of a conversation. It uses a chat flow to answer questions and provide follow-up responses based on the chat history.

  • What is the role of the 's' and 'instruct' tags in the prompt template?

    -The 's' and 'instruct' tags in the prompt template are used to help the language model parse the prompt more effectively. They provide instructions and context to the model, which aids in generating more accurate responses.

  • How can the state be maintained in a chat flow as demonstrated in the video?

    -In the video, the state is maintained by sending the entire chat history with each request. However, for a more practical application, it suggests using client-side JavaScript or server-side routes to store and manage the state between requests.

  • What is tool calling and when can we expect to see a video on it?

    -Tool calling is a feature that allows the language model to interact with external tools or services. The video mentions that a video demonstrating tool calling with Mistral Large will be released soon.

Outlines

00:00

💻 Introduction to Working with Mistral Large 2 and Watson X Flows

This paragraph introduces the final video in a series focused on exploring the use of Mistral Large 2, a language model adept at reasoning and code generation, with Watson X Flows engine. Mistral Large 2 supports a multitude of languages, including character-based ones like Chinese, Japanese, and Hindi, making it suitable for developers working with diverse linguistic backgrounds. The video demonstrates how to deploy a text completion flow using Watson X Flows engine and Mistral Large 2 through the command line interface (CLI) and interact with it using JavaScript SDK. The flow is designed to be adaptable, allowing for changes in parameters such as temperature and stop sequences. The deployment process is showcased, highlighting the ease and speed with which a live endpoint can be created.

05:03

🌐 Deploying and Interacting with Text Completion and Chat Flows

In this paragraph, the video script details the process of deploying a text completion flow using the Watson X Flows engine and Mistral Large 2. The script provides a step-by-step guide on setting up a JavaScript application to interact with the deployed flow. It showcases an example where the model is asked to translate the word 'computer' into five different languages, demonstrating its multilingual capabilities. The video then transitions to creating a chat flow, which requires maintaining the chat history for context. The script explains how to set up the chat flow in the Watson X Flows engine, deploy it, and interact with it using a JavaScript application. It also touches on the concept of tool calling, which will be covered in future videos, and encourages viewers to subscribe to the YouTube channel for regular updates.

10:03

📺 Conclusion and Invitation to Explore More Watson X Flows Applications

The final paragraph of the script wraps up the video by inviting viewers to explore other videos in the series on the YouTube playlist. It emphasizes the variety of applications that can be built using Watson X Flows, such as summarization and RAG (Retrieval-Augmented Generation). The script encourages viewers to subscribe to the channel and like the video to stay updated with the weekly releases, promising more content on tool calling and other advanced features in future videos.

Mindmap

Keywords

💡Explow Engine

The 'Explow Engine' is a framework mentioned in the script for building AI flows. It allows users to create various AI functionalities using a declarative flow language. In the video's context, it is used to demonstrate how to integrate with large language models like Mr Large 2 for tasks such as text completion and chat flows. The script shows how to deploy flows using the Explow Engine's CLI and interact with them using SDKs for JavaScript or Python.

💡Large Language Models (LLMs)

Large Language Models, or LLMs, refer to advanced AI models that are capable of understanding and generating human-like text. The script specifically mentions Mr Large 2, which is highlighted for its multilingual capabilities and reasoning skills. The video explores using LLMs within the Explow Engine to perform tasks like code generation and text translation across different languages.

💡Misto Large 2

Misto Large 2 is a large language model that is showcased in the video for its proficiency in reasoning and code generation. It is designed to be multilingual, supporting a wide range of languages, which makes it a versatile tool for developers looking to build applications that cater to diverse linguistic backgrounds. The script provides examples of how Misto Large 2 can be used to translate words and engage in multilingual conversations.

💡Multilingual Support

The term 'Multilingual Support' in the script refers to the ability of Misto Large 2 to handle multiple languages, including character-based languages like Chinese, Japanese, and Hindi. This feature is crucial for global applications aiming to serve users from different linguistic backgrounds. The video demonstrates this by showing how Misto Large 2 can translate the word 'computer' into several languages.

💡Context Window

The 'Context Window' mentioned in the script is a feature of Misto Large 2, which allows it to process and reason over large pieces of text. With a context window of almost 130,000 tokens, Misto Large 2 can effectively handle complex reasoning tasks that involve extensive text analysis. This capability is showcased in the video through examples of text completion and chat flows.

💡Text Completion

Text Completion is a task where the AI model generates text based on a given prompt. In the video, text completion is one of the AI flows demonstrated using the Explow Engine and Misto Large 2. The script describes creating a flow for text completion, where the model generates text based on a prompt template and parameters like temperature and stop sequence.

💡Chat Flow

A 'Chat Flow' in the script refers to a sequence of interactions designed to simulate a conversation with an AI. The video shows how to set up a chat flow using the Explow Engine and Misto Large 2, where the model responds to user prompts in a conversational manner. The script illustrates this with an example of asking the model to explain a concept in simple terms.

💡CLI (Command Line Interface)

The 'CLI' in the script stands for Command Line Interface, which is a way to interact with the Explow Engine. The video demonstrates using the CLI to deploy AI flows to a live endpoint. This involves running commands like 'WX flow deploy' to upload the flow configuration and make it accessible online.

💡SDK (Software Development Kit)

The 'SDK' mentioned in the script refers to the Software Development Kit provided by the Explow Engine. It is used to interact with the deployed AI flows programmatically. The video shows examples of using the SDK in JavaScript to send requests to the AI flows and receive responses, as well as using it to maintain state in a chat flow.

💡Prompt Template

A 'Prompt Template' in the script is a predefined structure used to guide the AI model's responses. It includes tags and instructions that help the model understand the context and desired output. The video demonstrates creating prompt templates for Misto Large 2 to ensure that the model generates responses in the desired format, such as translations or explanations.

Highlights

Introduction to using an explainable engine with large language models, focusing on IBM Granite and MeLLa 3.1.

Demonstration of working with Mistral Large 2, known for its reasoning and code generation capabilities.

Mistral Large 2's multilingual support, including character-based languages like Chinese, Japanese, and Hindi.

Mistral Large 2's large context window of 130,000 tokens, beneficial for reasoning with large text pieces.

Using the Watson X Flows engine to build AI flows with a declarative flow language.

Deployment of a text completion flow using the Watson X Flows engine and CLI.

Interaction with the deployed flow using JavaScript SDK to perform text completion.

Translation of the word 'computer' into five different languages using Mistral Large.

Setting up a chat flow in the Watson X Flows engine for conversational AI.

Maintaining state in chat flows by sending the entire chat history with each request.

Creating a chat flow that uses Mistral Large for conversational responses.

Using the SDK to interact with the chat flow and receive conversational responses.

Handling follow-up questions in the chat flow by updating the prompt with previous interactions.

Potential for building client-side or server-side applications to maintain chat state.

Upcoming video on tool calling with Mistral Large, expanding the capabilities of the language model.

Encouragement to subscribe to the YouTube channel for weekly updates on AI and language model applications.

Transcripts

play00:04

welcome to a final video in a series

play00:06

where I'll be exploring how to use

play00:08

what's an explow engine with different

play00:09

large language models so far we've

play00:12

experimented with IBM granite and also

play00:14

me llama 3.1 in this final video I'll be

play00:18

showing you how to work with mistol

play00:20

large so Mr Large 2 is really good at

play00:23

reasoning or helping you with code

play00:25

generation also it's multilingual by

play00:27

design it doesn't only support languages

play00:30

such as English or Spanish or French it

play00:33

also supports a large number of

play00:34

character-based languages such as

play00:36

Chinese Japanese or Hindi so this will

play00:39

help developers with all sorts of

play00:41

different languages to build

play00:43

applications and services for all sorts

play00:45

of linguistic backgrounds r large 2 also

play00:48

works really well when you're trying to

play00:50

do reasoning also reasoning that

play00:53

involves larger pieces of text because

play00:55

it has a really large context window of

play00:57

almost 130,000 tokens

play01:01

in this video we'll be using the Mr

play01:03

Large model together with what's an XF

play01:05

flows engine if you're not familiar with

play01:06

what's an X flows engine it's a

play01:08

framework to build AI flows meaning you

play01:11

can use a declarative flow language to

play01:14

build any AI flow ranging from text

play01:16

completion summarization classification

play01:19

to even retrieval augment to generation

play01:21

or rack and we have a ton of videos on

play01:23

these topics right here on this YouTube

play01:25

channel what we'll be doing today is

play01:27

we'll be using a couple of flows mostly

play01:29

vertex completion but also a chat flow

play01:32

together with Mr Large and then we'll be

play01:34

using what's an explow engine using the

play01:36

CLI to deploy this to a live endpoint

play01:39

and we'll be using the SDK to interact

play01:41

with it from a little bit of JavaScript

play01:43

code there is also a python SDK

play01:45

available in case you prefer writing

play01:47

python so let's dive into vs code and

play01:50

get

play01:50

started in order to create a new whatson

play01:53

X flows engine project you need to

play01:55

install the CLI I've already installed

play01:57

the wxf flow CLI but going to the

play02:00

dashboard and signing up for a free

play02:02

account it's important to remember that

play02:05

you can sign up for free there is no

play02:06

credit card required and signing up for

play02:08

free allows you to use all sorts of llms

play02:11

including Mr Large which we'll be doing

play02:13

in this video I've created my very first

play02:16

flow which is a flow for text completion

play02:19

so this flow is composed of only two

play02:21

steps there's one step which is setting

play02:23

the prom template and then there's

play02:25

another step that's setting the

play02:27

completion that goes to the large

play02:29

language model in completion I've

play02:31

decided to make the model a variable

play02:33

that I can tweak even though we only

play02:35

will be using Mr Large today I'm only

play02:38

sending off a set of parameters as well

play02:41

so this could be the temperature or a

play02:43

stop sequence in my prom template I've

play02:45

created the prom template that works

play02:47

best for Mr Large as you can see here

play02:51

we're setting a couple of tags such as

play02:53

the S and instruct and this will help

play02:55

the LM to parse the prompt we send over

play03:00

in order to deploy this the only thing I

play03:01

need to do is run your command WX flow

play03:04

deploy and what this will do it will

play03:06

take my flow configuration it will take

play03:09

any environment variables I have in this

play03:11

environment file and then it deploys

play03:13

them to a live endpoint as you can see

play03:15

here it only took 6 seconds to deploy

play03:17

this text completion flow to a live

play03:19

endpoint and whenever it's available on

play03:21

the endpoint I can then use the SDK for

play03:24

JavaScript or python to interact with my

play03:27

flows I've set up a small example

play03:30

JavaScript code um in the beginning you

play03:32

need to set up your WX flows endpoint

play03:34

and API key and of course I've hidden

play03:37

this information for you which you

play03:38

should uncommon these lines and add your

play03:40

own values um and then finally I'm going

play03:44

to interact to my flow you can see I

play03:46

have a function model. flow which takes

play03:49

these schaps it is an overview of all

play03:51

the different flows I have and the SDK

play03:53

will help you to generate this then I

play03:56

need my flow name which in this case is

play03:58

text completion I need to set some

play04:00

variables and then I want to set the

play04:03

model so the model I'll be using is the

play04:05

Mr Large model and this is available on

play04:07

what's a next and you can use it for

play04:09

free in flows

play04:11

engine so let's say I have a question

play04:14

and remember this model is very good in

play04:16

working in different languages so I can

play04:19

for example ask can you

play04:24

translate the word

play04:28

computer into five different

play04:31

languages so this should be doable for

play04:34

most llms let's see what Mr Large comes

play04:36

up with but first I'm going to give it a

play04:39

format or a structure that I want my

play04:41

answers to be in use the

play04:45

following format and for this I want to

play04:49

do language and then I want to do the

play04:55

translation so let me save this and then

play04:57

I can run the node.js app by running

play04:59

note in next.js and it should return the

play05:03

response in my

play05:07

terminal if you look at the response you

play05:10

can see it's giving me the translations

play05:12

in five different languages uh Spanish

play05:15

French German Italian and then also in

play05:18

Japanese and a Japanese one is

play05:20

interesting for this model because not

play05:22

all LMS are able to work with character

play05:24

only languages such as

play05:27

Japanese besides Simple Text completion

play05:29

we can also create a chat flow and to

play05:32

implement a chat flow you normally also

play05:34

need some sort of JavaScript application

play05:36

or a way to main stain state for now

play05:39

we're going to assume that all these

play05:41

flows are text in or text out meaning

play05:43

that on every request I'm going to send

play05:46

over the entire chat history so let's

play05:48

get back into vs code and set up a chat

play05:52

flow in my WX flows ATO file I can now

play05:55

create another

play05:58

flow I'm I'm going to call this flow

play06:00

chat and it takes two steps one step is

play06:03

templated prompt which will take my

play06:04

promp template as you can see this time

play06:06

I'm leaving over the formatting of the

play06:09

prom template to my JavaScript

play06:11

application also I'm hardcoding the

play06:14

model to be myal a/ mistal D large and

play06:18

this is the model ID that I need to use

play06:20

if I want to access myal large through

play06:22

the Watson X platform if I save this and

play06:26

deploy this by typing WX flows deploy in

play06:29

my terminal it will make this flow

play06:31

available on a live handpoint

play06:34

as we saw before this will only take a

play06:37

couple of seconds to deploy this

play06:39

directly to the cloud in my application

play06:43

I already set up the flow name to be

play06:45

chat and then I then I pasted a part of

play06:48

my prom template in there so in here I

play06:50

can type a question

play06:52

like I want to

play06:55

learn more about

play06:57

LMS please EXP explain it to

play07:01

me

play07:03

like I'm a

play07:08

5-year-old and by Saving this I can now

play07:10

run my nodejs app by running node

play07:13

index.js and this will take my new flow

play07:16

called chat it will pass in this promt

play07:20

and then it will use the Mr Large model

play07:23

I can actually delete this as I already

play07:25

defined the model directly in my

play07:27

flow if I look at the end answer it says

play07:30

sure imagine playing a game blah blah

play07:33

assume you want to ask a follow-up

play07:35

question what I should do then is I can

play07:38

copy this the response and put it in my

play07:42

prompt and what I can do then I can

play07:45

close this interaction by using this tag

play07:48

which is

play07:49

s and I can create a new instruction so

play07:52

the new instruction would be the

play07:54

follow-up

play07:55

question like

play08:00

mention playing a game where you have to

play08:02

guess what someone is thinking I can

play08:05

then ask give me an example of a

play08:09

game and

play08:12

by closing this I close the

play08:15

instruction I can save it and then I

play08:17

need to make sure there's a space here

play08:18

so the LM knows it needs to do

play08:20

completion if I save this and run my no

play08:23

GS app again what it will do it will

play08:26

take the entire chat history which is my

play08:28

first question the

play08:30

answer of the LM and then my follow-up

play08:32

question and it should generate another

play08:37

answer so it says let's play a game what

play08:40

am I and then finally in the end it says

play08:43

is it the lion yes it is it isn't

play08:45

related to the LM so let's find out

play08:47

what's going wrong I should probably be

play08:50

a bit more explicit and say give me an

play08:52

example of a game that

play08:55

explains what a

play08:57

large language model is and if I save

play09:01

this and we my nodejs up again it should

play09:04

now take the previous history and use

play09:07

this to give me an example of a game

play09:10

instead of coming up with a new

play09:18

game and as you can see they're uh

play09:21

proposing a game where uh you need to

play09:24

reason and then figure out the L LM is

play09:26

something that

play09:28

thinks as a followup what you probably

play09:30

want to do is turn this into some client

play09:33

side JavaScript application or maybe you

play09:35

want to build a server side route where

play09:37

you're maintaining this state because

play09:39

now you need to copy paste it and every

play09:40

time you need to rerun uh this specific

play09:43

function you probably want to store this

play09:45

state somewhere and then have the SDK uh

play09:49

returning it for you on every

play09:51

request what you can also do with the Mr

play09:54

Large models is tool calling I didn't

play09:56

show any tool calling sample today but I

play09:59

promise you you can find a video on tool

play10:01

calling on this channel very

play10:03

soon and that's how easy it is to build

play10:06

a new application using whatson explos

play10:08

engine together with a Mr Large model if

play10:11

you missed any of the other videos in

play10:13

this series make sure to look at our

play10:15

YouTube playlist because there are more

play10:17

videos in this series and we also have

play10:19

examples on building other types of

play10:21

applications such as summarization or

play10:23

rag keep an eye out for our YouTube

play10:26

channel because we will be releasing

play10:27

videos on a weekly basis so make sure to

play10:30

subscribe and like this video

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
AI DevelopmentWatson ExplorerLanguage ModelsCode GenerationMultilingual SupportText CompletionChat FlowsSDK IntegrationAI FlowsModel Deployment
Benötigen Sie eine Zusammenfassung auf Englisch?