From 5193cd70686173c863af5ce40fd6bb3792406951 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Thu, 19 Sep 2024 03:13:47 -0400 Subject: [PATCH] Fix some documentation typos (#966) - Fixes several typos on docs.boundaryml.com - Updates some docstrings that referred to outdated terminology (`model`) - Added `fern` to nix dev env. Co-authored-by: hellovai --- docs/docs/calling-baml/multi-modal.mdx | 8 ++--- docs/docs/snippets/supported-types.mdx | 16 +++++----- docs/package.json | 2 +- .../src/ast/value_expression_block.rs | 31 ++++++++++--------- shell.nix | 23 +++++++++++++- 5 files changed, 51 insertions(+), 29 deletions(-) diff --git a/docs/docs/calling-baml/multi-modal.mdx b/docs/docs/calling-baml/multi-modal.mdx index a7fd7e91f..825473177 100644 --- a/docs/docs/calling-baml/multi-modal.mdx +++ b/docs/docs/calling-baml/multi-modal.mdx @@ -65,14 +65,14 @@ async def run(): # from URL res = await b.TestAudioInput( img=Audio.from_url( - "https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png" + "https://actions.google.com/sounds/v1/emergency/beeper_emergency_call.ogg" ) ) # Base64 b64 = "iVBORw0K...." res = await b.TestAudioInput( - img=Audio.from_base64("image/png", b64) + audio=Audio.from_base64("audio/ogg", b64) ) ``` @@ -83,13 +83,13 @@ import { Audio } from "@boundaryml/baml" // URL let res = await b.TestAudioInput( - Audio.fromUrl('https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.mp4'), + Audio.fromUrl('https://actions.google.com/sounds/v1/emergency/beeper_emergency_call.ogg'), ) // Base64 const audio_base64 = ".." let res = await b.TestAudioInput( - Audio.fromBase64('image/png', audio_base64), + Audio.fromBase64('audio/ogg', audio_base64), ) ``` diff --git a/docs/docs/snippets/supported-types.mdx b/docs/docs/snippets/supported-types.mdx index 793cbe7cd..dbda024ec 100644 --- a/docs/docs/snippets/supported-types.mdx +++ b/docs/docs/snippets/supported-types.mdx @@ -4,7 +4,7 @@ slug: docs/snippets/supported-types --- -Here's a list of all the types you can extract from LLMs with BAML: +Here's a list of all the types that can be represented in BAML: ## Primitive types * `bool` @@ -95,15 +95,15 @@ from baml_client import b async def run(): # from URL res = await b.TestAudioInput( - img=Audio.from_url( - "https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png" + audio=Audio.from_url( + "https://actions.google.com/sounds/v1/emergency/beeper_emergency_call.ogg" ) ) # Base64 b64 = "iVBORw0K...." res = await b.TestAudioInput( - img=Audio.from_base64("image/png", b64) + audio=Audio.from_base64("audio/ogg", b64) ) ``` @@ -114,13 +114,13 @@ import { Audio } from "@boundaryml/baml" // URL let res = await b.TestAudioInput( - Audio.fromUrl('https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.mp4'), + Audio.fromUrl('https://actions.google.com/sounds/v1/emergency/beeper_emergency_call.ogg'), ) // Base64 const audio_base64 = ".." let res = await b.TestAudioInput( - Audio.fromBase64('image/png', audio_base64), + Audio.fromBase64('audio/ogg', audio_base64), ) ``` @@ -131,7 +131,7 @@ import { Audio } from "@boundaryml/baml" ### enum -**See also:** [Enum](/docs/syntax/enum) +**See also:** [Enum](/docs/snippets/enum) A user-defined type consisting of a set of named constants. Use it when you need a model to choose from a known set of values, like in classification problems @@ -145,7 +145,7 @@ enum Name { ### class -**See also:** [Class](/docs/syntax/class) +**See also:** [Class](/docs/snippets/class) Classes are for user-defined complex data structures. diff --git a/docs/package.json b/docs/package.json index ce158ed4f..6de00bfa2 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,5 +1,5 @@ { - "scripts" : { + "scripts": { "dev": "npx fern docs dev", "preview": "npx fern generate --preview --docs" }, diff --git a/engine/baml-lib/schema-ast/src/ast/value_expression_block.rs b/engine/baml-lib/schema-ast/src/ast/value_expression_block.rs index e83f91b38..62ca4b6ae 100644 --- a/engine/baml-lib/schema-ast/src/ast/value_expression_block.rs +++ b/engine/baml-lib/schema-ast/src/ast/value_expression_block.rs @@ -116,20 +116,21 @@ impl BlockArgs { } } -/// A model declaration. +/// A block declaration. +/// A complete Function, Client, Generator, Test, or RetryPolicy. #[derive(Debug, Clone)] pub struct ValueExprBlock { - /// The name of the model. + /// The name of the block. /// /// ```ignore - /// function Foo { .. } - /// ^^^ + /// function Foo(...) {...} + /// ^^^ /// ``` pub(crate) name: Identifier, - /// The fields of the model. + /// The fields of the block. /// /// ```ignore - /// model Foo { + /// class Foo { /// id Int @id /// ^^^^^^^^^^^^^^^^ /// field String @@ -138,32 +139,32 @@ pub struct ValueExprBlock { /// ``` pub(crate) input: Option, pub(crate) output: Option, - /// The documentation for this model. + /// The documentation for this block. /// /// ```ignore /// /// Lorem ipsum /// ^^^^^^^^^^^ - /// model Foo { + /// class Foo { /// id Int @id /// field String /// } /// ``` pub(crate) documentation: Option, - /// The attributes of this model. + /// The attributes of this block. /// /// ```ignore - /// model Foo { + /// class Foo { /// id Int @id /// field String /// - /// @@index([field]) - /// ^^^^^^^^^^^^^^^^ - /// @@map("Bar") - /// ^^^^^^^^^^^^ + /// @@description("A Foo") + /// ^^^^^^^^^^^^^^^^^^^^^^ + /// @@check({{ this.field|length < 100 }}, "Short field") + /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /// } /// ``` pub attributes: Vec, - /// The location of this model in the text representation. + /// The location of this block in the text representation. pub(crate) span: Span, pub fields: Vec>, diff --git a/shell.nix b/shell.nix index 2895cf560..196b256aa 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,29 @@ let pkgs = import {}; + + nodeEnv = pkgs.callPackage {}; + fern = nodeEnv.buildNodePackage rec { + name = "fern-api"; + packageName = "fern-api"; + version = "0.42.8"; + src = pkgs.fetchurl { + url = "https://registry.npmjs.org/fern-api/-/fern-api-${version}.tgz"; + sha256 = "sha256-jaKXJsvgjRPpm2ojB6a2hkEAmk7NrfcTA28MLl3VjHg="; + }; + dependencies = []; + }; + in pkgs.mkShell { - buildInputs = with pkgs; [ cargo rustc nodePackages.pnpm python3 poetry ]; + buildInputs = with pkgs; [ + cargo + rustc + nodePackages.pnpm + python3 + poetry + rust-analyzer + fern + ]; shellHook = '' export PROJECT_ROOT=/$(pwd) export PATH=/$PROJECT_ROOT/tools:$PATH