Replies: 2 comments
-
Hi @BubuDavid - this area has changed a bit in the branch, the most relevant lines are here: fast-agent/src/mcp_agent/llm/providers/augmented_llm_openai.py Lines 104 to 112 in 886f0c7 and here: fast-agent/src/mcp_agent/llm/providers/augmented_llm_openai.py Lines 320 to 348 in 886f0c7 This gives us a couple of options. I think it would probably be best to have an AzureOpenAi Provider (e.g. I think you're on the Discord, so if you want to coordinate updating/testing that'd be appreciated 👍. |
Beta Was this translation helpful? Give feedback.
-
@evalstate Any working example with Azure OpenAI? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What I wanted and what I knew
Hi there. As a lot of people on this community I wondered if I could connect to an Azure OpenAI Endpoint and create a
fast-agent
that interacts with it. It is easy to get a chat completion using theAzureOpenAI
specialized client from openai python sdk library, but given the fact that on fast-agent, currently there is no way to specify custom clients, I experimented a little and discover that the way of get chat completion from an Azure Endpoint using the default OpenAI client was doing something like this:The problem and my solution
Looking at the current code
0.2.14
I was not able to find a way to "inject" that extra parameter calledextra_query
with the default config files builder, so what I did was add this code to be able to do it:So, if we write our config file with the following structure, specifically for openai (but it works for generic too):
That passes, the complete object inside
extra_params
key, to the variable calledarguments
, and that injects arguments in theopenai_client.chat.completions.create
method. So, now I can call Azure Endpoints with specific parameters.Generics
I haven't experimented with generic models such as grok or ollama models, but I know that you need certain control over the parameters passed to the requests, and this little change actually solves that problem. I haven't run any test or considered other options, that is why this is a discussion and not a PR haha I do not know if this change breaks something else.
Just wanted to share in case this is useful for someone, or if I just wasted my afternoon because there was a more direct and actually supported way of doing this... that's valid too.
Beta Was this translation helpful? Give feedback.
All reactions