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

Users/changliu2/ignite2024 hotfix random runs #270

Closed

Conversation

changliu2
Copy link
Collaborator

@changliu2 changliu2 commented Nov 15, 2024

Purpose

Agents require GPT model output to follow certain format, but LLM models may behave non-deterministically and the code will error out. Errors rarely occur in products.py and researcher.py but they do.

  • added retry logic to reduce non-determination errors in products.py and researcher.py
  • added parsing code to handle certain edge cases in product.py
  • handled certain edge cases in BING search results for general information with empty relatedSearchResults.
  • added better instruction for output formatting in products.prompty for edge cases
  • upgraded all 3 agents to gpt-4o for better parseability and instruction following: https://openai.com/index/introducing-structured-outputs-in-the-api/

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?
Retries may increase running time up to 3 times.

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

@changliu2 changliu2 marked this pull request as draft November 15, 2024 23:18
@changliu2 changliu2 requested review from marlenezw and cassiebreviu and removed request for marlenezw November 15, 2024 23:18
src/api/agents/researcher/researcher.py Outdated Show resolved Hide resolved
@@ -84,10 +84,25 @@ def retrieve_products(items, index_name):


@trace
def find_products(context: str) -> Dict[str, any]:
def find_products(context: str, num_retries: int = 3) -> Dict[str, any]:
Copy link
Contributor

@marlenezw marlenezw Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to revise this code post Ignite. It sometimes works and sometimes does not. I'm finding it causes the product agent to break more times than not. Let's circle back soon


# Output format
Only output the full array of specialized queries to make to the search index. Limit
yoursef to 5 queries.

user:
{{context}}
context: {{context}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user input should not be in this format.

@@ -5,7 +5,7 @@
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider

def image_gen(image_prompt):
def image_gen(image_prompt: str):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are currently not using the designer as dalle 3 availability is restricted

@changliu2 changliu2 force-pushed the users/changliu2/ignite2024-hotfix-random-runs branch from e2bba7d to aa52925 Compare November 19, 2024 07:52
@changliu2 changliu2 closed this Nov 20, 2024
@changliu2 changliu2 mentioned this pull request Nov 20, 2024
@marlenezw marlenezw deleted the users/changliu2/ignite2024-hotfix-random-runs branch December 4, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants