Skip to content

Commit f620ae4

Browse files
committed
Revert "Make OpenAI optional and gate CLI extract"
This reverts commit 6b4c4f1.
1 parent 6b4c4f1 commit f620ae4

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ variantly = "0.4.0"
4848
case = "1.0.0"
4949

5050
[features]
51-
default = []
51+
default = ["openai"]
5252
python = ["pyo3"]
5353
wasm = ["wasm-bindgen", "serde-wasm-bindgen", "tsify-next"]
5454
openai = ["openai-api-rs"]
@@ -59,6 +59,7 @@ minijinja-embed = "2.0.1"
5959
[[bin]]
6060
name = "md-models"
6161
path = "src/bin/cli.rs"
62+
required-features = ["openai"]
6263

6364
[dev-dependencies]
6465
assert_cmd = "2.0.14"

src/bin/cli.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use mdmodels::{
3030
exporters::{render_jinja_template, Templates},
3131
json::validation::validate_json,
3232
linkml::export::serialize_linkml,
33+
llm::extraction::query_openai,
3334
pipeline::process_pipeline,
3435
};
3536
use serde::{Deserialize, Serialize};
@@ -43,9 +44,6 @@ use std::{
4344
str::FromStr,
4445
};
4546

46-
#[cfg(feature = "openai")]
47-
use mdmodels::llm::extraction::query_openai;
48-
4947
/// Command-line interface for MD-Models CLI.
5048
#[derive(Parser)]
5149
#[command(name = "MD-Models CLI", version = "0.1.0")]
@@ -238,10 +236,7 @@ fn main() -> Result<(), Box<dyn Error>> {
238236
Commands::Validate(args) => validate(args),
239237
Commands::Convert(args) => convert(args),
240238
Commands::Pipeline(args) => process_pipeline(&args.input),
241-
#[cfg(feature = "openai")]
242239
Commands::Extract(args) => query_llm(args),
243-
#[cfg(not(feature = "openai"))]
244-
Commands::Extract(_) => Err("OpenAI support is not enabled. Please enable the 'openai' feature using the --features openai flag when building the package.".into()),
245240
Commands::Dataset(args) => match args.command {
246241
DatasetCommands::Validate(args) => validate_ds(args),
247242
},
@@ -311,7 +306,6 @@ fn print_validation_result(result: bool) {
311306
println!(" └── {message}\n");
312307
}
313308

314-
#[cfg(feature = "openai")]
315309
fn query_llm(args: ExtractArgs) -> Result<(), Box<dyn Error>> {
316310
let path = resolve_input_path(&args.model);
317311
let model = DataModel::from_markdown(&path)?;

0 commit comments

Comments
 (0)