Skip to content

Commit

Permalink
build(deps): update async-openai requirement from 0.14.2 to 0.16.2
Browse files Browse the repository at this point in the history
Updates the requirements on [async-openai](https://github.com/64bit/async-openai) to permit the latest version.
- [Release notes](https://github.com/64bit/async-openai/releases)
- [Commits](64bit/async-openai@async-openai-v0.14.2...async-openai-v0.16.2)

---
updated-dependencies:
- dependency-name: async-openai
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
dependabot[bot] authored and retrage committed Nov 13, 2023
1 parent 8667c41 commit 6764fe7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ trybuild = { version = "1.0", features = ["diff"] }
syn = { version = "2.0", features = ["full", "extra-traits", "parsing"] }
proc-macro2 = { version = "1.0", features = ["nightly"] }
quote = "1.0"
async-openai = "0.14.2"
async-openai = "0.16.2"
tokio = { version = "1.0", features = ["rt-multi-thread"] }
20 changes: 10 additions & 10 deletions src/internal/auto_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Akira Moroo <[email protected]> 2023

use async_openai::{
types::{ChatCompletionRequestMessageArgs, CreateChatCompletionRequestArgs, Role},
types::{
ChatCompletionRequestSystemMessageArgs, ChatCompletionRequestUserMessageArgs,
CreateChatCompletionRequestArgs,
},
Client,
};
use proc_macro::TokenStream;
Expand Down Expand Up @@ -39,24 +42,21 @@ impl AutoImpl {
let request = CreateChatCompletionRequestArgs::default()
.model("gpt-3.5-turbo")
.messages([
ChatCompletionRequestMessageArgs::default()
.role(Role::System)
ChatCompletionRequestSystemMessageArgs::default()
.content("You are a Rust expert who can implement the given function.")
.build()?,
ChatCompletionRequestMessageArgs::default()
.role(Role::User)
.build()?.into(),
ChatCompletionRequestUserMessageArgs::default()
.content(format!(
"Read this incomplete Rust code:\n```rust\n{}\n```",
self.token_stream
))
.build()?,
ChatCompletionRequestMessageArgs::default()
.role(Role::User)
.build()?.into(),
ChatCompletionRequestUserMessageArgs::default()
.content(format!(
"Complete the Rust code that follows this instruction: '{}'. Your response must start with code block '```rust'.",
self.doc
))
.build()?,
.build()?.into(),
])
.build()?;

Expand Down
28 changes: 14 additions & 14 deletions src/internal/auto_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Akira Moroo <[email protected]> 2023

use async_openai::{
types::{ChatCompletionRequestMessageArgs, CreateChatCompletionRequestArgs, Role},
types::{
ChatCompletionRequestSystemMessageArgs, ChatCompletionRequestUserMessageArgs,
CreateChatCompletionRequestArgs,
},
Client,
};
use proc_macro::TokenStream;
Expand Down Expand Up @@ -46,43 +49,40 @@ impl AutoTest {
async fn completion(&mut self, args: Args) -> Result<TokenStream, Box<dyn std::error::Error>> {
let mut output = self.token_stream.clone();

let mut messages = vec![
ChatCompletionRequestMessageArgs::default()
.role(Role::System)
let mut messages =
vec![
ChatCompletionRequestSystemMessageArgs::default()
.content(
"You are a Rust expert who can generate perfect tests for the given function.",
)
.build()?,
ChatCompletionRequestMessageArgs::default()
.role(Role::User)
.build()?.into(),
ChatCompletionRequestUserMessageArgs::default()
.content(format!(
"Read this Rust function:\n```rust\n{}\n```",
self.token_stream
))
.build()?,
.build()?.into(),
];

if args.test_names.is_empty() {
messages.push(
ChatCompletionRequestMessageArgs::default()
.role(Role::User)
ChatCompletionRequestUserMessageArgs::default()
.content(
"Write a test case for the function as much as possible in Markdown code snippet style. Your response must start with code block '```rust'.",
)
.build()?,
.build()?.into(),
);
} else {
for test_name in args.test_names {
messages.push(
ChatCompletionRequestMessageArgs::default()
.role(Role::User)
ChatCompletionRequestUserMessageArgs::default()
.content(
format!(
"Write a test case `{}` for the function in Markdown code snippet style. Your response must start with code block '```rust'.",
test_name
)
)
.build()?,
.build()?.into(),
);
}
}
Expand Down

0 comments on commit 6764fe7

Please sign in to comment.