meta-llama / llama-models

Utilities intended for use with Llama models.
Other
4.88k stars 839 forks source link

"llama model list" tool fails with error: cannot specify Annotated and value Field's together for 'query_generator_config' #160

Closed FedorSymkin closed 1 month ago

FedorSymkin commented 1 month ago

Hello. I'm trying to download llama models, and I get an error:

$ llama model list
Traceback (most recent call last):
  File "/home/<username>/.local/bin/llama", line 8, in <module>
    sys.exit(main())
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/llama.py", line 42, in main
    parser = LlamaCLIParser()
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/llama.py", line 32, in __init__
    StackParser.create(subparsers)
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/subcommand.py", line 16, in create
    return cls(*args, **kwargs)
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/stack/stack.py", line 33, in __init__
    StackListProviders.create(subparsers)
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/subcommand.py", line 16, in create
    return cls(*args, **kwargs)
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/stack/list_providers.py", line 21, in __init__
    self._add_arguments()
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/cli/stack/list_providers.py", line 25, in _add_arguments
    from llama_stack.distribution.distribution import stack_apis
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/distribution/distribution.py", line 13, in <module>
    from llama_stack.apis.agents import Agents
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/apis/agents/__init__.py", line 7, in <module>
    from .agents import *  # noqa: F401 F403
  File "/home/<username>/.local/lib/python3.10/site-packages/llama_stack/apis/agents/agents.py", line 155, in <module>
    class MemoryToolDefinition(ToolDefinitionCommon):
  File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 497, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 476, in pydantic.fields.ModelField._get_field_info
ValueError: cannot specify `Annotated` and value `Field`s together for 'query_generator_config'

Versions:

$ python3 --version
Python 3.10.12

$ pip3 list | grep -i -e llama -e pydantic
llama_models              0.0.36
llama_stack               0.0.36
llama_toolchain           0.0.35
pydantic                  1.10.7

I see the last version was released a few days ago (25.09) https://pypi.org/project/llama-toolchain/ Maybe there is some bug in the last release or I'm doing something wrong?

ashwinb commented 1 month ago

The issue is pydantic. It needs to be >= 2 which I suppose our dependencies don't enforce. Could you pip uninstall pydantic and pip install pydantic>=2 ?

ashwinb commented 1 month ago

But regardless, we should not be importing all these llama_stack.apis.agents modules at all. We will get that fixed.

FedorSymkin commented 1 month ago

pydantic>=2

Thanks, it solved the problem.

Carlsans commented 1 month ago

Same here, solved.

ashwinb commented 1 month ago

Yay glad that got resolved.