Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Mistral powered search engine (native RAG and tools calling) #52

Merged
merged 9 commits into from
Jun 11, 2024

Conversation

HugoLB0
Copy link
Contributor

@HugoLB0 HugoLB0 commented Jun 11, 2024

Hello,
I've written a search engine based on Mistral large that uses RAG and tools calling from mistral native documentation.

@HugoLB0 HugoLB0 changed the title pushing mistral-search-engine.ipynb adding Mistral powered search engine (native RAG and tools calling) Jun 11, 2024
}
],
"source": [
"import session_info\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!pip install session_info is maybe missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

session-info is only to display the libraries version, it is not necessary required.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its just that it makes it more user friendly to be able to just download the notebook and run it on colab without any major changes, if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem I will remove it.

"Traceback (most recent call last):\n",
" File \"/Users/hugolebelzic/miniconda3/envs/mistral-cookbook-contrib/lib/python3.10/site-packages/mistralai/client.py\", line 49, in __del__\n",
" self._client.close()\n",
"AttributeError: 'MistralClient' object has no attribute '_client'\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to handle this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I ran it again and wasn't able to reproduce this error. Do you have more indications ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the error was fixed by itself, weirdly...
Btw, if possible keep the !pip install for the rest of the required libraries!
Otherwise I think everything is alright.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added it! everything should be good now

"while True:\n",
" input_ = input(\"Ask: \")\n",
" messages.append(ChatMessage(role=\"user\", content=input_))\n",
" response = client.chat(model=model, messages=messages, tools=tools, tool_choice=\"auto\")\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not work if the model decides to not use a function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can force the tool choice.

"while True:\n",
" input_ = input(\"Ask: \")\n",
" messages.append(ChatMessage(role=\"user\", content=input_))\n",
" response = client.chat(model=model, messages=messages, tools=tools, tool_choice=\"auto\")\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly it seems it was not updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pushed again, and I actually found the cause of the issue so it is fixed now.

"while True:\n",
" input_ = input(\"Ask: \")\n",
" messages.append(ChatMessage(role=\"user\", content=input_))\n",
" response = client.chat(model=model, messages=messages, tools=tools, tool_choice=\"force\")\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force is not an option, maybe 'any'?

And I think thats the only thing, everything else seems to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea sorry you're right I keep getting confused with force and any. Just made the change !

@pandora-s-git
Copy link
Collaborator

Nice! You can add it to the readme under the mistral section, since this uses mostly our documentation I believe it deserves to be in there and we can merge it!

@pandora-s-git
Copy link
Collaborator

This should do, thanks for the contribution!

@pandora-s-git pandora-s-git merged commit 8a3eb02 into mistralai:main Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants