Skip to content

Commit

Permalink
Merge pull request #36 from HemanthSai7/main
Browse files Browse the repository at this point in the history
Frontend
  • Loading branch information
HemanthSai7 authored Oct 4, 2023
2 parents 906c9fc + 4d0e945 commit f46f150
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 160 deletions.
Binary file added frontend/images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/images/backend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/images/backendss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed frontend/images/image.png
Binary file not shown.
Binary file added frontend/images/llms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/images/techdocs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
63 changes: 43 additions & 20 deletions frontend/🏡_Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,46 @@
from layouts.mainlayout import mainlayout

@mainlayout
def home_page():

st.markdown(
"""
##### Unleash the documentation dynamo that is **Techdocs**! Say goodbye to the documentation drudgery that haunts coders' dreams and embrace the effortless power of AI-driven documentation. With **Techdocs**, harness the genius of LLama2 🦙, the magic of WizardCoderLM 🧙‍♂️, the versatility of Huggingface Transformers 🤗, and the precision of Langchain 🦜 and Clarifai 🤖.
"""
)

with st.expander("What Can Techdocs Do for You? 🌟",expanded=True):
st.markdown(
"""
- Boost your code quality effortlessly 🚀.
- Effortlessly generate documentation for your code 🤖.
- Include comments, descriptions, parameters, return values, and real-life examples 📃.
- Elevate your code's readability, maintainability, and quality 📃.
#
"""
)

def home():
st.subheader("Code documentation tool that works in your IDE like magic!")

def changestate(*args):
st.session_state[args[0]]=True

tab1, tab2, tab3 = st.tabs(["About our CLI 🪄", "Mechanics 🛠️", "LLMs toolkit 🗃️"])
with tab1:
st.markdown('### <div align="center">:green[Our CLI 🧑‍💻]</div>',unsafe_allow_html=True)
st.markdown('##### <div align="center">:blue[Techdocs CLI] provides a simple and easy to use interface to generate documentation for your :blue[code].</div>',unsafe_allow_html=True)
col1, col3, col2 = st.columns([4,0.1,2])
with col1:
st.image("frontend/images/techdocs.png")
with col2:
st.checkbox("##### User friendly commands\n ✅ Easy to follow commands to generate documentation for your code.",value=True,key="feature1_a",on_change=changestate,args=("feature1_a",))
st.checkbox("##### Your workbench at one place\n ✅ Access all commands within our CLI. No need to search the app.",value=True,key="feature1_b",on_change=changestate,args=("feature1_b",))
st.checkbox("##### Generated documentation will be directly embedded into your functions\n ✅ No need to manually copy paste the documentation.",value=True,key="feature1_c",on_change=changestate,args=("feature1_c",))

with tab2:
st.markdown('## <div align="center">:green[API behind the Scenes ⚙️]</div>',unsafe_allow_html=True)
st.markdown('#### <div align="center">:blue[CLI] uses the power of our API allowing you to access sophisticated :blue[LLM] tools effortlessly. This :blue[microservice] is deployed separately abstracting undelying complexities and providing lightweight web app and CLI </div>',unsafe_allow_html=True)
col1, col3, col2 = st.columns([4,0.1,2])
with col1:
st.image("frontend/images/backendss.png")
with col2:
st.checkbox("##### API uses the magic of FastAPI⚡\n✅ FastAPI is a modern, fast (high-performance), web framework for building APIs with Python.",value=True,key="backend_a",on_change=changestate,args=("backend_a",))
st.checkbox("##### Deployed on Huggingface Spaces 🤗\n✅ Minimal user-percieved latency.",value=True,key="backend_b",on_change=changestate,args=("backend_b",))
st.checkbox("##### Cloud Databases ☁️\n ✅ Powered by Microsoft Azure SQL",value=True,key="backend_c",on_change=changestate,args=("backend_c",))

with tab3:
st.markdown('### <div align="center">:green[Large Language Models 🦙]</div>',unsafe_allow_html=True)
st.markdown('#### <div align="center">Combines the power of Langchain and Clarifai</div>',unsafe_allow_html=True)
col1, col3, col2 = st.columns([4,0.1,2])
with col1:
st.image("frontend/images/llms.png")

with col2:
st.checkbox('##### WizardLM-70B at its core 🧙‍♂️.\n✅ Uses WizardLM-70B LLM as an endpoint provided by Clarifiai.',value=True,key="llm_a",on_change=changestate,args=("llm_a",))
st.checkbox("##### Application developed using Langchain 🦜.\n✅ LangChain is a framework for developing applications powered by language models.", value=True,key="llm_b",on_change=changestate,args=("llm_b",))


st.markdown("## <div align='center'>Techdocs Architecture</div>",unsafe_allow_html=True)
st.image("frontend/images/architecture.png")
48 changes: 0 additions & 48 deletions testing/DBQueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@ class DBQueries:

@classmethod
def insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], cols: List[str]=None):
"""
This method is used to insert data into a specified table in the database.
Args:
table_name (str): The name of the table into which the data will be inserted.
data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.
cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.
Raises:
Exception: If the data type of 'data' is not a tuple or a list of tuples.
Returns:
None
"""
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
con = DBConnection.get_client()
cursor = con.cursor()
QUERY = f"INSERT INTO {{table_name}} ({','.join(cols)}) VALUES ".format(table_name=table_name)
Expand All @@ -39,22 +22,6 @@ def insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], co

@classmethod
def fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, List[str]], where_clause: str=None):
"""
This method fetches data from a specified table in the database based on the specified column(s) and optional WHERE clause.
Args:
table_name (str): The name of the table from which to fetch data.
cols_to_fetch (Union[str, List[str]]): The column(s) to fetch from the table. Can be a single string or a list of strings.
If a single string, it will be treated as a comma-separated list of columns.
where_clause (str, optional): An optional WHERE clause to filter the data. Defaults to None.
Returns:
List[List[str]]: A list of lists, where each inner list represents a row of data fetched from the database.
The order of the columns in the inner lists corresponds to the order specified in the cols_to_fetch parameter.
Raises:
None
"""
con = DBConnection.get_client()
cursor = con.cursor()
if isinstance(cols_to_fetch, str):
Expand All @@ -68,21 +35,6 @@ def fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, Lis

@classmethod
def update_data_in_database(cls, table_name: str, cols_to_update: Union[str, List[str]], where_clause: str=None, new_values: Union[str, List[str]]=None):
"""
This method updates the data in the specified table in the database.
Args:
table_name (str): The name of the table to be updated.
cols_to_update (Union[str, List[str]]): The column(s) to be updated. If a single string, it should end with '=%s'. If a list, it should contain strings representing the column names followed by '=%s'.
where_clause (str, optional): The WHERE clause to specify the conditions for the update. Defaults to None.
new_values (Union[str, List[str]], optional): The new values to be updated in the specified columns. If a single string, it should be a list of values. If a list, it should contain the new values for the columns. Defaults to None.
Returns:
bool: Returns True if the update is successful.
Raises:
Exception: Raises an exception if the database connection fails.
"""
con = DBConnection.get_client()
cursor = con.cursor()
if isinstance(cols_to_update, str):
Expand Down
92 changes: 0 additions & 92 deletions testing/test.py
Original file line number Diff line number Diff line change
@@ -1,110 +1,18 @@
def add(a, b):
"""
This function adds two numbers.
Arguments:
a (int): The first number to be added.
b (int): The second number to be added.
Returns:
int: The sum of the two numbers.
"""
'\n This function adds two numbers.\n\n Arguments:\n a (int): The first number to be added.\n b (int): The second number to be added.\n\n Returns:\n int: The sum of the two numbers.\n '
'\n This function adds two numbers.\n\n Arguments:\n a (int): The first number to be added.\n b (int): The second number to be added.\n\n Returns:\n int: The sum of the two numbers.\n '
return a + b

def multiply(a, b):
"""
This function multiplies two numbers.
Args:
a: A number to be multiplied.
This should be a numeric value (int or float).
b: Another number to be multiplied.
This should be a numeric value (int or float).
Returns:
The product of the two numbers.
This will be a numeric value (int or float), representing the result of the multiplication.
Raises:
None
"""
'\n This function multiplies two numbers.\n\n Args:\n a: A number to be multiplied.\n This should be a numeric value (int or float).\n b: Another number to be multiplied.\n This should be a numeric value (int or float).\n\n Returns:\n The product of the two numbers.\n This will be a numeric value (int or float), representing the result of the multiplication.\n\n Raises:\n None\n\n '
'\n This function multiplies two numbers.\n\n Args:\n a: A number to be multiplied.\n b: Another number to be multiplied.\n\n Returns:\n The product of the two numbers.\n '
return a * b

def subtract(a, b):
"""
Subtracts the second number from the first.
Args:
a (int): The first number to be subtracted.
b (int): The second number to be subtracted from the first.
Returns:
int: The result of the subtraction.
"""
'\n Subtracts the second number from the first.\n\n Args:\n a (int): The first number to be subtracted.\n b (int): The second number to be subtracted from the first.\n\n Returns:\n int: The result of the subtraction.\n '
'\ndef subtract(a, b):\n '
return a - b

def divide(a, b):
"""
This function divides the first argument by the second argument.
Arguments:
a (float): The first number to be divided.
b (float): The second number to be divided.
Raises:
ValueError: If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.
Returns:
float: The result of the division of the first argument by the second argument.
"""
"\n This function divides the first argument by the second argument.\n\n Arguments:\n a (float): The first number to be divided.\n b (float): The second number to be divided.\n\n Raises:\n ValueError: If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.\n\n Returns:\n float: The result of the division of the first argument by the second argument.\n "
"\n This function divides the first argument by the second argument.\n\n Arguments:\n a -- The first number to be divided. It should be of type float.\n b -- The second number to be divided. It should be of type float.\n\n Raises:\n ValueError -- If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.\n\n Returns:\n float -- The result of the division of the first argument by the second argument.\n "
if b == 0:
raise ValueError('Cannot divide by zero')
return a / b

def func(*args, **kwargs):
"""
This function searches for specified terms within the input string using a specified search type.
Parameters:
- input_string (str): The string to search within.
- search_terms (list): A list of strings to search for within the input_string.
- search_type (str, optional): Specifies how the search_terms should be searched within the input_string.
Possible values: 'AND' (all search_terms must be present in the input_string), 'OR' (at least one search_term must be present in the input_string). Default is 'AND'.
Returns:
- search_results (list): A list of all occurrences of the search_terms within the input_string.
Raises:
- ValueError: If the search_type is not 'AND' or 'OR'.
"""
"\nUsage: query(input_string, search_terms, search_type='AND')\n\nThis function searches for specified terms within the input string using a specified search type.\n\nParameters:\n- input_string (str): The string to search within.\n- search_terms (list): A list of strings to search for within the input_string.\n- search_type (str, optional): Specifies how the search_terms should be searched within the input_string.\n Possible values: 'AND' (all search_terms must be present in the input_string), 'OR' (at least one search_term must be present in the input_string). Default is 'AND'.\n\nReturns:\n- search_results (list): A list of all occurrences of the search_terms within the input_string.\n\nRaises:\n- ValueError: If the search_type is not 'AND' or 'OR'.\n"
"\nUsage: func(*args, **kwargs)\n\nThis function returns a wrapper function that calls the original function.\n\nParameters:\n- args (tuple): A tuple of non-keyworded arguments to pass to the function.\n- kwargs (dict): A dictionary of keyworded arguments to pass to the function.\n\nReturns:\n- wrapper (function): A new function that calls the original function with the given arguments.\n\nRaises:\n- TypeError: If the arguments passed to the wrapper function do not match the original function's signature.\n"

def wrapper(*args, **kwargs):
"""
This function acts as a wrapper for another function, allowing it to be called with a variety of arguments.
Arguments:
*args (list): any number of positional arguments (default: None)
**kwargs (dict): any number of keyword arguments (default: None)
Returns:
Whatever the wrapped function returns (default: None)
Raises:
Whatever exceptions the wrapped function raises (default: None)
TypeError: If any argument is not of the expected type.
"""
'\n This function performs a specific operation on the given arguments.\n\n Arguments:\n arg1 -- a string argument (default: None)\n arg2 -- an integer argument (default: None)\n arg3 -- a floating point number argument (default: None)\n arg4 -- a boolean argument (default: None)\n\n Returns:\n None\n\n Raises:\n TypeError -- If any argument is not of the expected type.\n '
'\n This function acts as a wrapper for another function, allowing it to be called with a variety of arguments.\n\n Arguments:\n *args -- any number of positional arguments (default: None)\n **kwargs -- any number of keyword arguments (default: None)\n\n Returns:\n Whatever the wrapped function returns (default: None)\n\n Raises:\n Whatever exceptions the wrapped function raises (default: None)\n '
return func(*args, **kwargs)
return wrapper

0 comments on commit f46f150

Please sign in to comment.