Skip to content

Comments

PEBC skeleton class implementation#60

Merged
VladIftime merged 32 commits intomainfrom
Dev-VladIftime-Kiflin-PEBC
Mar 3, 2025
Merged

PEBC skeleton class implementation#60
VladIftime merged 32 commits intomainfrom
Dev-VladIftime-Kiflin-PEBC

Conversation

@VladIftime
Copy link
Collaborator

This pull request introduces several new classes and updates existing ones in the src/s2python/pebc directory. These changes primarily involve importing necessary modules, defining new classes, and configuring model validation. The most important changes include the addition of new classes for handling PEBC constraints and envelopes, as well as updating model configurations to enable assignment validation.

@VladIftime VladIftime self-assigned this Dec 26, 2024
    "error": {
        "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}
null
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that creates concise, meaningful git commit messages based on code changes."
    },
    {
      "role": "user",
      "content": "Generate a commit message for the following changes:\n src/s2python/pebc/pebc_instruction.py       | 1 +
 src/s2python/pebc/pebc_power_constraints.py | 1 +
 2 files changed, 2 insertions(+)\nFiles changed:\nsrc/s2python/pebc/pebc_instruction.py,src/s2python/pebc/pebc_power_constraints.py,"
    }
  ]
}
OpenAI API Response: {
    "error": {
        "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}
null
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that creates concise, meaningful git commit messages based on code changes."
    },
    {
      "role": "user",
      "content": "Generate a commit message for the following changes:\n src/s2python/pebc/pebc_instruction.py       | 1 -
 src/s2python/pebc/pebc_power_constraints.py | 1 -
 2 files changed, 2 deletions(-)\nFiles changed:\nsrc/s2python/pebc/pebc_instruction.py,src/s2python/pebc/pebc_power_constraints.py"
    }
  ]
}
OpenAI API Response: {
    "error": {
        "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}
null
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that creates concise, meaningful git commit messages based on code changes."
    },
    {
      "role": "user",
      "content": "Generate a commit message for the following changes:\n src/s2python/pebc/pebc_instruction.py       | 1 +  src/s2python/pebc/pebc_power_constraints.py | 1 +  2 files changed, 2 insertions(+) \nFiles changed:\nsrc/s2python/pebc/pebc_instruction.py,src/s2python/pebc/pebc_power_constraints.py,"
    }
  ]
}
OpenAI API Response: {
  "id": "chatcmpl-Al2WJ2cNcBy1e7SuAXcIMjLbcFdBs",
  "object": "chat.completion",
  "created": 1735774467,
  "model": "gpt-4-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Added new code lines in pebc_instruction.py and pebc_power_constraints.py",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 116,
    "completion_tokens": 16,
    "total_tokens": 132,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "system_fingerprint": null
}
Added new code lines in pebc_instruction.py and pebc_power_constraints.py
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that creates concise, meaningful git commit messages based on code changes."
    },
    {
      "role": "user",
      "content": "Generate a commit message for the following changes:\n src/s2python/pebc/pebc_instruction.py       | 1 -  src/s2python/pebc/pebc_power_constraints.py | 1 -  2 files changed, 2 deletions(-) \nFiles changed:\nsrc/s2python/pebc/pebc_instruction.py,src/s2python/pebc/pebc_power_constraints.py,"
    }
  ]
}
Removed unnecessary lines from pebc_instruction.py and pebc_power_constraints.py
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant that creates concise, meaningful git commit messages based on code changes."
    },
    {
      "role": "user",
      "content": "Generate a commit message for the following changes:\n src/s2python/pebc/pebc_instruction.py       | 1 +  src/s2python/pebc/pebc_power_constraints.py | 1 +  2 files changed, 2 insertions(+) \nFiles changed:\nsrc/s2python/pebc/pebc_instruction.py,src/s2python/pebc/pebc_power_constraints.py,"
    }
  ]
}
OpenAI API Response: {
  "id": "chatcmpl-AlAbv6QhnCJYGj5n7bQAdF7PiD0iT",
  "object": "chat.completion",
  "created": 1735805567,
  "model": "gpt-4-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Added new functionalities to pebc_instruction and pebc_power_constraints files",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 116,
    "completion_tokens": 14,
    "total_tokens": 130,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "system_fingerprint": null
}
Added new functionalities to pebc_instruction and pebc_power_constraints files
@jorritn
Copy link
Contributor

jorritn commented Jan 7, 2025

This will resolve #64

@VladIftime VladIftime changed the title PEBC implementation PEBC skeleton class implementation Jan 8, 2025
Copy link
Collaborator

@wcoenraads wcoenraads left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this! Your changes look good to me; however, the control type still needs to be added to s2python/s2_control_type.py. If you add that, I think we can merge this.

P.S. I sent you an email with an extra question I had regarding the generated code.

@VladIftime
Copy link
Collaborator Author

Thanks for implementing this! Your changes look good to me; however, the control type still needs to be added to s2python/s2_control_type.py. If you add that, I think we can merge this.

P.S. I sent you an email with an extra question I had regarding the generated code.

I did not receive any emails.

Copy link
Collaborator

@wcoenraads wcoenraads left a comment

Choose a reason for hiding this comment

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

Thanks for adding PEBC to s2_control_type.py! However, it seems this commit also includes a bunch of build files in build/. If you remove those, we're good to merge.

@wcoenraads
Copy link
Collaborator

wcoenraads commented Jan 14, 2025

Another minor issue I discovered while working on a PEBC example: PEBCInstruction is missing from pebc/__init__.py.

EDIT: PEBCPowerEnvelopeConsequenceType also appears to be missing.

Signed-off-by: Vlad Iftime <vladiftime60@gmail.com>
@wcoenraads
Copy link
Collaborator

Thanks for adding the missing classes! I think the only two things remaining are:

  • Adding PEBCInstruction to the exports in __init__.py
  • Removing the build files from the pull request

Once that's done, this is ready to merge.

@VladIftime VladIftime requested a review from wcoenraads January 24, 2025 11:41
Copy link
Collaborator

@wcoenraads wcoenraads left a comment

Choose a reason for hiding this comment

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

Looks good to me - thanks!

@VladIftime VladIftime merged commit d4b6d74 into main Mar 3, 2025
1 check passed
@VladIftime VladIftime deleted the Dev-VladIftime-Kiflin-PEBC branch March 3, 2025 09:24
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