epfl-dlab / aiflows

🤖🌊 aiFlows: The building blocks of your collaborative AI
https://epfl-dlab.github.io/aiflows/
MIT License
243 stars 11 forks source link

Feature/add api configuration helper and remove unused helper functions #10

Closed Tachi-67 closed 11 months ago

Tachi-67 commented 11 months ago
nbaldwin98 commented 11 months ago

Hey @Tachi-67,

First off, thanks a ton for this PR! 🚀 I'm really liking the concept of quickly loading API information. What do you think about making the function a bit more versatile? For instance, instead of tying it specifically to the "api_infos" field, we could make it work for other items too. I was thinking of naming the function something like "quick_load." Here's a tweak to the function definition, feel free to adjust:

def quick_load(cfg, item, key="api_infos"):

Also, how about extending its functionality to support nested paths? Imagine a dictionary like this:

{
    "something":
        {"backend": 
            {"api_infos": "???"}
        },
    "backend":
        {"api_infos": "???"},
    "something else":  
        {"backend": 
            {"api_infos": "???"}}
}

If we call quick_load(cfg, "hi", key="something.backend.api_infos"), it could give us:

{
    "something":
        {"backend": 
            {"api_infos": "hi"}
        },
    "backend":
        {"api_infos": "hi"},
    "something else":  
        {"backend": 
            {"api_infos": "???"}}
}

I think this could be useful if you want to load different api_information for different type of Flows (e.g, you might want to have a different key for flows using Vision than ones using LLMs). This last remark might be a bit of a stretch. Would love to hear your thoughts on whether you think it would be useful

Let me know your take on these suggestions! 😊

Tachi-67 commented 11 months ago

Hey @Tachi-67,

First off, thanks a ton for this PR! 🚀 I'm really liking the concept of quickly loading API information. What do you think about making the function a bit more versatile? For instance, instead of tying it specifically to the "api_infos" field, we could make it work for other items too. I was thinking of naming the function something like "quick_load." Here's a tweak to the function definition, feel free to adjust:

def quick_load(cfg, item, key="api_infos"):

Also, how about extending its functionality to support nested paths? Imagine a dictionary like this:

{
    "something":
        {"backend": 
            {"api_infos": "???"}
        },
    "backend":
        {"api_infos": "???"},
    "something else":  
        {"backend": 
            {"api_infos": "???"}}
}

If we call quick_load(cfg, "hi", key="something.backend.api_infos"), it could give us:

{
    "something":
        {"backend": 
            {"api_infos": "hi"}
        },
    "backend":
        {"api_infos": "hi"},
    "something else":  
        {"backend": 
            {"api_infos": "???"}}
}

I think this could be useful if you want to load different api_information for different type of Flows (e.g, you might want to have a different key for flows using Vision than ones using LLMs). This last remark might be a bit of a stretch. Would love to hear your thoughts on whether you think it would be useful

Let me know your take on these suggestions! 😊

Hey, thank you for the advise, I really like the point of making the helper more general. I've just done that in the newest version of my commit.

For the second part of the advise, I would actually create another method (that being said, another pr) to configure multiple chat providers to differnent backends, just to make it more clear and separated, instead of adding complexity to the quick_load method.

Those are brilliant ideas indeed, thanks for the info! ;-)