Skip to content

Commit

Permalink
add openai api key
Browse files Browse the repository at this point in the history
  • Loading branch information
bjchambers committed Jan 29, 2024
1 parent 458d1f3 commit 742c8ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
run: poetry install
- name: pytest
run: poetry run pytest -v
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

python_lint:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions dewy/common/collection_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ async def ingest(self, document_id: int, url: str) -> None:
async with conn.transaction():

def encode_chunk(c: str) -> str:
# We believe that either invalid unicode or the occurrence of nulls was
# causing problems that *looked* like only the first page from a PDF was
# being indexed (https://github.com/DewyKB/dewy/issues/20). We do not
# know that all of this is truly necessary.
encoded = c.encode("utf-8").decode("utf-8", "ignore")
return encoded.replace("\x00", "\uFFFD")

Expand Down
4 changes: 2 additions & 2 deletions tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def create_collection(client, text_embedding_model: str) -> int:
async def ingest(client, collection: int, url: str) -> int:
add_request = AddDocumentRequest(collection_id=collection, url=url)
add_response = await client.put(
"/api/documents/", data=add_request.model_dump_json()
"/api/documents/", content=add_request.model_dump_json()
)
assert add_response.status_code == 200

Expand Down Expand Up @@ -52,7 +52,7 @@ async def retrieve(client, collection: int, query: str) -> RetrieveResponse:
collection_id=collection, query=query, include_image_chunks=False
)

response = await client.post("/api/chunks/retrieve", data=request.model_dump_json())
response = await client.post("/api/chunks/retrieve", content=request.model_dump_json())
assert response.status_code == 200
return RetrieveResponse.model_validate_json(response.content)

Expand Down

0 comments on commit 742c8ee

Please sign in to comment.