You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run the Index agent (either via the Python API or the index run CLI) on Windows, multiple errors occur within the lmnr-index library, preventing it from running.
Environment:
Windows 11
Python version: 3.11.4
Pydantic version: 2.10.6
Steps to Reproduce:
Install lmnr-index: pip install lmnr-index
Install Playwright dependencies: playwright install chromium
Create a .env file with a valid OPENAI_API_KEY.
Attempt to run the agent (e.g., index run).
Expected Behavior:
The Index agent should initialize and run without crashing.
Actual Behavior:
Two distinct errors occur sequentially: Error 1: SyntaxError in message_manager.py
The first error encountered is:
Traceback (most recent call last):
# ... traceback ...
File "C:\\Users\\marcu\\miniconda3\\Lib\\site-packages\\index\\agent\\message_manager.py", line 101
highlighted_elements += f"{start_tag}{element.text.replace(\'\\n\', \' \')}</{element.tag_name}>\\n"
^
SyntaxError: f-string expression part cannot include a backslash
Cause: Line 101 in index/agent/message_manager.py uses element.text.replace('\n', ' ') directly within an f-string expression, which is not allowed due to the backslash.
Workaround: Manually changing line 101 to perform the .replace() before the f-string resolves this specific error:
# Fix: Perform replace before the f-string
element_text_no_newlines = element.text.replace('\n', ' ')
highlighted_elements += f"{start_tag}{element_text_no_newlines}</{element.tag_name}>\n"
Error 2: PydanticUserError regarding TypedDict
After applying the workaround for Error 1, a second error occurs during Pydantic model processing:
Traceback (most recent call last):
# ... traceback involving pydantic model construction ...
File "C:\\Users\\marcu\\miniconda3\\Lib\\site-packages\\index\\agent\\models.py", line 38, in <module> # Or similar Pydantic model definition
class AgentOutput(BaseModel):
# ... more pydantic traceback ...
File "C:\\Users\\marcu\\miniconda3\\Lib\\site-packages\\pydantic\\_internal\\_generate_schema.py", line 1406, in _typed_dict_schema
raise PydanticUserError(
pydantic.errors.PydanticUserError: Please use `typing_extensions.TypedDict` instead of `typing.TypedDict` on Python < 3.12.
For further information visit https://errors.pydantic.dev/2.10/u/typed-dict-version
Cause: The library (likely in index/agent/models.py or other model files) appears to be using typing.TypedDict which causes compatibility issues with Pydantic on Python versions older than 3.12. Pydantic expects typing_extensions.TypedDict in these cases.
Suggested Fix: Imports of TypedDict from typing should be changed to use typing_extensions.TypedDict instead. The typing-extensions package may need to be added as a dependency if it isn't already.
The text was updated successfully, but these errors were encountered:
@MarcusNeufeldt thanks for the issue! I will incorporate the line fix change and will check the TypedDict issue. Keep an eye on a new release. It also would be really helpful if you could install from the working branch to help me test it out, because I don't have the windows machine available.
When attempting to run the Index agent (either via the Python API or the index run CLI) on Windows, multiple errors occur within the lmnr-index library, preventing it from running.
Environment:
Windows 11
Python version: 3.11.4
Pydantic version: 2.10.6
Steps to Reproduce:
Install lmnr-index: pip install lmnr-index
Install Playwright dependencies: playwright install chromium
Create a .env file with a valid OPENAI_API_KEY.
Attempt to run the agent (e.g., index run).
Expected Behavior:
The Index agent should initialize and run without crashing.
Actual Behavior:
Two distinct errors occur sequentially:
Error 1: SyntaxError in message_manager.py
The first error encountered is:
Cause: Line 101 in index/agent/message_manager.py uses element.text.replace('\n', ' ') directly within an f-string expression, which is not allowed due to the backslash.
Workaround: Manually changing line 101 to perform the .replace() before the f-string resolves this specific error:
Error 2: PydanticUserError regarding TypedDict
After applying the workaround for Error 1, a second error occurs during Pydantic model processing:
Cause: The library (likely in index/agent/models.py or other model files) appears to be using typing.TypedDict which causes compatibility issues with Pydantic on Python versions older than 3.12. Pydantic expects typing_extensions.TypedDict in these cases.
Suggested Fix: Imports of TypedDict from typing should be changed to use typing_extensions.TypedDict instead. The typing-extensions package may need to be added as a dependency if it isn't already.
The text was updated successfully, but these errors were encountered: