-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
87 additions
and
153 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
|
||
from typing import List | ||
import dspy | ||
from data_models.dspy.dspy_unoplat_package_summary import DspyUnoplatPackageSummary | ||
|
||
|
||
|
||
class CodeConfluenceCodebaseSignature(dspy.Signature): | ||
"""This signature takes in existing summary of a codebase and package objective of a package one at a time to keep improving final package summary""" | ||
codebase_existing_summary: str = dspy.InputField(default="package existing summary:",desc="This will contain existing package summary") | ||
"""This signature takes in existing summary of a codebase and package summary of a package one at a time and returns final_codebase_summary as enhanced final summary of codebase""" | ||
codebase_existing_summary: str = dspy.InputField(default="codebase existing summary:",desc="This will contain existing codebase summary") | ||
package_objective: str = dspy.InputField(desc="This will contain current package objective based on which existing codebase summary has to be improved") | ||
final_codebase_summary: str = dspy.OutputField(desc="This will contain improved concise codebase summary") | ||
final_codebase_summary: str = dspy.OutputField(desc="This will contain final improved concise codebase summary") | ||
|
||
|
||
class CodeConfluenceCodebaseObjectiveSignature(dspy.Signature): | ||
"""This signature takes in package summary and returns concise objective of the package""" | ||
final_package_summary: str = dspy.InputField(desc="This will contain concise detailed implementation summary of the package") | ||
package_objective: str = dspy.OutputField(desc="This will contain concise objective of the package based on package summary") | ||
"""This signature takes in codebase summary and returns codebase_objective as concise objective of the codebase""" | ||
final_codebase_summary: str = dspy.InputField(desc="This will contain concise detailed implementation summary of the codebase") | ||
codebase_objective: str = dspy.OutputField(desc="This will contain concise objective of the codebase based on detailed codebase summary") | ||
|
||
class CodeConfluencePackageModule(dspy.Module): | ||
class CodeConfluenceCodebaseModule(dspy.Module): | ||
def __init__(self): | ||
super().__init__() | ||
self.generate_package_summary = dspy.ChainOfThought(CodeConfluenceCodebaseSignature) | ||
self.generate_package_objective = dspy.ChainOfThought(CodeConfluenceCodebaseObjectiveSignature) | ||
self.generate_codebase_summary = dspy.ChainOfThought(CodeConfluenceCodebaseSignature) | ||
self.generate_codebase_objective = dspy.ChainOfThought(CodeConfluenceCodebaseObjectiveSignature) | ||
|
||
|
||
def forward(self, class_objective_list: List[DspyUnoplatNodeSummary]): | ||
package_summary = "" | ||
for class_objective in class_objective_list: | ||
signature_package_summary: CodeConfluencePackageSignature = self.generate_package_summary(package_existing_summary=package_summary, class_objective=class_objective.node_objective) | ||
package_summary = signature_package_summary.final_package_summary | ||
def forward(self, package_objective_list: List[DspyUnoplatPackageSummary]): | ||
codebase_summary = "" | ||
for package_objective in package_objective_list: | ||
signature_package_summary: CodeConfluenceCodebaseSignature = self.generate_codebase_summary(codebase_existing_summary=codebase_summary, package_objective=package_objective.package_objective) | ||
codebase_summary = signature_package_summary.final_codebase_summary | ||
print(codebase_summary) | ||
|
||
class_objective_signature: CodeConfluencePackageObjectiveSignature = self.generate_package_objective(final_package_summary=package_summary) | ||
dspy_package_summary = DspyUnoplatPackageNodeSummary(package_objective=class_objective_signature.package_objective,package_summary=package_summary,class_summary=class_objective_list) | ||
return dspy_package_summary | ||
codebase_objective_signature: CodeConfluenceCodebaseObjectiveSignature = self.generate_codebase_objective(final_codebase_summary=codebase_summary) | ||
|
||
|
||
return dspy.Prediction(answer=codebase_objective_signature.codebase_objective,summary=signature_package_summary.final_codebase_summary) | ||
|
||
|
||
|
||
|
||
|
||
|
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.