Skip to content

Commit

Permalink
fix mypy stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobweiss2305 committed Oct 4, 2024
1 parent f167d33 commit 5cdeb87
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
7 changes: 6 additions & 1 deletion cookbook/advanced_rag/image_search/01_download_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def generate_and_download_image(prompt, filename):
print(f"Generated image URL: {image_url}")

# Download image
image_response = httpx.get(image_url)
if image_url is not None:
image_response = httpx.get(image_url)
else:
# Handle the case where image_url is None
return "No image URL available"

if image_response.status_code == 200:
file_path = data_dir.joinpath(filename)
with open(file_path, "wb") as file:
Expand Down
10 changes: 4 additions & 6 deletions cookbook/advanced_rag/image_search/02_upsert_pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
from pathlib import Path
from typing import List, Tuple, Dict, Any

import torch # type: ignore
from PIL import Image # type: ignore
from pinecone import Pinecone, ServerlessSpec, Index # type: ignore

# Type ignore for third-party libraries without type stubs
import clip # type: ignore
import torch
from PIL import Image
from pinecone import Pinecone, ServerlessSpec, Index
import clip

# Load the CLIP model
device = "cuda" if torch.cuda.is_available() else "cpu"
Expand Down
2 changes: 1 addition & 1 deletion phi/document/reader/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from phi.document.reader.base import Reader
from phi.utils.log import logger
import io
from docx import Document as DocxDocument # type: ignore
from docx import Document as DocxDocument


class DocxReader(Reader):
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ module = [
"botocore.*",
"bs4.*",
"chromadb.*",
"clip.*",
"cohere.*",
"crawl4ai.*",
"docker.*",
"docx.*",
"duckdb.*",
"duckduckgo_search.*",
"exa_py.*",
Expand All @@ -122,6 +124,7 @@ module = [
"pandas.*",
"pgvector.*",
"pinecone.*",
"PIL.*",
"psycopg.*",
"psycopg2.*",
"pyarrow.*",
Expand All @@ -139,6 +142,7 @@ module = [
"streamlit.*",
"tavily.*",
"textract.*",
"torch.*",
"timeout_decorator.*",
"vertexai.*",
"voyageai.*",
Expand Down

0 comments on commit 5cdeb87

Please sign in to comment.