Skip to content

Commit

Permalink
Merge pull request #2 from oxylabs/remove-cached-file
Browse files Browse the repository at this point in the history
remove cached file
  • Loading branch information
oxytadasgedgaudas authored Mar 13, 2024
2 parents 861c38e + 4ca092c commit 3bf623f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion _oxyparser_cache_oxylabs

This file was deleted.

4 changes: 2 additions & 2 deletions oxyparser/ai/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import time

import structlog
from litellm import acompletion
from openai import BadRequestError, RateLimitError
from tenacity import retry, stop_after_attempt, wait_exponential
from litellm import acompletion

from oxyparser.settings import settings

Expand All @@ -20,7 +20,7 @@
def extract_json_from_ai_response(response: str) -> dict[str, str]:
pattern = r"{(.*?)}"
matched_items = re.findall(pattern, response, re.DOTALL)
item = f"".join(matched_items)
item = "".join(matched_items)
return json.loads(f"{{{item}}}") if item else {}


Expand Down
3 changes: 2 additions & 1 deletion oxyparser/cache/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Literal

from oxyparser.cache.base import BaseCache
from oxyparser.cache.file import FileCache
from oxyparser.cache.redis import RedisCache


def get_cache(cache_type: Literal["file", "redis"] | None) -> FileCache | RedisCache | None:
def get_cache(cache_type: Literal["file", "redis"] | None) -> BaseCache:
mapping = {"file": FileCache, "redis": RedisCache}

cache_cls = mapping.get(str(cache_type))
Expand Down
2 changes: 1 addition & 1 deletion oxyparser/oxyparser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Type, Literal
from typing import Any, Literal, Type

import structlog
from pydantic import BaseModel, ValidationError
Expand Down

0 comments on commit 3bf623f

Please sign in to comment.