FunctionTool declares every functools.partial as `partial` and drops the `__call__` docstring

Aperta
#7,190 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
ai, tooling

Direzione di ricerca

Start in google.adk.tools.function_tool.FunctionTool and google.adk.models.llm_request.LlmRequest, using the reported Python 3.13 reproduction to trace tool naming and declaration descriptions. Done means both functools.partial tools retain distinct names and docstrings, and OrderLookup's call docstring appears in its declaration.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

If you bind an API key into two tools with functools.partial, they're both declared as partial with the functools.partial docstring. Only the last one stays registered, so weather calls run get_forecast.

A callable object documented only on __call__ shows that docstring in tool.description, but its declaration doesn't have one.

Repro on main (f33d492), Python 3.13:

from functools import partial
from google.adk.models.llm_request import LlmRequest
from google.adk.tools.function_tool import FunctionTool

def get_weather(key: str, city: str):
  """Current weather for a city."""

def get_forecast(key: str, city: str):
  """Forecast for a city."""

class OrderLookup:
  def __call__(self, order_id: str):
    """Finds an order by id."""

req = LlmRequest()
req.append_tools([FunctionTool(partial(get_weather, "k")),
                  FunctionTool(partial(get_forecast, "k")),
                  FunctionTool(OrderLookup())])
for d in req.config.tools[0].function_declarations:
  print(d.name, repr(d.description))

It logs Duplicate tool name 'partial', prints partial twice, then OrderLookup None. I'd expect each tool under its own name and docstring.

Lingua principale
Python
Stelle
21.6k
Fork
4k
Merge medio
13h 49m
PR unite (30g)
10

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/adk-python

Tutte le issue di google/adk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.