fix: use 127.0.0.1 instead of localhost

On my recent-ish macOS, the OpenAI library seems to resolve localhost to ::1,
and my local web server isn't listening there

I suspect issue is somewhere else (maybe just my computer?) but this fixes it
This commit is contained in:
Jamie Dubs
2023-11-15 22:11:41 -05:00
parent f71d4d22d7
commit 8e4889293c
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ import type { Run } from '~/lib/db'
*
* To run it against your custom, local API:
* ```bash
* OPENAI_API_BASE_URL='http://localhost:3000' npx tsx e2e
* OPENAI_API_BASE_URL='http://127.0.0.1:3000' npx tsx e2e
* ```
*/
async function main() {
+1 -1
View File
@@ -20,7 +20,7 @@ import type { Run } from '~/lib/db'
*
* To run it against your custom, local API:
* ```bash
* OPENAI_API_BASE_URL='http://localhost:3000' npx tsx e2e/retrieval.ts
* OPENAI_API_BASE_URL='http://127.0.0.1:3000' npx tsx e2e/retrieval.ts
* ```
*/
async function main() {
+3 -3
View File
@@ -203,7 +203,7 @@ npx tsx e2e
To run the same test suite against your local API, you can run:
```bash
OPENAI_API_BASE_URL='http://localhost:3000' npx tsx e2e
OPENAI_API_BASE_URL='http://127.0.0.1:3000' npx tsx e2e
```
It's pretty cool to see both test suites running the exact same Assistants code using the official OpenAI Node.js client without any noticeable differences between the two versions. Huzzah! 🥳
@@ -221,7 +221,7 @@ npx tsx e2e/retrieval.ts
To run the same test suite against your local API, you can run:
```bash
OPENAI_API_BASE_URL='http://localhost:3000' npx tsx e2e/retrieval.ts
OPENAI_API_BASE_URL='http://127.0.0.1:3000' npx tsx e2e/retrieval.ts
```
The output will likely differ slightly due to differences in OpenAI's built-in retrieval implementation and [our default, naive retrieval implementation](./src/lib/retrieval.ts).
@@ -268,7 +268,7 @@ GET /threads/:thread_id/runs/:run_id/steps/:step_id
GET /openapi
```
You can view the server's auto-generated openapi spec by running the server and then visiting `http://localhost:3000/openapi`
You can view the server's auto-generated openapi spec by running the server and then visiting `http://127.0.0.1:3000/openapi`
## TODO