-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ak/finetuning-module
- Loading branch information
Showing
15 changed files
with
603 additions
and
63 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
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,42 @@ | ||
# pylint: disable=missing-return-doc, missing-param-doc, missing-function-docstring | ||
from typing import List | ||
|
||
from sqlalchemy import create_engine | ||
from sqlalchemy.ext.automap import automap_base | ||
|
||
from dbally.views.freeform.text2sql import BaseText2SQLView, ColumnConfig, TableConfig | ||
|
||
engine = create_engine("sqlite:///examples/recruiting/data/candidates.db") | ||
|
||
_Base = automap_base() | ||
_Base.prepare(autoload_with=engine) | ||
_Candidate = _Base.classes.candidates | ||
|
||
|
||
class CandidateFreeformView(BaseText2SQLView): | ||
""" | ||
A view for retrieving candidates from the database. | ||
""" | ||
|
||
def get_tables(self) -> List[TableConfig]: | ||
""" | ||
Get the tables used by the view. | ||
Returns: | ||
A list of tables. | ||
""" | ||
return [ | ||
TableConfig( | ||
name="candidates", | ||
columns=[ | ||
ColumnConfig("name", "TEXT"), | ||
ColumnConfig("country", "TEXT"), | ||
ColumnConfig("years_of_experience", "INTEGER"), | ||
ColumnConfig("position", "TEXT"), | ||
ColumnConfig("university", "TEXT"), | ||
ColumnConfig("skills", "TEXT"), | ||
ColumnConfig("tags", "TEXT"), | ||
ColumnConfig("id", "INTEGER PRIMARY KEY"), | ||
], | ||
), | ||
] |
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,36 @@ | ||
# pylint: disable=missing-function-docstring | ||
import asyncio | ||
|
||
from recruiting import candidate_view_with_similarity_store, candidates_freeform | ||
from recruiting.candidate_view_with_similarity_store import CandidateView | ||
from recruiting.candidates_freeform import CandidateFreeformView | ||
from recruiting.cypher_text2sql_view import SampleText2SQLViewCyphers, create_freeform_memory_engine | ||
from recruiting.db import ENGINE as recruiting_engine | ||
from recruiting.views import RecruitmentView | ||
|
||
import dbally | ||
from dbally.audit import CLIEventHandler, OtelEventHandler | ||
from dbally.gradio import create_gradio_interface | ||
from dbally.llms.litellm import LiteLLM | ||
|
||
|
||
async def main(): | ||
llm = LiteLLM(model_name="gpt-3.5-turbo") | ||
user_collection = dbally.create_collection("candidates", llm) | ||
user_collection.add(CandidateView, lambda: CandidateView(candidate_view_with_similarity_store.engine)) | ||
user_collection.add(SampleText2SQLViewCyphers, lambda: SampleText2SQLViewCyphers(create_freeform_memory_engine())) | ||
|
||
fallback_collection = dbally.create_collection("freeform candidates", llm, event_handlers=[OtelEventHandler()]) | ||
fallback_collection.add(CandidateFreeformView, lambda: CandidateFreeformView(candidates_freeform.engine)) | ||
|
||
second_fallback_collection = dbally.create_collection("recruitment", llm, event_handlers=[CLIEventHandler()]) | ||
second_fallback_collection.add(RecruitmentView, lambda: RecruitmentView(recruiting_engine)) | ||
|
||
user_collection.set_fallback(fallback_collection).set_fallback(second_fallback_collection) | ||
|
||
gradio_interface = await create_gradio_interface(user_collection=user_collection) | ||
gradio_interface.launch() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
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,3 +1,3 @@ | ||
"""Version information.""" | ||
|
||
__version__ = "0.4.0" | ||
__version__ = "0.5.0" |
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
Oops, something went wrong.