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

Want to use client_tool calls, but code_interpreter is used instead #820

Open
1 of 2 tasks
aidando73 opened this issue Jan 18, 2025 · 3 comments
Open
1 of 2 tasks

Comments

@aidando73
Copy link
Contributor

aidando73 commented Jan 18, 2025

System Info

Collecting environment information...
PyTorch version: 2.5.1+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.10.16 (main, Dec 11 2024, 16:24:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.8.0-1021-aws-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               16
On-line CPU(s) list:                  0-15
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz
CPU family:                           6
Model:                                106
Thread(s) per core:                   2
Core(s) per socket:                   8
Socket(s):                            1
Stepping:                             6
BogoMIPS:                             5799.99
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd ida arat avx512vbmi pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear flush_l1d arch_capabilities
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            384 KiB (8 instances)
L1i cache:                            256 KiB (8 instances)
L2 cache:                             10 MiB (8 instances)
L3 cache:                             54 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-15
Vulnerability Gather data sampling:   Unknown: Dependent on hypervisor status
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==2.2.1
[pip3] torch==2.5.1
[pip3] triton==3.1.0
[conda] numpy                     2.2.1                    pypi_0    pypi
[conda] torch                     2.5.1                    pypi_0    pypi
[conda] triton                    3.1.0                    pypi_0    pypi

Information

  • The official example scripts
  • My own modified scripts

🐛 Describe the bug

Working with @heyjustinai to refactor coding agent example meta-llama/llama-stack-apps#150 to use Llama-stack agent framework - but running into this issue.

Code is here: https://github.com/aidando73/llama-stack-apps/pull/8/files#diff-0f147b774a4f5541b23f469ab2cd04a32b7c996c608ee0b09afb085e805ab019

I'm getting a lot of:

Traceback (most recent call last):
  File "/home/coder/dev/llama-stack/llama_stack/distribution/server/server.py", line 157, in sse_generator
    async for item in event_gen:
  File "/home/coder/dev/llama-stack/llama_stack/providers/inline/agents/meta_reference/agents.py", line 172, in _create_agent_turn_streaming
    async for event in agent.create_and_execute_turn(request):
  File "/home/coder/dev/llama-stack/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 194, in create_and_execute_turn
    async for chunk in self.run(
05:32:48.300 [START] tool_execution
  File "/home/coder/dev/llama-stack/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 268, in run
    async for res in self._run(
  File "/home/coder/dev/llama-stack/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 648, in _run
    result_messages = await execute_tool_call_maybe(
  File "/home/coder/dev/llama-stack/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 949, in execute_tool_call_maybe
    raise ValueError(f"Tool {name} not found in any tool group")
ValueError: Tool BuiltinTool.code_interpreter not found in any tool group

Specifically, I'm getting a good tool call on the first iteration

[list_files(path="django/")]

But then afterwards, I get only code_interpreter:

<|python_tag|>pick_file(path="django/docs/sources/releases/1.9.0.txt")

This is the compiled system prompt:

<|start_header_id|>system<|end_header_id|>

You are an expert in composing functions. You are given a question and a set of possible functions.
Based on the question, you will need to make one or more function/tool calls to achieve the purpose.
If none of the function can be used, point it out. If the given question lacks the parameters required by the function,
also point it out. You should only return the function call in tools call sections.

If you decide to invoke any of the function(s), you MUST put it in the format of [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)]
You SHOULD NOT include any other text in the response.

Here is a list of functions in JSON format that you can invoke.

{tool_defs}

You are an expert software engineer. You are given the following problem:
<problem_statement>
{problem_statement}
</problem_statement>

The repo is called django.

Here is the file tree of the repository:
<file_tree>
{file_tree}
</file_tree>

Your task is to locate the relevant file to the problem statement by making one or more function/tool calls.

If you have located the relevant file, call the `pick_file` function with the path to the file. E.g., `pick_file(path="src/file.py")`
<|eot_id|><|start_header_id|>user<|end_header_id|>

Turn 0<|eot_id|><|start_header_id|>assistant<|end_header_id|>

<|python_tag|>{"type": "function", "name": "list_files", "parameters": {"path": "django/"}}<|eot_id|><|start_header_id|>ipython<|end_header_id|>

FILE_CONTENT<|eot_id|><|start_header_id|>user<|end_header_id|>

Turn 1<|eot_id|><|start_header_id|>assistant<|end_header_id|>

<|python_tag|>pick_file(path="django/docs/sources/releases/1.9.0.txt")

^ Any future turns returns <|python_tag|>function_name(...) - I'm expecting regular tool calls [function_name(...)].

I suspect it's because tool calls from the llm are being rendered as

<|start_header_id|>assistant<|end_header_id|>

<|python_tag|>{"type": "function", "name": "list_files", "parameters": {"path": "django/"}}<|eot_id|>

So the llm thinks that that's how you make tool calls. When I was using raw completions API, I rendered the assistant response as:

<|start_header_id|>assistant<|end_header_id|>

[pick_file(path="django/docs/sources/releases/1.9.0.txt")]<|eot_id|>

And it worked pretty well, the LLM rendered future tool calls in the same way. You still get some hallucinations with <|python_tag|>, but not a big deal - whereas in this case if I have 10 turns, the 1st one is a good tool call, the remaining 9 are code_interpreter calls.

Is this behaviour intended?

Error logs

As above

Expected behavior

Expect not to use code interpreter unless I explicitly specify.

@aidando73
Copy link
Contributor Author

cc @heyjustinai

@cheesecake100201
Copy link
Contributor

cheesecake100201 commented Jan 22, 2025

As far as I know, llama models official documentation states that, if ipython is mentioned anywhere in the instructions, it is trained to invoke code_interpreter as tool for the query that has been asked? Could you once try this without adding ipython?

Image This is present in `llama_models/models/llama_3_1/prompt_format.md`

@aidando73

@heyjustinai
Copy link
Member

@aidando73 which model are you using?

cc: @dineshyv @hardikjshah This looks similar to the issue we discussed offline. If I’m not mistaken, Aidan is actually using 3.3 70B?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants