Maplemx / Agently

[AI Agent Application Development Framework] - 🚀 Build AI agent native application in very few code 💬 Easy to interact with AI agent in code using structure data and chained-calls syntax 🧩 Enhance AI Agent using plugins instead of rebuild a whole new agent
http://agently.tech
Apache License 2.0
908 stars 100 forks source link

no place to fill in deployment when using Azure openai #105

Closed allanwakes closed 2 weeks ago

allanwakes commented 3 weeks ago

I tried to use Agently with Azure openai, but I found that there is no place to fill in deployment when initializing agent. Take llamaindex for example:

llm = AzureOpenAI(  
    model="gpt-3.5-turbo-16k",  
    deployment_name="xxx",  
    api_key=os.getenv("AZURE_KEY"),  
    azure_endpoint="https://xxx.openai.azure.com/",  
    api_version="xxxx-xx-xx",  
    # temperature=0.6  
)  

Thanks.

Maplemx commented 3 weeks ago

try options

.set_settings("model.AzureOpenAI.options", { "deployment_name": "xxx" })

allanwakes commented 3 weeks ago

try options

.set_settings("model.AzureOpenAI.options", { "deployment_name": "xxx" })

I tried with this options, but an exception pops out Exception: [Agent Request] Error: AsyncCompletions.create() got an unexpected keyword argument 'deployment_name'

Maplemx commented 3 weeks ago

I see, I will check and fix this

Maplemx commented 2 weeks ago

fixed in https://github.com/Maplemx/Agently/commit/4b97e3180cc35d57e0685eca6b35f58dbac72629

will be published in version 3.3.1.1

how to set:

.set_settings("current_model", "AzureOpenAI")
.set_settings("model.AzureOpenAI.auth", {
    "api_key": "xxxxx",
    "api_version": "2024-02-01",
    "azure_endpoint": "https://xxx.openai.azure.com/",
    "azure_deployment": "xxx",
})

please confirm param names by reading Microsoft official document or reading azure python file in OpenAI package:

class AzureOpenAI(BaseAzureClient[httpx.Client, Stream[Any]], OpenAI):
    @overload
    def __init__(
        self,
        *,
        azure_endpoint: str,
        azure_deployment: str | None = None,
        api_version: str | None = None,
        api_key: str | None = None,
        azure_ad_token: str | None = None,
        azure_ad_token_provider: AzureADTokenProvider | None = None,
        organization: str | None = None,
        timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
        max_retries: int = DEFAULT_MAX_RETRIES,
        default_headers: Mapping[str, str] | None = None,
        default_query: Mapping[str, object] | None = None,
        http_client: httpx.Client | None = None,
        _strict_response_validation: bool = False,
    ) -> None:
        ...
Maplemx commented 2 weeks ago

published in version 3.3.1.1