agent-factory: generate agent auto-retrieve-files-from-a-reposito

This commit is contained in:
2026-04-13 20:01:50 +00:00
parent 940e2a5b80
commit b273901039

View File

@@ -2,6 +2,13 @@ async def process(state: dict) -> dict:
""" """
This node retrieves files from a repository based on the provided URL and update scope. This node retrieves files from a repository based on the provided URL and update scope.
It uses an LLM to analyze and extract relevant workflow files from the repository. It uses an LLM to analyze and extract relevant workflow files from the repository.
Input Schema:
- repository_url: The URL of the repository to retrieve files from.
- update_scope: The scope or context for the update (e.g., branch, directory).
Output Schema:
- workflow_files: A list of workflow file names retrieved from the repository.
""" """
from app.agent import llm from app.agent import llm
from langchain_core.messages import SystemMessage, HumanMessage from langchain_core.messages import SystemMessage, HumanMessage
@@ -15,11 +22,11 @@ async def process(state: dict) -> dict:
messages = [ messages = [
SystemMessage(content="You are an assistant that retrieves workflow files from a repository."), SystemMessage(content="You are an assistant that retrieves workflow files from a repository."),
HumanMessage(content=f"Repository URL: {repository_url}\nUpdate Scope: {update_scope}") HumanMessage(content=f"Retrieve workflow files from the repository at {repository_url} within the scope '{update_scope}'.")
] ]
response = await llm.ainvoke(messages) response = await llm.ainvoke(messages)
workflow_files = response.content.splitlines() # Assuming the LLM returns file names as newline-separated strings. workflow_files = response.content.splitlines() # Assuming the response lists files line by line.
return {"workflow_files": workflow_files, "phase": "complete"} return {"workflow_files": workflow_files, "phase": "complete"}
except Exception as exc: except Exception as exc: