Unverified Commit 82eae1fd authored by Paul Hendricks's avatar Paul Hendricks Committed by GitHub
Browse files

refactor: Upgrade async-openai (#1693)

parent 0b47f897
......@@ -199,10 +199,11 @@ checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-openai"
version = "0.27.2"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d126927c78e1562d7e8473008ac8b082318c04d69e3a83e3495a563f8b84a66"
checksum = "31acf814d6b499e33ec894bb0fd7ddaf2665b44fbdd42b858d736449271fde0c"
dependencies = [
"async-openai-macros",
"backoff",
"base64 0.22.1",
"bytes",
......@@ -222,6 +223,17 @@ dependencies = [
"tracing",
]
[[package]]
name = "async-openai-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.100",
]
[[package]]
name = "async-stream"
version = "0.3.6"
......
......@@ -46,6 +46,7 @@ dynamo-tokens = { path = "lib/tokens", version = "0.3.1" }
# External dependencies
anyhow = { version = "1" }
async-nats = { version = "0.40", features = ["service"] }
async-openai = { version = "0.29.0" }
async-stream = { version = "0.3" }
async-trait = { version = "0.1" }
async_zmq = { version = "0.4.0" }
......
......@@ -45,7 +45,7 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
uuid = { workspace = true }
async-openai = { version = "0.27.2" }
async-openai = { workspace = true }
clap = { version = "4.5", features = ["derive", "env"] }
dialoguer = { version = "0.11", default-features = false, features = ["editor", "history"] }
futures-util = { version = "0.3" }
......
......@@ -180,10 +180,11 @@ checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-openai"
version = "0.27.2"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d126927c78e1562d7e8473008ac8b082318c04d69e3a83e3495a563f8b84a66"
checksum = "31acf814d6b499e33ec894bb0fd7ddaf2665b44fbdd42b858d736449271fde0c"
dependencies = [
"async-openai-macros",
"backoff",
"base64 0.22.1",
"bytes",
......@@ -203,6 +204,17 @@ dependencies = [
"tracing",
]
[[package]]
name = "async-openai-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.100",
]
[[package]]
name = "async-stream"
version = "0.3.6"
......
......@@ -44,7 +44,7 @@ dynamo-runtime = { path = "../../runtime" }
anyhow = { version = "1" }
async-stream = { version = "0.3" }
async-trait = { version = "0.1" }
async-openai = "0.27.2"
async-openai = { version = "0.29.0" }
futures = { version = "0.3" }
once_cell = { version = "1.20.3" }
serde = { version = "1" }
......
......@@ -34,7 +34,7 @@ dynamo-runtime = { workspace = true }
dynamo-llm = { workspace = true }
anyhow = { workspace = true }
async-openai = "0.27.2"
async-openai = { workspace = true }
async-stream = { workspace = true }
async-trait = { workspace = true }
candle-core = { version = "0.8.0" }
......
......@@ -71,7 +71,7 @@ uuid = { workspace = true }
xxhash-rust = { workspace = true }
akin = "0.4.0"
async-openai = "0.27.2"
async-openai = { workspace = true }
blake3 = "1"
bytemuck = "1.22"
candle-core = { version = "0.8.0" }
......
......@@ -98,15 +98,12 @@ impl OAIChatLikeRequest for NvCreateCompletionRequest {
fn extract_tokens(&self) -> Option<TokenInput> {
match &self.inner.prompt {
async_openai::types::Prompt::IntegerArray(tokens) => Some(TokenInput::Single(
tokens.iter().map(|&t| t as u32).collect(),
)),
async_openai::types::Prompt::ArrayOfIntegerArray(arrays) => Some(TokenInput::Batch(
arrays
.iter()
.map(|arr| arr.iter().map(|&t| t as u32).collect())
.collect(),
)),
async_openai::types::Prompt::IntegerArray(tokens) => {
Some(TokenInput::Single(tokens.clone()))
}
async_openai::types::Prompt::ArrayOfIntegerArray(arrays) => {
Some(TokenInput::Batch(arrays.clone()))
}
_ => None,
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment