Rust AI Function Calling - Full Tutorial (with async-openai)

  Рет қаралды 5,057

Jeremy Chone

Jeremy Chone

Күн бұрын

Пікірлер: 11
@gertrudessampaio8689
@gertrudessampaio8689 7 ай бұрын
Thank you very much Jeremy for this amazing work 😀😀😀😀
@christophermanning245
@christophermanning245 7 ай бұрын
I've been waiting for this for a long time !! Thanks a lot.
@wigglybenjamin
@wigglybenjamin 5 ай бұрын
IMPORTANT NOTE for the chapter on spec params: You can have schemars inline the referenced schema definitions for you AUTOMATICALLY. You just need to configure the settings manually instead of using the schemars::schema_for! macro (which assumes some default settings). This code worked for me in tool_spec(): let settings = SchemaSettings::default().with(|settings| { settings.inline_subschemas = true; }); let root_schema = SchemaGenerator::new(settings).into_root_schema_for::(); let mut json_schema = serde_json::to_value(root_schema)?; Then you can completely get rid of the function into_spec_params() and just re-use what is left over of the json_schema object after extracting your title and description. You should probably also remove the key "$schema", which just holds some metadata. BTW: The implementation of the XValue trait in the video uses Value::take to extract elements, which leaves the keys behind. This isn't a problem if you are constructing a new value with selected elements and discarding the rest, but what I decided to do was to change the implementation to remove the entire entry, because I want to re-use the json_schema object for more flexibility.
@JeremyChone
@JeremyChone 5 ай бұрын
Ho, that’s very cool. I did not notice that schemars setting. Also, yes, the x_take can and should be fine-tuned to the desired behavior. I just took one strategy, but I would agree that removing the entry completely might be even better. BTW, I like the x_… pattern because I can decide the logic I want for the app/lib code without wondering about externalizing. I sometimes have some vec utils as well as XVec. Thanks for sharing your notes. Good ones!
@Cryptopunkstar
@Cryptopunkstar 7 ай бұрын
Hi Jeremy ! I've been waiting for this for a long time !! Great thank 's
@sergioqcostas
@sergioqcostas 7 ай бұрын
Thanks a lot, exactly what I needed, one quick question, how can your api calls can retrieve weather? mine can't
@JeremyChone
@JeremyChone 7 ай бұрын
So, first my get_weather RPC is just a mock. Clone the repo and run example 3, and it should work. I use rpc-router
@kashnigahbaruda
@kashnigahbaruda 7 ай бұрын
King
@josephaxelripto8817
@josephaxelripto8817 6 ай бұрын
Can Ollama-rs perform function calling like in this video?
@JeremyChone
@JeremyChone 6 ай бұрын
So, Ollama does not have such an API, but you can accomplish the same result by giving precise instructions and then reorganizing the chat messages with the tool response. Basically, you're doing what ChatGPT does, but manually. Mistral did talk about adding function calling to Mixtral, I think, but I'm not sure how this is exposed.
@josephaxelripto8817
@josephaxelripto8817 6 ай бұрын
@@JeremyChone thanks for the answer. Do you have any example in rust?
Rust Ollama By Examples - 4 Chapters (Full Tutorial - Rust AI)
1:00:42
UUID v7 vs. v4 + Rust Programming Examples
19:41
Jeremy Chone
Рет қаралды 16 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 104 МЛН
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 1,1 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 8 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3,1 МЛН
Rust Error Handling - Best Practices
21:33
Jeremy Chone
Рет қаралды 24 М.
Daniel Thompson-Yvetot - Tauri 2.0 - DevWorld 2024
23:36
JSWORLD Conference
Рет қаралды 15 М.
Rust Programming: The Ultimate Builder Pattern Tutorial
20:22
Jeremy Chone
Рет қаралды 40 М.
Tonic makes gRPC in Rust stupidly simple
19:08
Dreams of Code
Рет қаралды 51 М.
5 Steps to Learn Rust Programming
25:06
Jeremy Chone
Рет қаралды 8 М.
you need to build a RUST desktop app!!
27:21
Travis Media
Рет қаралды 325 М.
9 Rust Best Practices with Real Lib (part 1/3)
27:11
Jeremy Chone
Рет қаралды 11 М.
Neural Networks From Scratch in Rust
9:12
codemoon
Рет қаралды 17 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 104 МЛН