Skip to content

Commit

Permalink
Fix some documentation typos (#966)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
imalsogreg and hellovai authored Sep 19, 2024
1 parent 109ae09 commit 5193cd7
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 29 deletions.
8 changes: 4 additions & 4 deletions docs/docs/calling-baml/multi-modal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
```

Expand All @@ -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),
)

```
Expand Down
16 changes: 8 additions & 8 deletions docs/docs/snippets/supported-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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)
)
```

Expand All @@ -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),
)

```
Expand All @@ -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
Expand All @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"scripts" : {
"scripts": {
"dev": "npx fern docs dev",
"preview": "npx fern generate --preview --docs"
},
Expand Down
31 changes: 16 additions & 15 deletions engine/baml-lib/schema-ast/src/ast/value_expression_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -138,32 +139,32 @@ pub struct ValueExprBlock {
/// ```
pub(crate) input: Option<BlockArgs>,
pub(crate) output: Option<BlockArg>,
/// 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<Comment>,
/// 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<Attribute>,
/// 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<Field<Expression>>,

Expand Down
23 changes: 22 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
let
pkgs = import <nixpkgs> {};

nodeEnv = pkgs.callPackage <nixpkgs/pkgs/development/node-packages/node-env.nix> {};
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
Expand Down

0 comments on commit 5193cd7

Please sign in to comment.