Skip to content

Commit 95aa27f

Browse files
authored
Fix validation check (#104)
1 parent 419f33f commit 95aa27f

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

.changeset/clean-avocados-burn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@instructor-ai/instructor": patch
3+
---
4+
5+
explicit check for oai url vs falling through to other

.github/workflows/test.yml

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
name: Test
22
on:
33
push:
4-
branches:
4+
branches:
55
- main
6-
pull_request_target:
6+
pull_request:
77
branches:
88
- main
99
jobs:
10-
test:
10+
test-main:
11+
if: github.ref == 'refs/heads/main'
12+
name: run-tests
13+
runs-on: ubuntu-latest
14+
environment: TEST-MAIN
15+
env:
16+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
17+
ANYSCALE_API_KEY: ${{ secrets.ANYSCALE_API_KEY }}
18+
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup bun
26+
uses: oven-sh/setup-bun@v1
27+
with:
28+
bun-version: latest
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 20.9.0
34+
35+
- name: Install Dependencies
36+
run: bun i
37+
38+
- run: bun run type-check
39+
- run: bun run lint
40+
- run: bun test --timeout=15000
41+
42+
test-branch:
43+
if: github.event_name == 'pull_request'
1144
name: run-tests
1245
runs-on: ubuntu-latest
1346
environment: OPENAI
@@ -37,3 +70,4 @@ jobs:
3770
- run: bun run type-check
3871
- run: bun run lint
3972
- run: bun test --timeout=15000
73+

src/instructor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Instructor {
3838
const provider =
3939
this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.ANYSCALE) ? PROVIDERS.ANYSCALE
4040
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.TOGETHER) ? PROVIDERS.TOGETHER
41-
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.TOGETHER) ? PROVIDERS.OAI
41+
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.OAI) ? PROVIDERS.OAI
4242
: PROVIDERS.OTHER
4343

4444
this.provider = provider

tests/zod-type.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe("zod-schema test", () => {
3636
const user = await extractUser({
3737
schema: UserSchema
3838
})
39-
console.log("test", user)
4039

4140
expect(user.name).toEqual("Jason Liu")
4241
expect(user.age).toEqual(30)

0 commit comments

Comments
 (0)