Spaces:
Runtime error
Runtime error
File size: 1,379 Bytes
000213d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
from langchain.schema import SystemMessage
from langchain.prompts.chat import ChatPromptTemplate, HumanMessagePromptTemplate
determine_modifications_prompt = ChatPromptTemplate(
input_variables=["code"],
messages=[
SystemMessage(
content="The user will input some code and you will need to determine if the code makes any changes to the file system. \n"
"With changes it means creating new files or modifying exsisting ones.\n"
"Answer with a function call `determine_modifications` and list them inside.\n"
"If the code does not make any changes to the file system, still answer with the function call but return an empty list.\n",
),
HumanMessagePromptTemplate.from_template("{code}"),
],
)
determine_modifications_function = {
"name": "determine_modifications",
"description": "Based on code of the user determine if the code makes any changes to the file system. \n"
"With changes it means creating new files or modifying exsisting ones.\n",
"parameters": {
"type": "object",
"properties": {
"modifications": {
"type": "array",
"items": {"type": "string"},
"description": "The filenames that are modified by the code.",
},
},
"required": ["modifications"],
},
}
|