Skip to content

prepdocs.py : getting error while running the file. #795

@namratam30

Description

@namratam30

Please provide us with the following information:

I am getting below error after updating the open ai in the solution -
Traceback (most recent call last):
2023-10-13T13:55:21.3332834Z File "/home/vsts/work/1/s/scripts/.venv/lib/python3.9/site-packages/tenacity/init.py", line 382, in call
2023-10-13T13:55:21.3333904Z result = fn(*args, **kwargs)
2023-10-13T13:55:21.3334574Z File "/home/vsts/work/1/s/./scripts/prepdocs.py", line 234, in compute_embedding
2023-10-13T13:55:21.3335315Z refresh_openai_token()
2023-10-13T13:55:21.3335943Z File "/home/vsts/work/1/s/./scripts/prepdocs.py", line 312, in refresh_openai_token
2023-10-13T13:55:21.3337486Z if open_ai_token_cache[CACHE_KEY_TOKEN_TYPE] == 'azure' and open_ai_token_cache[CACHE_KEY_CREATED_TIME] + 300 < time.time():
2023-10-13T13:55:21.3338556Z KeyError: 'token_type'
2023-10-13T13:55:21.3338714Z
2023-10-13T13:55:21.3339098Z The above exception was the direct cause of the following exception:
2023-10-13T13:55:21.3339605Z
2023-10-13T13:55:21.3339794Z Traceback (most recent call last):
2023-10-13T13:55:21.3340399Z File "/home/vsts/work/1/s/./scripts/prepdocs.py", line 395, in
2023-10-13T13:55:21.3341154Z index_sections(os.path.basename(filename), sections)
2023-10-13T13:55:21.3341935Z File "/home/vsts/work/1/s/./scripts/prepdocs.py", line 281, in index_sections
2023-10-13T13:55:21.3342639Z for s in sections:
2023-10-13T13:55:21.3343211Z File "/home/vsts/work/1/s/./scripts/prepdocs.py", line 226, in create_sections
2023-10-13T13:55:21.3343998Z section["embedding"] = compute_embedding(content)
2023-10-13T13:55:21.3345299Z File "/home/vsts/work/1/s/scripts/.venv/lib/python3.9/site-packages/tenacity/init.py", line 289, in wrapped_f
2023-10-13T13:55:21.3346383Z return self(f, *args, **kw)
2023-10-13T13:55:21.3347516Z File "/home/vsts/work/1/s/scripts/.venv/lib/python3.9/site-packages/tenacity/init.py", line 379, in call
2023-10-13T13:55:21.3348620Z do = self.iter(retry_state=retry_state)
2023-10-13T13:55:21.3349802Z File "/home/vsts/work/1/s/scripts/.venv/lib/python3.9/site-packages/tenacity/init.py", line 326, in iter
2023-10-13T13:55:21.3350837Z raise retry_exc from fut.exception()
2023-10-13T13:55:21.3351614Z tenacity.RetryError: RetryError[<Future at 0x7fd0b3c4ce50 state=finished raised KeyError>]
2023-10-13T13:55:21.4608265Z ##[error]Bash exited with code '1'.
2023-10-13T13:55:21.4622691Z ##[section]Finishing: Process Documents


This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

azd version?

run azd version and copy paste here.

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions