This repository was archived by the owner on Jan 28, 2026. It is now read-only.
Fix AttributeError in chat method of OpenAIAgentService#1653
Draft
ticklecatisback wants to merge 3 commits intoreworkd:mainfrom
Draft
Fix AttributeError in chat method of OpenAIAgentService#1653ticklecatisback wants to merge 3 commits intoreworkd:mainfrom
ticklecatisback wants to merge 3 commits intoreworkd:mainfrom
Conversation
Fix the `AttributeError: 'SystemMessage' object has no attribute 'role'` in the `chat` method of the `OpenAIAgentService` class. * **Update `chat` method in `platform/reworkd_platform/web/api/agent/agent_service/open_ai_agent_service.py`** - Modify the list comprehension to include a conditional check for the `role` attribute. - Handle `SystemMessagePromptTemplate` objects correctly by checking for the presence of the `role` attribute before accessing it. * **Update imports and methods in various files to use `ollama`** - Update imports in `platform/reworkd_platform/web/api/agent/tools/code.py`, `platform/reworkd_platform/web/api/agent/tools/image.py`, `platform/reworkd_platform/web/api/agent/tools/search.py`, `platform/reworkd_platform/web/api/agent/tools/sidsearch.py`, and `platform/reworkd_platform/web/api/agent/tools/utils.py` to use `ollama`. - Modify methods to use `ollama.Client` for chat and streaming responses. * **Add `setup.py` for package installation** - Add `setup.py` to define the package and its dependencies. * **Update `pyproject.toml`** - Change Python version to `^3.10`. - Add `ollama` as a dependency. - Update build system to use `setuptools`. * **Update `README.md`** - Add instructions for installing the package using pip. - Add examples for using the package in code. - Add instructions for using `ollama`. - Add instructions for using Python 3.10.
|
@ticklecatisback is attempting to deploy a commit to the reworkd Team on Vercel. A member of the Team first needs to authorize it. |
* **Settings**: Add `ollama_api_key` and `ollama_api_base` attributes to `Settings` class in `platform/reworkd_platform/settings.py`. * **Model Factory**: Add `ollama_api_key` attribute to `ModelSettings` class and include it in kwargs if present in `platform/reworkd_platform/web/api/agent/model_factory.py`. * **New Service**: Add `OllamaAgentService` class in `platform/reworkd_platform/web/api/agent/agent_service/ollama_agent_service.py` to handle interactions with the Ollama API. * **Environment Schema**: Update `next/src/env/schema.mjs` to include `OLLAMA_API_KEY`. * **Documentation**: Update various README files to reflect recent changes and new features.
* **README.md** - Add a new section with an example of initializing the `OpenAIAgentService`, setting up the environment, and running the main function. * **platform/README.md** - Add a new section with an example of initializing the `OpenAIAgentService`, setting up the environment, and running the main function. * **platform/reworkd_platform/web/api/agent/agent_service/open_ai_agent_service.py** - Add logging statements to various methods for better traceability. * **platform/reworkd_platform/web/api/agent/model_factory.py** - Add logging statements to the `create_model` function. * **platform/reworkd_platform/services/tokenizer/token_service.py** - Add logging statements to various methods for better traceability. * **platform/reworkd_platform/web/api/dependencies.py** - Add logging statements to the `get_current_user` function. * **platform/reworkd_platform/tests/test_token_service.py** - Add a new test case for `calculate_max_tokens` when `max_tokens` is `None`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the
AttributeError: 'SystemMessage' object has no attribute 'role'in thechatmethod of theOpenAIAgentServiceclass.Update
chatmethod inplatform/reworkd_platform/web/api/agent/agent_service/open_ai_agent_service.pyroleattribute.SystemMessagePromptTemplateobjects correctly by checking for the presence of theroleattribute before accessing it.Update imports and methods in various files to use
ollamaplatform/reworkd_platform/web/api/agent/tools/code.py,platform/reworkd_platform/web/api/agent/tools/image.py,platform/reworkd_platform/web/api/agent/tools/search.py,platform/reworkd_platform/web/api/agent/tools/sidsearch.py, andplatform/reworkd_platform/web/api/agent/tools/utils.pyto useollama.ollama.Clientfor chat and streaming responses.Add
setup.pyfor package installationsetup.pyto define the package and its dependencies.Update
pyproject.toml^3.10.ollamaas a dependency.setuptools.Update
README.mdollama.