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

PEBC skeleton class implementation #60

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

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

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.

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