Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sonichi opened this issue Dec 30, 2023 · 3 comments
Closed

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

sonichi opened this issue Dec 30, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation function/tool suggestion and execution of function/tool call

Comments

@sonichi
Copy link
Collaborator

sonichi commented Dec 30, 2023

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 sonichi added documentation Improvements or additions to documentation function/tool suggestion and execution of function/tool call labels Dec 30, 2023
@sonichi
Copy link
Collaborator Author

sonichi commented Dec 30, 2023

@davorrunje for confirming.

@sonichi sonichi added the good first issue Good for newcomers label Dec 30, 2023
@ekzhu
Copy link
Collaborator

ekzhu commented Dec 30, 2023

Sorry to take someone else's good first issue 😏

@davorrunje
Copy link
Collaborator

@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.

@sonichi sonichi removed the good first issue Good for newcomers label Dec 31, 2023
@ekzhu ekzhu closed this as completed Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation function/tool suggestion and execution of function/tool call
Projects
None yet
Development

No branches or pull requests

3 participants