Skip to content

Commit

Permalink
Fix validation check (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
roodboi authored Feb 3, 2024
1 parent 419f33f commit 95aa27f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-avocados-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@instructor-ai/instructor": patch
---

explicit check for oai url vs falling through to other
40 changes: 37 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
name: Test
on:
push:
branches:
branches:
- main
pull_request_target:
pull_request:
branches:
- main
jobs:
test:
test-main:
if: github.ref == 'refs/heads/main'
name: run-tests
runs-on: ubuntu-latest
environment: TEST-MAIN
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANYSCALE_API_KEY: ${{ secrets.ANYSCALE_API_KEY }}
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Install Dependencies
run: bun i

- run: bun run type-check
- run: bun run lint
- run: bun test --timeout=15000

test-branch:
if: github.event_name == 'pull_request'
name: run-tests
runs-on: ubuntu-latest
environment: OPENAI
Expand Down Expand Up @@ -37,3 +70,4 @@ jobs:
- run: bun run type-check
- run: bun run lint
- run: bun test --timeout=15000

2 changes: 1 addition & 1 deletion src/instructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Instructor {
const provider =
this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.ANYSCALE) ? PROVIDERS.ANYSCALE
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.TOGETHER) ? PROVIDERS.TOGETHER
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.TOGETHER) ? PROVIDERS.OAI
: this.client?.baseURL.includes(NON_OAI_PROVIDER_URLS.OAI) ? PROVIDERS.OAI
: PROVIDERS.OTHER

this.provider = provider
Expand Down
1 change: 0 additions & 1 deletion tests/zod-type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe("zod-schema test", () => {
const user = await extractUser({
schema: UserSchema
})
console.log("test", user)

expect(user.name).toEqual("Jason Liu")
expect(user.age).toEqual(30)
Expand Down

0 comments on commit 95aa27f

Please sign in to comment.