On running the example notebooks given in the repository, running into following issue:
To Reproduce
Simply run agent.plan() in any of the example notebooks
Expected behavior
Expected the code to display the cost of running the task
Hi @hafeezali
Instead of using the given config use auto label CLI to generate config
https://docs.refuel.ai/autolabel/guide/resources/CLI/
Hope this helps.
But why can't we use with the way it is demonstrated in the notebook ? Is it a mandate to use CLI version.
Dec 18
'23 16:12
RW04
I still run into the same error. Why would using the CLI make any difference? I have the same config file getting generated anyway.
The issue seems to be with openai version incompatibility. Can you check that error please?
This is the exact stack trace:
Original exception was:
Traceback (most recent call last):
File "/opt/homebrew/bin/autolabel", line 8, in
sys.exit(app())
^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/typer/main.py", line 328, in call
raise e
File "/opt/homebrew/lib/python3.11/site-packages/typer/main.py", line 311, in call
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/typer/core.py", line 778, in main
return _main(
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/typer/core.py", line 216, in _main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/typer/main.py", line 683, in wrapper
return callback(**use_params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/cli/main.py", line 313, in plan
agent.plan(dataset, max_items=max_items, start_index=start_index)
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/labeler.py", line 325, in plan
self.example_selector = ExampleSelectorFactory.initialize_selector(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/few_shot/init.py", line 115, in initialize_selector
return example_cls.from_examples(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/prompts/example_selector/semantic_similarity.py", line 96, in from_examples
vectorstore = vectorstore_cls.from_texts(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/few_shot/vector_store.py", line 453, in from_texts
vector_store.add_texts(texts=texts, metadatas=metadatas)
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/few_shot/vector_store.py", line 244, in add_texts
embeddings = self._get_embeddings(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/autolabel/few_shot/vector_store.py", line 195, in _get_embeddings
uncached_embeddings = self._embedding_function.embed_documents(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/embeddings/openai.py", line 430, in embed_documents
return self._get_len_safe_embeddings(texts, engine=self.deployment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/embeddings/openai.py", line 286, in _get_len_safe_embeddings
response = embed_with_retry(
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/embeddings/openai.py", line 91, in embed_with_retry
retry_decorator = _create_retry_decorator(embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/embeddings/openai.py", line 47, in _create_retry_decorator
retry_if_exception_type(openai.error.Timeout)
^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'error'
Seems to be coming from langchain. Can you check please?
Openai version is not compatible with refuel ai. Use the the following version and use cli to generate the config @hafeezali
pip install openai==0.28
pip install 'refuel-autolabel[openai]'
pip install openai==0.28
pip install 'refuel-autolabel[openai]'
this fixed the above problem