Skip to content

Commit

Permalink
Move JsonSerializable to seperate module
Browse files Browse the repository at this point in the history
  • Loading branch information
volkerstampa committed Nov 23, 2023
1 parent 4e388a4 commit 8653e8d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/examples/quickstart_task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@
"metadata": {},
"outputs": [],
"source": [
"# this will give us the debug log of the last example that was run\n",
"from pprint import pprint\n",
"\n",
"from intelligence_layer.core.evaluator import ExampleResult\n",
Expand Down
1 change: 1 addition & 0 deletions src/intelligence_layer/connectors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .base.json_serializable import JsonSerializable as JsonSerializable
from .document_index.document_index import (
ConstraintViolation,
DocumentContents,
Expand Down
25 changes: 25 additions & 0 deletions src/intelligence_layer/connectors/base/json_serializable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from typing import TYPE_CHECKING, Mapping, Sequence

from typing_extensions import TypeAliasType

if TYPE_CHECKING:
JsonSerializable = (
int
| float
| str
| None
| bool
| Sequence["JsonSerializable"]
| Mapping[str, "JsonSerializable"]
)
else:
JsonSerializable = TypeAliasType(
"JsonSerializable",
int
| float
| str
| None
| bool
| Sequence["JsonSerializable"]
| Mapping[str, "JsonSerializable"],
)
27 changes: 3 additions & 24 deletions src/intelligence_layer/connectors/document_index/document_index.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
from datetime import datetime
from http import HTTPStatus
from json import dumps
from typing import TYPE_CHECKING, Any, Mapping, Sequence
from typing import Any, Mapping, Sequence

import requests
from pydantic import BaseModel, Field
from requests import HTTPError
from typing_extensions import TypeAliasType

if TYPE_CHECKING:
JsonSerializable = (
int
| float
| str
| None
| bool
| Sequence["JsonSerializable"]
| Mapping[str, "JsonSerializable"]
)
else:
JsonSerializable = TypeAliasType(
"JsonSerializable",
int
| float
| str
| None
| bool
| Sequence["JsonSerializable"]
| Mapping[str, "JsonSerializable"],
)

from intelligence_layer.connectors.base.json_serializable import JsonSerializable


class DocumentContents(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion src/intelligence_layer/core/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from rich.tree import Tree
from tqdm import tqdm

from intelligence_layer.connectors.document_index.document_index import JsonSerializable
from intelligence_layer.connectors import JsonSerializable
from intelligence_layer.core.task import Input, Output, Task
from intelligence_layer.core.tracer import (
InMemorySpan,
Expand Down

0 comments on commit 8653e8d

Please sign in to comment.