diff --git a/.changeset/clean-avocados-burn.md b/.changeset/clean-avocados-burn.md new file mode 100644 index 00000000..5833bc16 --- /dev/null +++ b/.changeset/clean-avocados-burn.md @@ -0,0 +1,5 @@ +--- +"@instructor-ai/instructor": patch +--- + +explicit check for oai url vs falling through to other diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a94e4e86..fa6bf1be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -37,3 +70,4 @@ jobs: - run: bun run type-check - run: bun run lint - run: bun test --timeout=15000 + \ No newline at end of file diff --git a/src/instructor.ts b/src/instructor.ts index 3c5587f7..33efc5a3 100644 --- a/src/instructor.ts +++ b/src/instructor.ts @@ -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 diff --git a/tests/zod-type.test.ts b/tests/zod-type.test.ts index 0027baa0..29c722ea 100644 --- a/tests/zod-type.test.ts +++ b/tests/zod-type.test.ts @@ -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)