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

cast(TokenCredential, self._credential).get_token(*scopes, **kwargs) | AttributeError: 'str' object has no attribute 'get_token' #271

Open
avatar-lavventura opened this issue Sep 30, 2024 · 0 comments

Comments

@avatar-lavventura
Copy link

avatar-lavventura commented Sep 30, 2024

pip packages:

azure-identity==1.18.0
azure-search-documents==11.6.0b5
azure-storage-blob==12.23.1

I am getting following error for the following line under azure-search-integrated-vectorization.py file:

index = SearchIndex(name=index_name, fields=fields, vector_search=vector_search, semantic_search=semantic_search)

How could I fix it?

PS C:\Users\BIM3417\GitHub\bim-chatbot\bot> python.exe .\azure-search-integrated-vectorization.py
vectorizer is not a known attribute of class <class 'azure.search.documents.indexes._generated.models._models_py3.VectorSearchProfile'> and will be ignored
resource_uri is not a known attribute of class <class 'azure.search.documents.indexes._generated.models._models_py3.AzureOpenAIVectorizerParameters'> and will be ignored
deployment_id is not a known attribute of class <class 'azure.search.documents.indexes._generated.models._models_py3.AzureOpenAIVectorizerParameters'> and will be ignored
Traceback (most recent call last):
  File "C:\Users\BIM3417\GitHub\bim-chatbot\bot\azure-search-integrated-vectorization.py", line 177, in <module>
    result = index_client.create_or_update_index(index)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\tracing\decorator.py", line 94, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\search\documents\indexes\_search_index_client.py", line 276, in create_or_update_index
    result = self._client.indexes.create_or_update(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\tracing\decorator.py", line 94, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\search\documents\indexes\_generated\operations\_indexes_operations.py", line 692, in create_or_update
    pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\_base.py", line 229, in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\_base.py", line 86, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\_base.py", line 86, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\_base.py", line 86, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 2 more times]
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\policies\_redirect.py", line 197, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\policies\_retry.py", line 532, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\policies\_authentication.py", line 145, in send
    self.on_request(request)
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\policies\_authentication.py", line 120, in on_request
    self._request_token(*self._scopes)
  File "C:\Users\BIM3417\AppData\Local\Programs\Python\Python312\Lib\site-packages\azure\core\pipeline\policies\_authentication.py", line 96, in _request_token
    self._token = cast(TokenCredential, self._credential).get_token(*scopes, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_token'
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

1 participant