diff --git a/engine/Cargo.lock b/engine/Cargo.lock index 5006542f1..61c17467d 100644 --- a/engine/Cargo.lock +++ b/engine/Cargo.lock @@ -1680,9 +1680,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "either" diff --git a/engine/baml-schema-wasm/src/runtime_wasm/generator.rs b/engine/baml-schema-wasm/src/runtime_wasm/generator.rs index 8a2b6cfd4..666c9f10e 100644 --- a/engine/baml-schema-wasm/src/runtime_wasm/generator.rs +++ b/engine/baml-schema-wasm/src/runtime_wasm/generator.rs @@ -6,6 +6,8 @@ pub struct WasmGeneratorOutput { #[wasm_bindgen(readonly)] pub output_dir: String, #[wasm_bindgen(readonly)] + pub output_dir_relative_to_baml_src: String, + #[wasm_bindgen(readonly)] pub files: Vec, } @@ -22,6 +24,10 @@ impl Into for GenerateOutput { fn into(self) -> WasmGeneratorOutput { WasmGeneratorOutput { output_dir: self.output_dir_full.to_string_lossy().to_string(), + output_dir_relative_to_baml_src: self + .output_dir_shorthand + .to_string_lossy() + .to_string(), files: self .files .into_iter() diff --git a/engine/language_client_codegen/Cargo.toml b/engine/language_client_codegen/Cargo.toml index 981b0a899..28ad655d8 100644 --- a/engine/language_client_codegen/Cargo.toml +++ b/engine/language_client_codegen/Cargo.toml @@ -30,4 +30,4 @@ sugar_path = "1.2.0" walkdir.workspace = true semver = "1.0.23" colored = "2.1.0" -itertools = "0.13.0" +itertools = "0.13.0" \ No newline at end of file diff --git a/fern/01-guide/04-baml-basics/switching-llms.mdx b/fern/01-guide/04-baml-basics/switching-llms.mdx index ccb950ac3..92ffc2049 100644 --- a/fern/01-guide/04-baml-basics/switching-llms.mdx +++ b/fern/01-guide/04-baml-basics/switching-llms.mdx @@ -50,8 +50,8 @@ function MakeHaiku(topic: string) -> string { } ``` -Consult the [provider documentation](#fields) for a list of supported providers -and models, the default options, and setting [retry policies](/docs/reference/retry-policy). +Consult the [provider documentation](/ref/llm-client-providers/open-ai) for a list of supported providers +and models, the default options, and setting [retry policies](/ref/llm-client-strategies/retry-policy). If you want to specify which client to use at runtime, in your Python/TS/Ruby code, diff --git a/typescript/vscode-ext/packages/language-server/src/lib/baml_project_manager.ts b/typescript/vscode-ext/packages/language-server/src/lib/baml_project_manager.ts index 5ccae611c..43f943257 100644 --- a/typescript/vscode-ext/packages/language-server/src/lib/baml_project_manager.ts +++ b/typescript/vscode-ext/packages/language-server/src/lib/baml_project_manager.ts @@ -371,6 +371,11 @@ class Project { // Creating the tmpdir next to the output dir can cause some weird issues with vscode, if we recover // from an error and delete the tmpdir - vscode's explorer UI will still show baml_client.tmp even // though it doesn't exist anymore, and vscode has no good way of letting the user purge it from the UI + console.log(`outputdir ${g.output_dir}`) + console.log(`relative output dir ${g.output_dir_relative_to_baml_src}`) + + const out_dir = path.join(this.rootPath(), g.output_dir_relative_to_baml_src) + const tmpDir = path.join(path.dirname(g.output_dir), path.basename(g.output_dir) + '.tmp') const backupDir = path.join(path.dirname(g.output_dir), path.basename(g.output_dir) + '.bak') @@ -386,8 +391,8 @@ class Project { if (existsSync(backupDir)) { await rm(backupDir, { recursive: true, force: true }) } - if (existsSync(g.output_dir)) { - const contents = await readdir(g.output_dir, { withFileTypes: true }) + if (existsSync(out_dir)) { + const contents = await readdir(out_dir, { withFileTypes: true }) const contentsWithSafeToRemove = await Promise.all( contents.map(async (c) => { if (c.isDirectory()) { @@ -414,15 +419,16 @@ class Project { `Output dir ${g.output_dir} contains this file(s) not generated by BAML: ${notSafeToRemove.join(', ')}`, ) } - await rename(g.output_dir, backupDir) + await rename(out_dir, backupDir) } - await rename(tmpDir, g.output_dir) + await rename(tmpDir, out_dir) try { // some filewatchers don't trigger unless the file is touched. Creating the new dir alone doesn't work. // if we remove this, TS will still have the old types, and nextjs will not hot-reload. g.files.map((f) => { - const fpath = path.join(g.output_dir, f.path_in_output_dir) + const fpath = path.join(out_dir, f.path_in_output_dir) + console.log(`fpath ${fpath}`) const currentTime = new Date() const newTime = new Date(currentTime.getTime() + 100) utimes(fpath, newTime, newTime, (err) => {