-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Mirascope/track-calls
Track calls
- Loading branch information
Showing
11 changed files
with
110 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
"""This module initializes the models package.""" | ||
|
||
from .base_sql_model import BaseSQLModel | ||
from .calls import CallTable | ||
from .projects import ProjectTable | ||
from .prompt_versions import PromptVersionTable | ||
|
||
__all__ = ["BaseSQLModel", "ProjectTable", "PromptVersionTable"] | ||
__all__ = ["BaseSQLModel", "CallTable", "ProjectTable", "PromptVersionTable"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Project model""" | ||
|
||
import datetime | ||
from typing import TYPE_CHECKING | ||
|
||
from sqlmodel import Field, Relationship | ||
|
||
from lilypad.app.models import BaseSQLModel | ||
|
||
from .table_names import CALL_TABLE_NAME, PROMPT_VERSION_TABLE_NAME | ||
|
||
if TYPE_CHECKING: | ||
from lilypad.app.models import PromptVersionTable | ||
|
||
|
||
class CallTable(BaseSQLModel, table=True): | ||
"""Call model""" | ||
|
||
__tablename__ = CALL_TABLE_NAME # type: ignore | ||
|
||
id: int = Field(default=None, primary_key=True) | ||
prompt_version_id: int = Field( | ||
default=None, foreign_key=f"{PROMPT_VERSION_TABLE_NAME}.id" | ||
) | ||
input: str = Field(nullable=False) | ||
output: str = Field(nullable=False) | ||
created_at: datetime.datetime = Field( | ||
default=datetime.datetime.now(datetime.UTC), nullable=False | ||
) | ||
prompt_version: "PromptVersionTable" = Relationship(back_populates="calls") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
PROJECT_TABLE_NAME = "projects" | ||
PROMPT_VERSION_TABLE_NAME = "prompt_versions" | ||
CALL_TABLE_NAME = "calls" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.