venkat-srinivasan-nexusflow commited on
Commit
be77238
1 Parent(s): 7d6e8c5

Update langdemo.py

Browse files

Update prompting in the langchain demo to follow the V2 convention.

Files changed (1) hide show
  1. langdemo.py +5 -4
langdemo.py CHANGED
@@ -69,9 +69,10 @@ def cylinder_volume(radius, height):
69
 
70
  RAVEN_PROMPT = """
71
  {raven_tools}
72
- User Query: Question: {input}
 
 
73
 
74
- Please pick a function from the above options that best answers the user query and fill in the appropriate arguments.<human_end>"""
75
 
76
 
77
  # Set up a prompt template
@@ -82,10 +83,10 @@ class RavenPromptTemplate(StringPromptTemplate):
82
  tools: List[Tool]
83
 
84
  def format(self, **kwargs) -> str:
85
- prompt = "<human>:\n"
86
  for tool in self.tools:
87
  func_signature, func_docstring = tool.description.split(" - ", 1)
88
- prompt += f'\nOPTION:\n<func_start>def {func_signature}<func_end>\n<docstring_start>\n"""\n{func_docstring}\n"""\n<docstring_end>\n'
89
  kwargs["raven_tools"] = prompt
90
  return self.template.format(**kwargs).replace("{{", "{").replace("}}", "}")
91
 
 
69
 
70
  RAVEN_PROMPT = """
71
  {raven_tools}
72
+ User Query: {input}<human_end>
73
+
74
+ """
75
 
 
76
 
77
 
78
  # Set up a prompt template
 
83
  tools: List[Tool]
84
 
85
  def format(self, **kwargs) -> str:
86
+ prompt = ""
87
  for tool in self.tools:
88
  func_signature, func_docstring = tool.description.split(" - ", 1)
89
+ prompt += f'\nFunction:\ndef {func_signature}\n"""\n{func_docstring}\n"""\n'
90
  kwargs["raven_tools"] = prompt
91
  return self.template.format(**kwargs).replace("{{", "{").replace("}}", "}")
92