With code
This commit is contained in:
4
auto_classes.json
Normal file
4
auto_classes.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"AutoConfig": "src.agent.ClaudeCodeConfig",
|
||||||
|
"AutoProgram": "src.agent.ClaudeCodeAgent"
|
||||||
|
}
|
||||||
3
config.json
Normal file
3
config.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"model": "claude-3-5-sonnet-20241022"
|
||||||
|
}
|
||||||
9
main.py
Normal file
9
main.py
Normal 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
9
program.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"dependency_versions": {
|
||||||
|
"python": "3.13",
|
||||||
|
"dspy": "3.0.4",
|
||||||
|
"cloudpickle": "3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
pyproject.toml
Normal file
7
pyproject.toml
Normal 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
19
src/agent.py
Normal 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}")
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user