From 604479613b3a502e18c06741a19b2f26c5c04846 Mon Sep 17 00:00:00 2001 From: Ty Todd Date: Sat, 20 Dec 2025 17:25:13 -0800 Subject: [PATCH] (no commit message) --- README.md | 2 -- __init__.py | 0 auto_classes.json | 4 ++++ config.json | 3 +++ program.json | 28 ++++++++++++++++++++++++++++ pyproject.toml | 7 +++++++ summarizer.py | 11 +++++++++++ 7 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 __init__.py create mode 100644 auto_classes.json create mode 100644 config.json create mode 100644 program.json create mode 100644 pyproject.toml create mode 100644 summarizer.py diff --git a/README.md b/README.md index bf9576a..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,2 +0,0 @@ -# summarizer - diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/auto_classes.json b/auto_classes.json new file mode 100644 index 0000000..1d1919a --- /dev/null +++ b/auto_classes.json @@ -0,0 +1,4 @@ +{ + "AutoConfig": "modaic.PrecompiledConfig", + "AutoProgram": "summarizer.Summarizer" +} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..4475ebc --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "model": null +} \ No newline at end of file diff --git a/program.json b/program.json new file mode 100644 index 0000000..2eabb8c --- /dev/null +++ b/program.json @@ -0,0 +1,28 @@ +{ + "predict": { + "traces": [], + "train": [], + "demos": [], + "signature": { + "instructions": "Given the fields `input`, produce the fields `summary`.", + "fields": [ + { + "prefix": "Input:", + "description": "${input}" + }, + { + "prefix": "Summary:", + "description": "${summary}" + } + ] + }, + "lm": null + }, + "metadata": { + "dependency_versions": { + "python": "3.11", + "dspy": "3.0.4", + "cloudpickle": "3.1" + } + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..564e97b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[project] +name = "summarizer" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.11" +dependencies = ["dspy>=3.0.4", "ipykernel>=7.1.0", "langfuse>=3.11.1", "modaic>=0.8.1", "modal>=1.3.0.post1", "openinference-instrumentation>=0.1.42", "openinference-instrumentation-dspy>=0.1.32"] diff --git a/summarizer.py b/summarizer.py new file mode 100644 index 0000000..4c10a3d --- /dev/null +++ b/summarizer.py @@ -0,0 +1,11 @@ +from modaic import PrecompiledProgram +import dspy + + +class Summarizer(PrecompiledProgram): + def __init__(self, **kwargs): + self.predict = dspy.Predict("input -> summary") + super().__init__(**kwargs) + + def forward(self, input: str) -> str: + return self.predict(input=input)