Skip to content

Commit

Permalink
fix use case in website (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzhu authored Dec 30, 2023
1 parent f497710 commit a9483a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions website/docs/Use-Cases/agent_chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ or Pydantic models:
The following examples illustrates the process of registering a custom function for currency exchange calculation that uses type hints and standard Python datatypes:

``` python
from typying import Literal
from typing import Literal
from typing_extensions import Annotated
from somewhere import exchange_rate
# the agents are instances of UserProxyAgent and AssistantAgent
from myagents import agent, user_proxy
# the agents are instances of AssistantAgent and UserProxyAgent
from myagents import chatbot, user_proxy

CurrencySymbol = Literal["USD", "EUR"]

# registers the function for execution (updates function map)
@user_proxy.register_for_execution()
# creates JSON schema from type hints and registers the function to llm_config
@agent.register_for_llm(description="Currency exchange calculator.")
@chatbot.register_for_llm(description="Currency exchange calculator.")
# python function with type hints
def currency_calculator(
# Annotated type is used for attaching description to the parameter
Expand Down Expand Up @@ -138,11 +138,11 @@ encoded string automatically.
The following example shows how we could rewrite our currency exchange calculator example:

``` python
from typying import Literal
from typing import Literal
from typing_extensions import Annotated
from pydantic import BaseModel, Field
from somewhere import exchange_rate
from myagents import agent, user_proxy
from myagents import chatbot, user_proxy

# defines a Pydantic model
class Currency(BaseModel):
Expand Down

0 comments on commit a9483a4

Please sign in to comment.