Skip to content

Instantly share code, notes, and snippets.

@ashen007
Created April 26, 2025 06:46
Show Gist options
  • Select an option

  • Save ashen007/c9d44d32423dbe641617dd75fa849112 to your computer and use it in GitHub Desktop.

Select an option

Save ashen007/c9d44d32423dbe641617dd75fa849112 to your computer and use it in GitHub Desktop.
{
'answer': '[{"title": "TELEGRAPH VOYAGE", "revenue": Decimal("1631.25")}, {"title": "PELICAN COMFORTS", "revenue": Decimal("1234.47")}, {"title": "TITANS JERK", "revenue": Decimal("1217.44")}]',
'messages': [HumanMessage(content='what are the top 3 in-term of revenue in PG rating films?',
id='6a0c3175-16b2-49db-b33f-a096ffc65556'), AIMessage(content='', additional_kwargs={
'tool_calls': [{'id': 'call_8y82', 'function': {
'arguments': '{"query": "select title, sum(amount * datediff(return_date, rental_date)) as revenue from film join (select i.film_id, r.* from inventory as i join (select rental.inventory_id, rental.rental_id, amount, return_date, rental_date from rental join payment on rental.rental_id = payment.rental_id) as r on i.inventory_id = r.inventory_id) as t on film.film_id = t.film_id where film.rating = \'PG\' group by title order by revenue desc limit 3"}',
'name': 'db_query_tool'}, 'type': 'function'}]}, response_metadata={
'token_usage': {'completion_tokens': 118, 'prompt_tokens': 1779, 'total_tokens': 1897,
'completion_time': 0.472, 'prompt_time': 0.420915458, 'queue_time': 0.00543037399999996,
'total_time': 0.892915458}, 'model_name': 'llama-3.1-70b-versatile',
'system_fingerprint': 'fp_9260b4bb2e', 'finish_reason': 'tool_calls', 'logprobs': None},
id='run-621a4be6-433a-463d-bd17-f024c8427c42-0',
tool_calls=[
{'name': 'db_query_tool',
'args': {
'query': "select title, sum(amount * datediff(return_date, rental_date)) as revenue from film join (select i.film_id, r.* from inventory as i join (select rental.inventory_id, rental.rental_id, amount, return_date, rental_date from rental join payment on rental.rental_id = payment.rental_id) as r on i.inventory_id = r.inventory_id) as t on film.film_id = t.film_id where film.rating = 'PG' group by title order by revenue desc limit 3"},
'id': 'call_8y82',
'type': 'tool_call'}]),
ToolMessage(
content="[{'title': 'TELEGRAPH VOYAGE', 'revenue': Decimal('1631.25')}, {'title': 'PELICAN COMFORTS', 'revenue': Decimal('1234.47')}, {'title': 'TITANS JERK', 'revenue': Decimal('1217.44')}]",
name='db_query_tool', id='7b28c830-bd83-4148-b38d-42771ac350d4', tool_call_id='call_8y82')]}[
{"title": "TELEGRAPH VOYAGE", "revenue": Decimal("1631.25")}, {"title": "PELICAN COMFORTS",
"revenue": Decimal("1234.47")}, {
"title": "TITANS JERK", "revenue": Decimal("1217.44")}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment