Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
49958435
Unverified
Commit
49958435
authored
Aug 20, 2025
by
Graham King
Committed by
GitHub
Aug 20, 2025
Browse files
chore: Remove async-openai-macros (#2554)
parent
539c18cd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
182 deletions
+7
-182
Cargo.lock
Cargo.lock
+3
-1
Cargo.toml
Cargo.toml
+0
-1
lib/async-openai-macros/Cargo.toml
lib/async-openai-macros/Cargo.toml
+0
-27
lib/async-openai-macros/src/lib.rs
lib/async-openai-macros/src/lib.rs
+0
-151
lib/async-openai/Cargo.toml
lib/async-openai/Cargo.toml
+1
-1
lib/bindings/python/Cargo.lock
lib/bindings/python/Cargo.lock
+3
-1
No files found.
Cargo.lock
View file @
49958435
...
...
@@ -240,7 +240,9 @@ checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-openai-macros"
version = "0.4.1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
dependencies = [
"proc-macro2",
"quote",
...
...
Cargo.toml
View file @
49958435
...
...
@@ -10,7 +10,6 @@ members = [
"lib/runtime"
,
"lib/tokens"
,
"lib/async-openai"
,
"lib/async-openai-macros"
,
"lib/parsers"
,
"lib/bindings/c"
,
"lib/engines/*"
,
...
...
lib/async-openai-macros/Cargo.toml
deleted
100644 → 0
View file @
539c18cd
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Based on https://github.com/64bit/async-openai/ by Himanshu Neema
# Original Copyright (c) 2022 Himanshu Neema
# Licensed under MIT License (see ATTRIBUTIONS-Rust.md)
#
# Modifications Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# Licensed under Apache 2.0
[package]
name
=
"async-openai-macros"
version.workspace
=
true
edition.workspace
=
true
authors.workspace
=
true
license.workspace
=
true
homepage.workspace
=
true
repository.workspace
=
true
readme.workspace
=
true
[lib]
proc-macro
=
true
[dependencies]
syn
=
{
version
=
"2.0"
,
features
=
["full"]
}
quote
=
"1.0"
proc-macro2
=
"1.0"
lib/async-openai-macros/src/lib.rs
deleted
100644 → 0
View file @
539c18cd
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Based on https://github.com/64bit/async-openai/ by Himanshu Neema
// Original Copyright (c) 2022 Himanshu Neema
// Licensed under MIT License (see ATTRIBUTIONS-Rust.md)
//
// Modifications Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
// Licensed under Apache 2.0
use
proc_macro
::
TokenStream
;
use
quote
::{
quote
,
ToTokens
};
use
syn
::{
parse
::{
Parse
,
ParseStream
},
parse_macro_input
,
punctuated
::
Punctuated
,
token
::
Comma
,
FnArg
,
GenericParam
,
Generics
,
ItemFn
,
Pat
,
PatType
,
TypeParam
,
WhereClause
,
};
// Parse attribute arguments like #[byot(T0: Display + Debug, T1: Clone, R: Serialize)]
struct
BoundArgs
{
bounds
:
Vec
<
(
String
,
syn
::
TypeParamBound
)
>
,
where_clause
:
Option
<
String
>
,
stream
:
bool
,
// Add stream flag
}
impl
Parse
for
BoundArgs
{
fn
parse
(
input
:
ParseStream
)
->
syn
::
Result
<
Self
>
{
let
mut
bounds
=
Vec
::
new
();
let
mut
where_clause
=
None
;
let
mut
stream
=
false
;
// Default to false
let
vars
=
Punctuated
::
<
syn
::
MetaNameValue
,
Comma
>
::
parse_terminated
(
input
)
?
;
for
var
in
vars
{
let
name
=
var
.path
.get_ident
()
.unwrap
()
.to_string
();
match
name
.as_str
()
{
"where_clause"
=>
{
where_clause
=
Some
(
var
.value
.into_token_stream
()
.to_string
());
}
"stream"
=>
{
stream
=
var
.value
.into_token_stream
()
.to_string
()
.contains
(
"true"
);
}
_
=>
{
let
bound
:
syn
::
TypeParamBound
=
syn
::
parse_str
(
&
var
.value
.into_token_stream
()
.to_string
())
?
;
bounds
.push
((
name
,
bound
));
}
}
}
Ok
(
BoundArgs
{
bounds
,
where_clause
,
stream
,
})
}
}
#[proc_macro_attribute]
pub
fn
byot_passthrough
(
_
args
:
TokenStream
,
item
:
TokenStream
)
->
TokenStream
{
item
}
#[proc_macro_attribute]
pub
fn
byot
(
args
:
TokenStream
,
item
:
TokenStream
)
->
TokenStream
{
let
bounds_args
=
parse_macro_input!
(
args
as
BoundArgs
);
let
input
=
parse_macro_input!
(
item
as
ItemFn
);
let
mut
new_generics
=
Generics
::
default
();
let
mut
param_count
=
0
;
// Process function arguments
let
mut
new_params
=
Vec
::
new
();
let
args
=
input
.sig
.inputs
.iter
()
.map
(|
arg
|
{
match
arg
{
FnArg
::
Receiver
(
receiver
)
=>
receiver
.to_token_stream
(),
FnArg
::
Typed
(
PatType
{
pat
,
..
})
=>
{
if
let
Pat
::
Ident
(
pat_ident
)
=
&**
pat
{
let
generic_name
=
format!
(
"T{}"
,
param_count
);
let
generic_ident
=
syn
::
Ident
::
new
(
&
generic_name
,
proc_macro2
::
Span
::
call_site
());
// Create type parameter with optional bounds
let
mut
type_param
=
TypeParam
::
from
(
generic_ident
.clone
());
if
let
Some
((
_
,
bound
))
=
bounds_args
.bounds
.iter
()
.find
(|(
name
,
_
)|
name
==
&
generic_name
)
{
type_param
.bounds
.extend
(
vec!
[
bound
.clone
()]);
}
new_params
.push
(
GenericParam
::
Type
(
type_param
));
param_count
+=
1
;
quote!
{
#
pat_ident
:
#
generic_ident
}
}
else
{
arg
.to_token_stream
()
}
}
}
})
.collect
::
<
Vec
<
_
>>
();
// Add R type parameter with optional bounds
let
generic_r
=
syn
::
Ident
::
new
(
"R"
,
proc_macro2
::
Span
::
call_site
());
let
mut
return_type_param
=
TypeParam
::
from
(
generic_r
.clone
());
if
let
Some
((
_
,
bound
))
=
bounds_args
.bounds
.iter
()
.find
(|(
name
,
_
)|
name
==
"R"
)
{
return_type_param
.bounds
.extend
(
vec!
[
bound
.clone
()]);
}
new_params
.push
(
GenericParam
::
Type
(
return_type_param
));
// Add all generic parameters
new_generics
.params
.extend
(
new_params
);
let
fn_name
=
&
input
.sig.ident
;
let
byot_fn_name
=
syn
::
Ident
::
new
(
&
format!
(
"{}_byot"
,
fn_name
),
fn_name
.span
());
let
vis
=
&
input
.vis
;
let
block
=
&
input
.block
;
let
attrs
=
&
input
.attrs
;
let
asyncness
=
&
input
.sig.asyncness
;
// Parse where clause if provided
let
where_clause
=
if
let
Some
(
where_str
)
=
bounds_args
.where_clause
{
match
syn
::
parse_str
::
<
WhereClause
>
(
&
format!
(
"where {}"
,
where_str
.replace
(
"
\"
"
,
""
)))
{
Ok
(
where_clause
)
=>
quote!
{
#
where_clause
},
Err
(
e
)
=>
return
TokenStream
::
from
(
e
.to_compile_error
()),
}
}
else
{
quote!
{}
};
// Generate return type based on stream flag
let
return_type
=
if
bounds_args
.stream
{
quote!
{
Result
<
::
std
::
pin
::
Pin
<
Box
<
dyn
::
futures
::
Stream
<
Item
=
Result
<
R
,
OpenAIError
>>
+
Send
>>
,
OpenAIError
>
}
}
else
{
quote!
{
Result
<
R
,
OpenAIError
>
}
};
let
expanded
=
quote!
{
#
(
#
attrs
)
*
#
input
#
(
#
attrs
)
*
#
vis
#
asyncness
fn
#
byot_fn_name
#
new_generics
(
#
(
#
args
),
*
)
->
#
return_type
#
where_clause
#
block
};
expanded
.into
()
}
lib/async-openai/Cargo.toml
View file @
49958435
...
...
@@ -33,7 +33,7 @@ realtime = ["dep:tokio-tungstenite"]
byot
=
[]
[dependencies]
async-openai-macros
=
{
path
=
"../async-openai-macros"
}
async-openai-macros
=
"0.1.0"
backoff
=
{
version
=
"0.4.0"
,
features
=
["tokio"]
}
base64
=
"0.22.1"
futures
=
"0.3.31"
...
...
lib/bindings/python/Cargo.lock
View file @
49958435
...
...
@@ -200,7 +200,9 @@ checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-openai-macros"
version = "0.4.1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
dependencies = [
"proc-macro2",
"quote",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment