Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Autofunction calling is hallucinating the end result output for Semantic kernel Orchestrator Example for Python #10039

Open
rakshahulle opened this issue Dec 30, 2024 · 10 comments
Labels
python Pull requests for the Python Semantic Kernel

Comments

@rakshahulle
Copy link

I have multiple plugins to invoke in sequence for Orchestration purposes. I have added all plugins to Kernel, I am using the automatic function calling to invoke a sequence of prompts for Orchestration flow. But the output for each time is hallucinating. I want to know how to give accurate prompts for Orchestration flow in Python.

@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel triage labels Dec 30, 2024
@github-actions github-actions bot changed the title Autofunction calling is hallucinating the end result output for Semantic kernel Orchestrator Example for Python Python: Autofunction calling is hallucinating the end result output for Semantic kernel Orchestrator Example for Python Dec 30, 2024
@evchaki
Copy link
Contributor

evchaki commented Jan 2, 2025

@evchaki evchaki removed the triage label Jan 2, 2025
@rakshahulle
Copy link
Author

rakshahulle commented Jan 2, 2025 via email

@evchaki
Copy link
Contributor

evchaki commented Jan 2, 2025

@eavanvalkenburg / @moonbox3 fyi

@alliscode
Copy link
Member

Hi @rakshahulle, if you are able to share your code and/or prompts then we might be able to provide some suggestions to reduce hallucinations. You can also take a look at some best practices for writing prompts: https://techcommunity.microsoft.com/blog/azure-ai-services-blog/15-tips-to-become-a-better-prompt-engineer-for-generative-ai/3882935

@rakshahulle
Copy link
Author

rakshahulle commented Jan 2, 2025 via email

@rakshahulle
Copy link
Author

rakshahulle commented Jan 2, 2025 via email

@rakshahulle
Copy link
Author

Can you please help me

@moonbox3
Copy link
Contributor

moonbox3 commented Jan 9, 2025

Hello, I’ve been trying to follow the thread here and it isn’t clear to me what the hallucinations are. Is it that your sequence isn’t being followed? If you need a repeatable sequence of events, and simply telling the model how it should sequence things isn’t working, have you looked at our process framework?

@rakshahulle
Copy link
Author

rakshahulle commented Jan 9, 2025 via email

@moonbox3
Copy link
Contributor

@rakshahulle there are a few ways to go about this given that you need the orchestration to follow a specific flow:

  1. You can try really hard to prompt your way to your desired goal. You will need to give clear directions to the model, and hope it is able to complete the plan that you have provided it. It could be something like this (this is just an idea, I wouldn't recommend trying it exactly as is):
<message role="system">
You are an expert at generating plans from a given GOAL. Think step by step and determine a plan to satisfy the specified GOAL using only the FUNCTIONS provided to you. You can also make use of your own knowledge while forming an answer but you must not use functions that are not provided.

[FUNCTIONS]

{{$available_functions}}

[END FUNCTIONS]

Each time you are prompted, follow these steps in this exact order

- Step 1: Classify the image Classify the image into one of the following food categories: "Vegetarian" or "Non-Vegetarian." 
- Step 2: Search Recipes According to the classification output, search for the top 10 {{$output}} recipes on Bing Web. 
- Step 3: Retrieve Recipe Details For each recipe, retrieve the following details: - id: Recipe ID (unique identifier for the recipe) - name: Name of the recipe - ingredients: List of ingredients required - instructions: Step-by-step cooking instructions - url: URL of the recipe page - image_url: URL of the recipe image 
- Step 4: Store Details into a Database Use a database table to store the recipe details with fields for id, name, ingredients, instructions, url, and image_url. 
- Step 5: Show All Recipes from the Database Display all stored recipes from the database. 
- Step 6: Display First Recipe Highlight the first recipe, showing its name, ingredients, instructions, and image_url.
</message>
<message role="user">{{$goal}}</message>
  1. Other than trying to prompt your way out, you can have a look at our process framework which is designed to make sure you follow each specified step in the exact order. https://github.com/microsoft/semantic-kernel/tree/main/python/samples/getting_started_with_processes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

No branches or pull requests

5 participants