Skip to content

Commit f2849fc

Browse files
authored
Merge pull request #2419 from hlohaus/arm3
Fix import Annotated typing
2 parents 73997bc + 8153668 commit f2849fc

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/publish-workflow.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: Set up Python 3.8
13+
- name: Set up Python 3.13
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: "3.8"
16+
python-version: "3.13"
1717
cache: 'pip'
1818
- name: Install requirements
1919
run: |

g4f/api/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
from fastapi.middleware.cors import CORSMiddleware
2828
from starlette.responses import FileResponse
2929
from pydantic import BaseModel, Field
30-
from typing import Union, Optional, List, Annotated
30+
from typing import Union, Optional, List
31+
try:
32+
from typing import Annotated
33+
except ImportError:
34+
class Annotated:
35+
pass
3136

3237
import g4f
3338
import g4f.debug
@@ -456,8 +461,6 @@ async def get_image(filename):
456461

457462
return FileResponse(target, media_type=content_type)
458463

459-
460-
461464
def format_exception(e: Union[Exception, str], config: Union[ChatCompletionsConfig, ImageGenerationConfig] = None, image: bool = False) -> str:
462465
last_provider = {} if not image else g4f.get_last_provider(True)
463466
provider = (AppConfig.image_provider if image else AppConfig.provider)

0 commit comments

Comments
 (0)