microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.25k stars 4.56k forks source link

[Doc]: function calling sample code in documentation website #1107

Closed sonichi closed 8 months ago

sonichi commented 9 months ago

Describe the issue

In this example:

from typying import Literal
from typing_extensions import Annotated
from pydantic import BaseModel, Field
from somewhere import exchange_rate
from myagents import agent, user_proxy

# defines a Pydantic model
class Currency(BaseModel):
  # parameter of type CurrencySymbol
  currency: Annotated[CurrencySymbol, Field(..., description="Currency symbol")]
  # parameter of type float, must be greater or equal to 0 with default value 0
  amount: Annotated[float, Field(0, description="Amount of currency", ge=0)]

@user_proxy.register_for_execution()
@chatbot.register_for_llm(description="Currency exchange calculator.")
def currency_calculator(
  base: Annotated[Currency, "Base currency: amount and currency symbol"],
  quote_currency: Annotated[CurrencySymbol, "Quote currency symbol"] = "USD",
) -> Currency:
  quote_amount = exchange_rate(base.currency, quote_currency) * base.amount
  return Currency(amount=quote_amount, currency=quote_currency)

agent and chatbot are not consistent.

Steps to reproduce

https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#function-calling

The second sample code in this section.

Screenshots and logs

image

Additional Information

No response

sonichi commented 9 months ago

@davorrunje for confirming.

ekzhu commented 9 months ago

Sorry to take someone else's good first issue 😏

davorrunje commented 9 months ago

@davorrunje for confirming.

@sonichi thank you for pointing it out. I am not happy with documentation at all, I plan to rewrite it properly next week.