Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"postCreateCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
]
"extensions": ["esbenp.prettier-vscode"]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dist
dist-deno
/*.tgz
.idea/
.eslintcache

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.8.0"
".": "0.8.1"
}
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.8.1 (2025-10-07)

Full Changelog: [v0.8.0...v0.8.1](https://github.com/ContextualAI/contextual-client-node/compare/v0.8.0...v0.8.1)

### Bug Fixes

* coerce nullable values to undefined ([0e6f279](https://github.com/ContextualAI/contextual-client-node/commit/0e6f279eac597fca69a580ab8af0a12c015ab644))


### Performance Improvements

* faster formatting ([20716e5](https://github.com/ContextualAI/contextual-client-node/commit/20716e5908af1f9cc6e3eb60e306ededc8f3d720))


### Chores

* do not install brew dependencies in ./scripts/bootstrap by default ([2ecd296](https://github.com/ContextualAI/contextual-client-node/commit/2ecd29636b8f21c6138729ef7338f50084410b0e))
* **internal:** codegen related update ([d6debdf](https://github.com/ContextualAI/contextual-client-node/commit/d6debdfcc774fb8092bd2cabdc036359872d8643))
* **internal:** codegen related update ([3bc0d6f](https://github.com/ContextualAI/contextual-client-node/commit/3bc0d6fec90af69104f10af5def4be3deeb69507))
* **internal:** fix incremental formatting in some cases ([2d2c927](https://github.com/ContextualAI/contextual-client-node/commit/2d2c9279de2f4cbfd1edba630aeb30b7395c3481))
* **internal:** ignore .eslintcache ([1b5df0d](https://github.com/ContextualAI/contextual-client-node/commit/1b5df0db14ec9b5bd5429e4025480d8ba430eda0))
* **internal:** improve examples ([c251c21](https://github.com/ContextualAI/contextual-client-node/commit/c251c212ee8bff087c7b98f3f5750bf3036ce0cf))
* **internal:** remove .eslintcache ([352a8df](https://github.com/ContextualAI/contextual-client-node/commit/352a8dfca95b76937b6eeb4e800226afcd7d3337))
* **internal:** remove deprecated `compilerOptions.baseUrl` from tsconfig.json ([80dc3e8](https://github.com/ContextualAI/contextual-client-node/commit/80dc3e82bb18210f781ebf38500a2310ce10e0e5))
* **internal:** use npm pack for build uploads ([a1e64cd](https://github.com/ContextualAI/contextual-client-node/commit/a1e64cdb60b8c92692b52914609745edd85a6c43))

## 0.8.0 (2025-08-26)

Full Changelog: [v0.7.0...v0.8.0](https://github.com/ContextualAI/contextual-client-node/compare/v0.7.0...v0.8.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "contextual-client",
"version": "0.8.0",
"version": "0.8.1",
"description": "The official TypeScript library for the Contextual AI API",
"author": "Contextual AI <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
5 changes: 1 addition & 4 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,5 @@
}
],
"release-type": "node",
"extra-files": [
"src/version.ts",
"README.md"
]
"extra-files": ["src/version.ts", "README.md"]
}
14 changes: 11 additions & 3 deletions scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
case "$response" in
[yY][eE][sS]|[yY])
brew bundle
;;
*)
;;
esac
echo
}
fi

Expand Down
40 changes: 40 additions & 0 deletions scripts/fast-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -euo pipefail

echo "Script started with $# arguments"
echo "Arguments: $*"
echo "Script location: $(dirname "$0")"

cd "$(dirname "$0")/.."
echo "Changed to directory: $(pwd)"

if [ $# -eq 0 ]; then
echo "Usage: $0 <file-with-paths> [additional-formatter-args...]"
echo "The file should contain one file path per line"
exit 1
fi

FILE_LIST="$1"

echo "Looking for file: $FILE_LIST"

if [ ! -f "$FILE_LIST" ]; then
echo "Error: File '$FILE_LIST' not found"
exit 1
fi

echo "==> Running eslint --fix"
ESLINT_FILES="$(grep '\.ts$' "$FILE_LIST" || true)"
if ! [ -z "$ESLINT_FILES" ]; then
echo "$ESLINT_FILES" | ESLINT_USE_FLAT_CONFIG="false" xargs ./node_modules/.bin/eslint --cache --fix
fi

echo "==> Running prettier --write"
# format things eslint didn't
PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)"
if ! [ -z "$PRETTIER_FILES" ]; then
echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \
--write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \
'!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs'
fi
6 changes: 4 additions & 2 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz "${BUILD_PATH:-dist}" | curl -v -X PUT \
TARBALL=$(cd dist && npm pack --silent)

UPLOAD_RESPONSE=$(curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)
--data-binary "@dist/$TARBALL" "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
Expand Down
6 changes: 3 additions & 3 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1088,21 +1088,21 @@ export const coerceBoolean = (value: unknown): boolean => {
};

export const maybeCoerceInteger = (value: unknown): number | undefined => {
if (value === undefined) {
if (value == null) {
return undefined;
}
return coerceInteger(value);
};

export const maybeCoerceFloat = (value: unknown): number | undefined => {
if (value === undefined) {
if (value == null) {
return undefined;
}
return coerceFloat(value);
};

export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
if (value === undefined) {
if (value == null) {
return undefined;
}
return coerceBoolean(value);
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.8.0'; // x-release-please-version
export const VERSION = '0.8.1'; // x-release-please-version
10 changes: 8 additions & 2 deletions tests/api-resources/agents/agents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ describe('resource agents', () => {
name: 'xxx',
agent_configs: {
filter_and_rerank_config: {
default_metadata_filters: { filters: [], operator: 'AND' },
default_metadata_filters: {
filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
operator: 'AND',
},
per_datastore_metadata_filters: {
'd49609d9-61c3-4a67-b3bd-5196b10da560': { filters: [], operator: 'AND' },
'd49609d9-61c3-4a67-b3bd-5196b10da560': {
filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
operator: 'AND',
},
},
rerank_instructions: 'rerank_instructions',
reranker_score_filter_threshold: 0,
Expand Down
5 changes: 4 additions & 1 deletion tests/api-resources/agents/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ describe('resource query', () => {
include_retrieval_content_text: true,
retrievals_only: true,
conversation_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
documents_filters: { filters: [], operator: 'AND' },
documents_filters: {
filters: [{ field: 'field1', operator: 'equals', value: 'value1' }],
operator: 'AND',
},
llm_model_id: 'llm_model_id',
override_configuration: {
enable_filter: true,
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"compilerOptions": {
"rootDir": "./dist/src",
"paths": {
"contextual-client/*": ["dist/src/*"],
"contextual-client": ["dist/src/index.ts"],
"contextual-client/*": ["./dist/src/*"],
"contextual-client": ["./dist/src/index.ts"]
},
"noEmit": false,
"declaration": true,
Expand Down
9 changes: 4 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
"contextual-client/_shims/auto/*": ["src/_shims/auto/*-node"],
"contextual-client/*": ["src/*"],
"contextual-client": ["src/index.ts"]
"contextual-client/_shims/auto/*": ["./src/_shims/auto/*-node"],
"contextual-client/*": ["./src/*"],
"contextual-client": ["./src/index.ts"]
},
"noEmit": true,

Expand All @@ -32,7 +31,7 @@
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"isolatedModules": false,
"isolatedModules": false,

"skipLibCheck": true
}
Expand Down