With code

This commit is contained in:
2025-12-04 15:28:21 -05:00
parent 647b4585af
commit 9b0337d1b8
7 changed files with 51 additions and 2 deletions

View File

@@ -1,2 +0,0 @@
# claude-code

4
auto_classes.json Normal file
View File

@@ -0,0 +1,4 @@
{
"AutoConfig": "src.agent.ClaudeCodeConfig",
"AutoProgram": "src.agent.ClaudeCodeAgent"
}

3
config.json Normal file
View File

@@ -0,0 +1,3 @@
{
"model": "claude-3-5-sonnet-20241022"
}

9
main.py Normal file
View File

@@ -0,0 +1,9 @@
from src.agent import ClaudeCodeConfig, ClaudeCodeAgent
config = ClaudeCodeConfig()
agent = ClaudeCodeAgent(config)
if __name__ == "__main__":
result = agent("Implement a todo list application")
agent.push_to_hub("farouk1/claude-code", with_code=True, commit_message="With code")
print(result)

9
program.json Normal file
View File

@@ -0,0 +1,9 @@
{
"metadata": {
"dependency_versions": {
"python": "3.13",
"dspy": "3.0.4",
"cloudpickle": "3.1"
}
}
}

7
pyproject.toml Normal file
View File

@@ -0,0 +1,7 @@
[project]
name = "claude-code"
version = "0.1.0"
description = "Claude Code SDK wrapped in a DSPy module"
readme = "README.md"
requires-python = ">=3.13"
dependencies = ["claude-agent-sdk>=0.1.12", "dspy>=3.0.4", "modaic>=0.7.0"]

19
src/agent.py Normal file
View File

@@ -0,0 +1,19 @@
from modaic import PrecompiledProgram, PrecompiledConfig
from dspy.primitives.prediction import Prediction
class ClaudeCodeConfig(PrecompiledConfig):
model: str = "claude-3-5-sonnet-20241022"
class ClaudeCodeAgent(PrecompiledProgram):
config: ClaudeCodeConfig
def __init__(self, config: ClaudeCodeConfig):
super().__init__(config=config)
self.model = config.model
def forward(self, task: str) -> Prediction:
# TODO: Implement the actual agent logic using self.model
# This is a placeholder - actual implementation would use the model to process the task
return Prediction(output=f"Processed task: {task} using model {self.model}")