Show parameters for tool calls
This commit is contained in:
parent
50d04ea850
commit
5e3bddf60e
5
main.py
5
main.py
|
@ -40,10 +40,11 @@ def main():
|
||||||
result = llm.invoke({
|
result = llm.invoke({
|
||||||
'messages': messages,
|
'messages': messages,
|
||||||
})
|
})
|
||||||
for msg in result['messages']:
|
messages = result['messages']
|
||||||
|
for msg in messages[prev_idx:]:
|
||||||
print(f'{msg.type}: {msg.content}')
|
print(f'{msg.type}: {msg.content}')
|
||||||
messages.append(msg)
|
|
||||||
del msg
|
del msg
|
||||||
|
prev_idx = len(messages)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
2
tools.py
2
tools.py
|
@ -21,7 +21,7 @@ def wrap(class_, method):
|
||||||
logger.debug("Wrapping %s.%s", class_.__name__, method.__name__)
|
logger.debug("Wrapping %s.%s", class_.__name__, method.__name__)
|
||||||
is_iterator = str(method.__annotations__.get('return', '')).startswith('collections.abc.Iterator')
|
is_iterator = str(method.__annotations__.get('return', '')).startswith('collections.abc.Iterator')
|
||||||
def wrapper(input):
|
def wrapper(input):
|
||||||
logger.info("AI called %s.%s", class_.__name__, method.__name__)
|
logger.info("AI called %s.%s(%s)", class_.__name__, method.__name__, input)
|
||||||
result = method(input)
|
result = method(input)
|
||||||
if is_iterator:
|
if is_iterator:
|
||||||
result = list(result)
|
result = list(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user