Skip to content

Commit

Permalink
lint all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelklehr committed Jan 17, 2024
1 parent 273a644 commit ff3dfb4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 33 deletions.
9 changes: 4 additions & 5 deletions lib/chains.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Registers all chains based on the models/ directory contents
"""Registers all chains based on the models/ directory contents
"""

import os
Expand Down Expand Up @@ -34,9 +33,9 @@ def generate_llm_generator(path):


def generate_chains(model_name, model):
chains[model_name + ":summarize"] = lambda: SummarizeChain(llm=model())
chains[model_name + ":simplify"] = lambda: SimplifyChain(llm=model())
chains[model_name + ":formalize"] = lambda: FormalizeChain(llm=model())
chains[model_name + ":summary"] = lambda: SummarizeChain(llm=model())
#chains[model_name + ":simplify"] = lambda: SimplifyChain(llm=model())
#chains[model_name + ":formalize"] = lambda: FormalizeChain(llm=model())
chains[model_name + ":headline"] = lambda: HeadlineChain(llm=model())
chains[model_name + ":topics"] = lambda: TopicsChain(llm=model())
chains[model_name + ":free_prompt"] = lambda: FreePromptChain(llm=model())
Expand Down
6 changes: 2 additions & 4 deletions lib/formalize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A langchain chain to formalize text
"""A langchain chain to formalize text
"""

from typing import Any, Optional
Expand All @@ -14,8 +13,7 @@


class FormalizeChain(Chain):
"""
A formalize chain
"""A formalize chain
"""

prompt: BasePromptTemplate = PromptTemplate(
Expand Down
6 changes: 2 additions & 4 deletions lib/free_prompt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A free rpompt chain
"""A free rpompt chain
"""

from typing import Any, Optional
Expand All @@ -12,8 +11,7 @@


class FreePromptChain(Chain):
"""
A free prompt chain
"""A free prompt chain
"""

llm: BaseLanguageModel
Expand Down
6 changes: 2 additions & 4 deletions lib/headline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A chain to generate a headline for a text
"""A chain to generate a headline for a text
"""

from typing import Any, Optional
Expand All @@ -13,8 +12,7 @@


class HeadlineChain(Chain):
"""
A headline chain
"""A headline chain
"""

prompt: BasePromptTemplate = PromptTemplate(
Expand Down
7 changes: 3 additions & 4 deletions lib/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Tha main module of the llm2 app
"""Tha main module of the llm2 app
"""

import queue
Expand All @@ -12,7 +11,7 @@
from chains import chains
from fastapi import Depends, FastAPI, responses
from nc_py_api import AsyncNextcloudApp, NextcloudApp
from nc_py_api.ex_app import LogLvl, anc_app
from nc_py_api.ex_app import LogLvl, anc_app, run_app, set_handlers


@asynccontextmanager
Expand Down Expand Up @@ -85,7 +84,7 @@ async def enabled_handler(enabled: bool, nc: AsyncNextcloudApp) -> str:
for chain_name, _ in chains.items():
(model, task) = chain_name.split(":", 2)
await nc.providers.text_processing.register(
model, "Local Large language Model: " + model, "/chain/" + chain_name, task
"llm2:"+chain_name, "Local Large language Model: " + model, "/chain/" + chain_name, task
)
else:
for chain_name, chain in chains.items():
Expand Down
6 changes: 2 additions & 4 deletions lib/simplify.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A simplify chain
"""A simplify chain
"""

from typing import Any, Optional
Expand All @@ -14,8 +13,7 @@


class SimplifyChain(Chain):
"""
A summarization chain
"""A summarization chain
"""

prompt: BasePromptTemplate = PromptTemplate(
Expand Down
6 changes: 2 additions & 4 deletions lib/summarize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A recursive summarize chain
"""A recursive summarize chain
"""

from typing import Any, Optional
Expand All @@ -14,8 +13,7 @@


class SummarizeChain(Chain):
"""
A summarization chain
"""A summarization chain
"""

prompt: BasePromptTemplate = PromptTemplate(
Expand Down
6 changes: 2 additions & 4 deletions lib/topics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
A chain that extracts topcis from a text
"""A chain that extracts topcis from a text
"""

from typing import Any, Optional
Expand All @@ -13,8 +12,7 @@


class TopicsChain(Chain):
"""
A topics chain
"""A topics chain
"""

prompt: BasePromptTemplate = PromptTemplate(
Expand Down

0 comments on commit ff3dfb4

Please sign in to comment.