forked from cohere-ai/cohere-toolkit
-
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 branch 'cohere-ai:main' into integration
- Loading branch information
Showing
40 changed files
with
751 additions
and
316 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
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 |
---|---|---|
|
@@ -35,4 +35,4 @@ first-run: | |
win-first-run: | ||
make win-setup | ||
make migrate | ||
make dev | ||
make dev |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""empty message | ||
Revision ID: 28763d200b29 | ||
Revises: a9b07acef4e8 | ||
Create Date: 2024-06-10 20:32:41.903400 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "28763d200b29" | ||
down_revision: Union[str, None] = "a9b07acef4e8" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"blacklist", | ||
sa.Column("token_id", sa.String(), nullable=False), | ||
sa.Column("id", sa.String(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(), nullable=True), | ||
sa.Column("updated_at", sa.DateTime(), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_index("blacklist_token_id", "blacklist", ["token_id"], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index("blacklist_token_id", table_name="blacklist") | ||
op.drop_table("blacklist") | ||
# ### end Alembic commands ### |
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,49 @@ | ||
"""empty message | ||
Revision ID: 922e874930bf | ||
Revises: 28763d200b29 | ||
Create Date: 2024-06-12 21:19:12.204875 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "922e874930bf" | ||
down_revision: Union[str, None] = "28763d200b29" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"agents", | ||
sa.Column( | ||
"tools", | ||
postgresql.ARRAY( | ||
sa.Enum( | ||
"Wiki_Retriever_LangChain", | ||
"Search_File", | ||
"Read_File", | ||
"Python_Interpreter", | ||
"Calculator", | ||
"Tavily_Internet_Search", | ||
name="toolname", | ||
native_enum=False, | ||
) | ||
), | ||
nullable=False, | ||
), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("agents", "tools") | ||
# ### end Alembic commands ### |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from sqlalchemy.orm import Session | ||
|
||
from backend.database_models.blacklist import Blacklist | ||
|
||
|
||
def create_blacklist(db: Session, blacklist: Blacklist) -> Blacklist: | ||
""" " | ||
Create a blacklist token. | ||
Args: | ||
db (Session): Database session. | ||
blacklist (Blacklist): Blacklist data to be created. | ||
Returns: | ||
Blacklist: Created blacklist. | ||
""" | ||
db.add(blacklist) | ||
db.commit() | ||
db.refresh(blacklist) | ||
return blacklist | ||
|
||
|
||
def get_blacklist(db: Session, token_id: str) -> Blacklist: | ||
""" | ||
Get a blacklist token by token_id column. | ||
Args: | ||
db (Session): Database session. | ||
token_id (str): Token ID. | ||
Returns: | ||
Blacklist: Blacklist with the given token_id. | ||
""" | ||
return db.query(Blacklist).filter(Blacklist.token_id == token_id).first() |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from sqlalchemy import Index, String | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
|
||
from backend.database_models.base import Base | ||
|
||
|
||
class Blacklist(Base): | ||
""" | ||
Table that contains the list of JWT access tokens that are blacklisted during logout. | ||
""" | ||
|
||
__tablename__ = "blacklist" | ||
|
||
token_id: Mapped[str] = mapped_column(String) | ||
|
||
__table_args__ = (Index("blacklist_token_id", token_id),) |
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
Empty file.
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
Oops, something went wrong.