Open mckbrchill opened 6 months ago
03fcb0c86f
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
Here are the GitHub Actions logs prior to making any changes:
47b6dad
Checking Cargo.toml for syntax errors... β Cargo.toml has no syntax errors!
1/1 βChecking Cargo.toml for syntax errors... β Cargo.toml has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
Cargo.toml
β https://github.com/getmetal/motorhead/commit/9028d9d5e567e9f221a7825c10c0f9a0c321e033 Edit
Modify Cargo.toml with contents:
β’ Update the `openai-async` dependency version to `0.12.2` to incorporate the bug fix and new features. This will be done by locating the `openai-async` line in the `Cargo.toml` file and changing the version specified to `0.12.2`. This change is necessary to resolve the bug with the `OPENAI_API_BASE` environment variable and to make use of the updated function calling capability in the newer version.
--- +++ @@ -9,7 +9,7 @@ [dependencies] actix-web = "4.3" -async-openai = "0.11.0" +async-openai = "0.12.2" async-trait = "0.1.68" byteorder = "1.4.3" chrono = "0.4.24"
Cargo.toml
β Edit
Check Cargo.toml with contents:
Ran GitHub Actions for 9028d9d5e567e9f221a7825c10c0f9a0c321e033:
src/models.rs
β https://github.com/getmetal/motorhead/commit/1f6d9e4592be05d75d05891cf12c632ba2301c9b Edit
Modify src/models.rs with contents:
β’ Refactor the instantiation of `OpenAIConfig` objects and their usage with the `Client` to be compatible with changes introduced in `openai-async` version 0.12.2. This includes adjusting how the `OPENAI_API_BASE` is applied to the `OpenAIConfig` and ensuring that the completion object type is correctly handled according to the new version's requirements. Specific changes may involve updating method names, parameters, or how configurations are applied, based on the differences between `openai-async` versions 0.11.0 and 0.12.2.
β’ Ensure that any new functionality or changes in how the `Client` is configured or used are correctly implemented to maintain or enhance the existing functionality.
--- +++ @@ -59,12 +59,12 @@ let openai_api_base = env::var("OPENAI_API_BASE"); if let Ok(openai_api_base) = openai_api_base { - let embedding_config = OpenAIConfig::default().with_api_base(&openai_api_base); - let completion_config = OpenAIConfig::default().with_api_base(&openai_api_base); + let embedding_config = OpenAIConfig::new().api_base(&openai_api_base); + let completion_config = OpenAIConfig::new().api_base(&openai_api_base); AnyOpenAIClient::OpenAI { - embedding_client: Client::with_config(embedding_config), - completion_client: Client::with_config(completion_config), + embedding_client: Client::new(&embedding_config), + completion_client: Client::new(&completion_config), } } else { AnyOpenAIClient::OpenAI {
src/models.rs
β Edit
Check src/models.rs with contents:
Ran GitHub Actions for 1f6d9e4592be05d75d05891cf12c632ba2301c9b:
README.md
β https://github.com/getmetal/motorhead/commit/bdb6ae98a88ea1d0cee9ddd9d01d15c1b86eb29f Edit
Modify README.md with contents:
β’ Add documentation for the `OPENAI_API_BASE` environment variable. This should include a brief description of what the variable is used for, how to set it, and a default value if applicable. This update ensures that users are aware of how to configure the `OPENAI_API_BASE` to point to the correct OpenAI API base URL, which is crucial for the correct operation of the application in environments where the default API base URL may need to be overridden.
--- +++ @@ -98,7 +98,7 @@ - `PORT` (default:8000) - Motorhead Server Port - `OPENAI_API_KEY`- [Your api key](https://platform.openai.com/account/api-keys) to connect to OpenAI. - `REDIS_URL` (required)- URL used to connect to `redis`. -- `OPENAI_API_BASE` (default:https://api.openai.com/v1) - OpenAI API Base URL +- `OPENAI_API_BASE` (default:https://api.openai.com/v1) - This environment variable specifies the base URL for the OpenAI API. It's used by the Motorhead server to make API calls to OpenAI for its operations. In most cases, the default value should suffice. However, if you're working with a different OpenAI API endpoint or in an environment where the standard OpenAI endpoints are overridden, you'll need to set this variable accordingly. To set it, use `OPENAI_API_BASE='your_custom_api_base_url'` in your environment configuration. ### Azure deployment
README.md
β Edit
Check README.md with contents:
Ran GitHub Actions for bdb6ae98a88ea1d0cee9ddd9d01d15c1b86eb29f:
I have finished reviewing the code for completeness. I did not find errors for sweep/openai_api_base_is_not_working
.
π‘ To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Details
Bugs: OPENAI_API_BASE env variable is not working, because of the bug in openai-async 0.11.0, and it was fixed in 0.12.2. Features: Refactors: Refactor code accordingly to latest version of openai-async (or at least 0.12.2). The diff between theese two versions also incorporate function calling capabitily, so it affects completion object type.
Checklist
- [X] Modify `Cargo.toml` β https://github.com/getmetal/motorhead/commit/9028d9d5e567e9f221a7825c10c0f9a0c321e033 [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/Cargo.toml#L1-L10) - [X] Running GitHub Actions for `Cargo.toml` β [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/Cargo.toml#L1-L10) - [X] Modify `src/models.rs` β https://github.com/getmetal/motorhead/commit/1f6d9e4592be05d75d05891cf12c632ba2301c9b [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/src/models.rs#L57-L75) - [X] Running GitHub Actions for `src/models.rs` β [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/src/models.rs#L57-L75) - [X] Modify `README.md` β https://github.com/getmetal/motorhead/commit/bdb6ae98a88ea1d0cee9ddd9d01d15c1b86eb29f [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/README.md#L98-L100) - [X] Running GitHub Actions for `README.md` β [Edit](https://github.com/getmetal/motorhead/edit/sweep/openai_api_base_is_not_working/README.md#L98-L100)