microsoft / prompty

Prompty makes it easy to create, manage, debug, and evaluate LLM prompts for your AI applications. Prompty is an asset class and format for LLM prompts designed to enhance observability, understandability, and portability for developers.
https://prompty.ai
MIT License
148 stars 9 forks source link

"Right-click on a .prompty file to quickly generate integration snippets" is not working. #12

Open 55yoko opened 1 month ago

55yoko commented 1 month ago

I right-clicked on the prompty file in Vscode and selected "Add prompt flow Code", but the file was not created. The Semantic kernel and Langchain were also not created. This is screen capture.

Visual Studio Code:Version: 1.89.1 OS:mac Sonoma 14.5(23F79) Prompty: v0.1.2024053008

sethjuarez commented 1 month ago

Uh oh! We will take a look. Thanks for the flag.

wayliums commented 1 month ago

@55yoko can you share the prompty file here?

55yoko commented 1 month ago

@wayliums

This is a file that I just made this from right click and select "New prompty" , then I changed only azure_endpoint and azure_deployment.

`--- name: ExamplePrompt description: A prompt that uses context to ground an incoming question authors:

system: You are an AI assistant who helps people find information. As the assistant, you answer questions briefly, succinctly, and in a personable manner using markdown and even add some personal flair with appropriate emojis.

Customer

You are helping {{firstName}} to find answers to their questions. Use their name to address them in your responses.

Context

Use the following context to provide a more personalized response to {{firstName}}: {{context}}

user: {{question}} `

wayliums commented 1 month ago

@55yoko can you enable dev tools in VSCode, and see if there's any errors? image

And meanwhile, to unblock you, this is the PF code generated

import json

from pathlib import Path
folder = Path(__file__).parent.absolute().as_posix()

from promptflow.core import tool, Prompty

@tool
def flow_entry(    
      firstName: any,
      context: any,
      question: any
) -> str:
  # path to prompty (requires absolute path for deployment)
  path_to_prompty = folder + "/basic.prompty"

  # load prompty as a flow
  flow = Prompty.load(path_to_prompty)

  # execute the flow as function
  result = flow(
    firstName = firstName,
    context = context,
    question = question
  )

  return result

if __name__ == "__main__":
   json_input = '''{
  "firstName": "Cassie",
  "context": "The Alpine Explorer Tent boasts a detachable divider for privacy,  numerous mesh windows and adjustable vents for ventilation, and  a waterproof design. It even has a built-in gear loft for storing  your outdoor essentials. In short, it's a blend of privacy, comfort,  and convenience, making it your second home in the heart of nature!\\n",
  "question": "What can you tell me about your tents? Give me more information about the features?"
}'''
   args = json.loads(json_input)

   result = flow_entry(**args)
   print(result)
55yoko commented 4 weeks ago

@wayliums Should I look at the console log? When I opened it, the following log was displayed. Even if I right-clicked to add code, the console log did not increase. consolelog

wayliums commented 3 weeks ago

@55yoko thanks for sharing. I can't repro the issue. Let me try adding a bit more logging first.

wayliums commented 3 weeks ago

@55yoko i hope the sample I provided above would unblock you, right?