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

Dynamic route function calling - 'HuggingFacePipeline' object has no attribute 'extract_function_inputs' #208

Open
mrhimanshu opened this issue Mar 17, 2024 · 2 comments

Comments

@mrhimanshu
Copy link

mrhimanshu commented Mar 17, 2024

I encounter an issue with calling function using Mistral 7b model through Huggingface pipeline

AttributeError                            Traceback (most recent call last)
Cell In [57], [line 1](vscode-notebook-cell:?execution_count=57&line=1)
----> [1](vscode-notebook-cell:?execution_count=57&line=1) out = rl("what is the time in new york city?")
      [2](vscode-notebook-cell:?execution_count=57&line=2) # get_time(**out.function_call)

File /usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:262, in RouteLayer.__call__(self, text, vector, simulate_static)
    [260](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:260)         else:
    [261](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:261)             route.llm = self.llm
--> [262](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:262)     return route(text)
    [263](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:263) elif passed and route is not None and simulate_static:
    [264](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:264)     return RouteChoice(
    [265](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:265)         name=route.name,
    [266](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:266)         function_call=None,
    [267](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:267)         similarity_score=None,
    [268](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/layer.py:268)     )

File /usr/local/lib/python3.9/dist-packages/semantic_router/route.py:70, in Route.__call__(self, query)
     [65](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:65)         raise ValueError(
     [66](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:66)             "Query is required for dynamic routes. Please ensure the `query` "
     [67](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:67)             "argument is passed."
     [68](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:68)         )
     [69](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:69)     # if a function schema is provided we generate the inputs
---> [70](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:70)     extracted_inputs = self.llm.extract_function_inputs(
     [71](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:71)         query=query, function_schema=self.function_schema
     [72](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:72)     )
     [73](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:73)     func_call = extracted_inputs
     [74](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:74) else:
     [75](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.9/dist-packages/semantic_router/route.py:75)     # otherwise we just pass None for the call

AttributeError: 'HuggingFacePipeline' object has no attribute 'extract_function_inputs'
@mrhimanshu mrhimanshu changed the title Dynamic route function calling using Huggingface Dynamic route function calling using Huggingface - 'HuggingFacePipeline' object has no attribute 'extract_function_inputs' Mar 17, 2024
@mrhimanshu mrhimanshu changed the title Dynamic route function calling using Huggingface - 'HuggingFacePipeline' object has no attribute 'extract_function_inputs' Dynamic route function calling - 'HuggingFacePipeline' object has no attribute 'extract_function_inputs' Mar 17, 2024
@ashraq1455
Copy link
Contributor

@mrhimanshu, could you please share the code to reproduce this issue? Thanks.

@mrhimanshu
Copy link
Author

@ashraq1455 can we use GPTQ based model ?

Above error occurred when I initialized the gptq model and passed it in wrapper class.

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