Skip to content

fix(langchain): preserve tool configuration in generation input #3506

fix(langchain): preserve tool configuration in generation input

fix(langchain): preserve tool configuration in generation input #3506

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test-unit:
timeout-minutes: 3
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- run: pnpm install --frozen-lockfile
- run: pnpm test:unit
test-integration:
timeout-minutes: 3
runs-on: blacksmith-4vcpu-ubuntu-2404
env:
LANGFUSE_BASE_URL: "http://localhost:3000"
LANGFUSE_SECRET_KEY: "sk-lf-1234567890"
LANGFUSE_PUBLIC_KEY: "pk-lf-1234567890"
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- run: pnpm install --frozen-lockfile
- run: pnpm test:integration
test-e2e:
timeout-minutes: 15
runs-on: blacksmith-4vcpu-ubuntu-2404
env:
LANGFUSE_BASE_URL: "http://localhost:3000"
LANGFUSE_SECRET_KEY: "sk-lf-1234567890"
LANGFUSE_PUBLIC_KEY: "pk-lf-1234567890"
LANGFUSE_INIT_ORG_ID: "0c6c96f4-0ca0-4f16-92a8-6dd7d7c6a501"
LANGFUSE_INIT_ORG_NAME: "SDK Test Org"
LANGFUSE_INIT_PROJECT_ID: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a"
LANGFUSE_INIT_PROJECT_NAME: "SDK Test Project"
LANGFUSE_INIT_PROJECT_PUBLIC_KEY: "pk-lf-1234567890"
LANGFUSE_INIT_PROJECT_SECRET_KEY: "sk-lf-1234567890"
LANGFUSE_INIT_USER_EMAIL: "sdk-tests@langfuse.local"
LANGFUSE_INIT_USER_NAME: "SDK Tests"
LANGFUSE_INIT_USER_PASSWORD: "langfuse-ci-password"
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Prepare langfuse server compose
run: |
mkdir -p ./langfuse-server
LANGFUSE_SERVER_SHA="$(git ls-remote https://github.com/langfuse/langfuse.git HEAD | cut -f1)"
curl -fsSL "https://raw.githubusercontent.com/langfuse/langfuse/${LANGFUSE_SERVER_SHA}/docker-compose.yml" \
-o ./langfuse-server/docker-compose.yml
cp ./.github/langfuse-v4-dual-write.override.yml \
./langfuse-server/docker-compose.override.yml
echo "${LANGFUSE_SERVER_SHA}"
- name: Run langfuse server
run: |
cd ./langfuse-server
echo "::group::Start langfuse server"
TELEMETRY_ENABLED=false \
NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=true \
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=http://localhost:9090 \
LANGFUSE_INGESTION_QUEUE_DELAY_MS=10 \
LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS=10 \
LANGFUSE_EXPERIMENT_INSERT_INTO_EVENTS_TABLE=true \
QUEUE_CONSUMER_EVENT_PROPAGATION_QUEUE_IS_ENABLED=true \
LANGFUSE_ENABLE_EVENTS_TABLE_V2_APIS=true \
LANGFUSE_ENABLE_EVENTS_TABLE_OBSERVATIONS=true \
docker compose up -d
echo "::endgroup::"
- run: pnpm install --frozen-lockfile
- name: Health check for langfuse server
run: |
echo "Checking if the langfuse server is up..."
retry_count=0
max_retries=20
until curl --output /dev/null --silent --head --fail http://localhost:3000/api/public/health && \
node - <<'NODE'
const auth = Buffer.from(
`${process.env.LANGFUSE_PUBLIC_KEY}:${process.env.LANGFUSE_SECRET_KEY}`,
).toString("base64");
fetch(`${process.env.LANGFUSE_BASE_URL}/api/public/projects`, {
headers: {
Authorization: `Basic ${auth}`,
},
})
.then(async (response) => {
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`);
}
return response.json();
})
.then((body) => {
const project = body.data?.find(
(candidate) =>
candidate.id === process.env.LANGFUSE_INIT_PROJECT_ID,
);
if (!project) {
throw new Error(
`Expected initialized project ${process.env.LANGFUSE_INIT_PROJECT_ID}`,
);
}
console.log(project.id);
})
.catch((error) => {
console.error(error);
process.exit(1);
});
NODE
do
retry_count=`expr $retry_count + 1`
echo "Attempt $retry_count of $max_retries..."
if [ $retry_count -ge $max_retries ]; then
echo "Langfuse server did not respond in time. Printing logs..."
(cd ./langfuse-server && docker compose ps)
(cd ./langfuse-server && docker compose logs langfuse-web langfuse-worker)
echo "Failing the step..."
exit 1
fi
sleep 5
done
echo "Langfuse server is up and running!"
- run: pnpm test:e2e
lint:
timeout-minutes: 3
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- run: pnpm install --frozen-lockfile
- name: Verify lockfile integrity
run: |
git diff --exit-code pnpm-lock.yaml || {
echo "❌ Error: pnpm-lock.yaml was modified during install"
exit 1
}
- run: pnpm build
- run: pnpm lint
- run: pnpm format:check
all-tests-passed:
runs-on: blacksmith-2vcpu-ubuntu-2404
needs: [test-unit, test-e2e, test-integration, lint]
if: always()
steps:
- name: Successful deploy
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing deploy
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1