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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'examples.ex4' has no attribute 'chain' #1

Open
aodrasa opened this issue Apr 20, 2023 · 1 comment
Open

AttributeError: module 'examples.ex4' has no attribute 'chain' #1

aodrasa opened this issue Apr 20, 2023 · 1 comment

Comments

@aodrasa
Copy link

aodrasa commented Apr 20, 2023

Running into this error, any solution to get it running?
Still fairly new to this and I'm sure it's straightforward fix.

Cheers 馃檹

[INFO] 2023-04-20 11:17:29.78 | api:create_service:75 | Creating service
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 31, in import_from_string
    instance = getattr(instance, attr_str)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'examples.ex4' has no attribute 'chain'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/langcorn", line 8, in <module>
    sys.exit(entrypoint())
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langcorn/__main__.py", line 17, in entrypoint
    fire.Fire(T())
  File "/usr/local/lib/python3.11/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langcorn/__main__.py", line 9, in server
    app = api.create_service(*lc, auth_token=auth_token)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langcorn/server/api.py", line 82, in create_service
    chain = import_from_string(lang_app)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 34, in import_from_string
    raise ImportFromStringError(
uvicorn.importer.ImportFromStringError: Attribute "chain" not found in module "examples.ex4".
@msoedov
Copy link
Owner

msoedov commented Apr 20, 2023

Hi @aodrasa, Thx for asking this question!
I believe an incorrectly specified application string caused the issue. It should be

"examples.ex4:sequential_chain"

since it declared as

sequential_chain = SequentialChain(
    chains=[requests_chain, llm_chain],
    input_variables=["query", "url"],
    output_variables=["text"],
    verbose=True,
)

msoedov pushed a commit that referenced this issue Jul 12, 2023
Fixed issue causing two chains in one file to fail
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

2 participants