Skip to content

Commit

Permalink
Merge branch 'canary' into working-vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronvg authored May 31, 2024
2 parents 6b93786 + 553bec8 commit acbd24f
Show file tree
Hide file tree
Showing 11 changed files with 450 additions and 264 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release_language_client_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release language_client_python

on:
push:
branches: ["working-vscode"]
branches: ["canary"]
workflow_dispatch: {}

permissions:
Expand Down Expand Up @@ -74,7 +74,6 @@ jobs:
needs: [build]
#if: startsWith(github.ref, 'refs/tags/release/')
#environment: release

steps:
- uses: actions/download-artifact@v4
- run: mkdir dist && mv wheels-*/* dist
Expand Down
30 changes: 0 additions & 30 deletions clients/python/baml_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,3 @@


__all__ = ["__version__", "baml_init", "DeserializerException"]

import typing
from pydantic import BaseModel
from enum import Enum


class MyEnum(str, Enum):
FOO = "foo"
BAR = "bar"


class Foo(BaseModel):
bar: str
em2: MyEnum = MyEnum.FOO


foo = Foo(bar="baz")


class Bar(BaseModel):
foo: typing.List[Foo]
en: MyEnum = MyEnum.BAR


bar = Bar(foo=[foo])


bar.model_fields.keys()

bar.model_dump_json()
3 changes: 3 additions & 0 deletions clients/ts/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ module.exports = {
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
moduleDirectories: ["node_modules", "src"],
silent: false,
transform: {
"^.+\\.(t|j)sx?$": "@swc/jest",
},
};
6 changes: 5 additions & 1 deletion clients/ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boundaryml/baml-core",
"version": "0.0.8",
"version": "0.0.10",
"description": "",
"exports": {
".": {
Expand Down Expand Up @@ -53,6 +53,8 @@
"license": "Apache-2.0",
"devDependencies": {
"@jest/types": "^29.6.3",
"@swc/core": "^1.4.17",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.11",
"@types/json-schema": "^7.0.15",
"@types/node": "^20.11.21",
Expand All @@ -67,7 +69,9 @@
"@anthropic-ai/sdk": "^0.18.0",
"@azure/openai": "1.0.0-beta.11",
"@boundaryml/baml-core-ffi": "0.18.0",
"@next/env": "^14.2.3",
"dotenv": "^16.4.5",
"dotenv-flow": "^4.1.0",
"jest-runner": "^29.7.0",
"json-schema": "^0.4.0",
"ollama": "^0.5.0",
Expand Down
185 changes: 179 additions & 6 deletions clients/ts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions clients/ts/src/deserializer/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,19 @@ class Deserializer<T> {

coerce(value: string): T {
const d = new Diagnostics(value);

if (this.target?.type === "string") {
return value as T;
}
const _t = this.getInterface(this.target);
if (_t.type === "string" && _t.enum === undefined) {
return value as T;
}

const raw = fromValue(value, d);

const deserializer = this.get_deserializer(this.target);

const response = deserializer.coerce(raw, d, this.get_deserializer.bind(this));
d.toException();
return response.as_value;
Expand Down
Loading

0 comments on commit acbd24f

Please sign in to comment.