move connect debug prints
This commit is contained in:
47
main.py
Normal file
47
main.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from claude_dspy import ClaudeCode, ClaudeCodeConfig
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Literal
|
||||
from modaic import AutoProgram
|
||||
import dspy
|
||||
|
||||
class AffectedFile(BaseModel):
|
||||
file_name: str = Field(..., description="Name of the file")
|
||||
action: Literal["created", "updated", "deleted", "renamed"] = Field(..., description="Action taken on the file")
|
||||
|
||||
|
||||
class OutputResult(BaseModel):
|
||||
success: bool = Field(..., description="Whether or not execution of the query was successful")
|
||||
message: str = Field(..., description="Message")
|
||||
affected_files: list[AffectedFile] = Field(..., description="List of files affected by the query")
|
||||
|
||||
|
||||
class ClaudeCodeSignature(dspy.Signature):
|
||||
query: str = dspy.InputField(desc="Query to process")
|
||||
output: OutputResult = dspy.OutputField(desc="Result of the query")
|
||||
|
||||
|
||||
def main():
|
||||
# create config
|
||||
config = ClaudeCodeConfig()
|
||||
|
||||
# create agent
|
||||
cc = ClaudeCode(
|
||||
config,
|
||||
signature=ClaudeCodeSignature,
|
||||
working_directory=".",
|
||||
permission_mode="acceptEdits",
|
||||
allowed_tools=["Read", "Write", "Bash"],
|
||||
)
|
||||
result = cc(query="list the files in this directory")
|
||||
output = result.output
|
||||
print(output)
|
||||
|
||||
cc.push_to_hub(
|
||||
"modaic/claude-code",
|
||||
with_code=True,
|
||||
commit_message="move connect debug prints",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user