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

Added COSP #823

Merged
merged 8 commits into from
Jul 15, 2024
Merged

Added COSP #823

merged 8 commits into from
Jul 15, 2024

Conversation

ivanleomk
Copy link
Collaborator

@ivanleomk ivanleomk commented Jul 10, 2024

🚀 This description was created by Ellipsis for commit 5eab504

Summary:

Added documentation and implementation details for COSP, updated mkdocs.yml for KaTeX support, and made minor formatting fixes.

Key points:

  • Added docs/javascripts/katex.js for rendering mathematical expressions using KaTeX.
  • Updated mkdocs.yml to include KaTeX-related JavaScript and CSS files.
  • Added detailed documentation for Consistency Based Self Adaptive Prompting (COSP) in docs/prompting/ensembling/cosp.md.
  • Updated the navigation in mkdocs.yml to reflect the new COSP documentation.
  • Minor formatting fix in docs/prompting/thought_generation/chain_of_thought_few_shot/uncertainty_routed_cot.md.
  • Implemented COSP in instructor/dsl/partial.py and instructor/function_calls.py.
  • Added functions for scoring entropy and repetitiveness in COSP implementation.

Generated with ❤️ by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot 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! Reviewed everything up to c4b6731 in 28 seconds

More details
  • Looked at 381 lines of code in 4 files
  • Skipped 3 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. mkdocs.yml:251
  • Draft comment:
    The navigation title for cosp.md has been changed from 'COSP' to 'Prioritize Consistent Examples'. If this change was intentional, please update the PR description to reflect this. Otherwise, revert the title change in the navigation.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 85%.

Workflow ID: wflow_OcMJtsXCk7tzMPE9


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

cloudflare-pages bot commented Jul 10, 2024

Deploying instructor with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5eab504
Status: ✅  Deploy successful!
Preview URL: https://d9f28bc2.instructor.pages.dev
Branch Preview URL: https://cosp.instructor.pages.dev

View logs

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on bc0121d in 1 minute and 4 seconds

More details
  • Looked at 268 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_BV2xYUn7E82Thxnq


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

docs/prompting/ensembling/cosp.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot 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! Incremental review on b2786d3 in 36 seconds

More details
  • Looked at 314 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. mkdocs.yml:251
  • Draft comment:
    The navigation title for COSP in mkdocs.yml is 'Prioritize Consistent Examples', which might not clearly indicate the full technique name 'Consistency Based Self Adaptive Prompting'. Consider updating it to reflect the full name for clarity.
      - Consistency Based Self Adaptive Prompting: 'prompting/ensembling/cosp.md'
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 85%.

Workflow ID: wflow_8GFYdUM6SGAmCVeW


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Owner

@jxnl jxnl left a comment

Choose a reason for hiding this comment

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

this looks awesome cant wait to share



def score_repetitiveness(prediction: Response):
sentences = [item for item in prediction.chain_of_thought.split(".") if item]
Copy link
Owner

Choose a reason for hiding this comment

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

why not just ask for a list[str]


!!! Info "Quick Note"

Make sure to install `numpy` and `scikit-learn` before running the code, we need to use these two libraries to compute the cosine similarity
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
Make sure to install `numpy` and `scikit-learn` before running the code, we need to use these two libraries to compute the cosine similarity
Make sure to `pip install numpy scikit-learn` as we will need them for cosine computations

can also implement a simple costine function in a list comprehension to avoid a install

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot 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! Incremental review on c9b3da6 in 52 seconds

More details
  • Looked at 301 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. docs/prompting/ensembling/cosp.md:96
  • Draft comment:
    Consider using the cosine_similarity function from a library like scikit-learn instead of a custom implementation to ensure optimized and accurate calculations.
from sklearn.metrics.pairwise import cosine_similarity

This suggestion applies to the entire custom implementation of cosine_similarity from lines 96 to 104.

  • Reason this comment was not posted:
    Confidence of 20% on close inspection, compared to threshold of 85%.
2. docs/prompting/ensembling/cosp.md:107
  • Draft comment:
    It's recommended to use the cosine_similarity function from scikit-learn for calculating repetitiveness to ensure optimized and accurate calculations. This would replace the custom implementation in the score_repetitiveness function.
from sklearn.metrics.pairwise import cosine_similarity

This change should be applied to the entire score_repetitiveness function.

  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_fPbH76ULH8ZufScO


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot 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! Incremental review on 5eab504 in 1 minute and 10 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. mkdocs.yml:258
  • Draft comment:
    The PR description mentions updates to mkdocs.yml for KaTeX support, but the diff provided does not show these changes. Please ensure that all intended changes are correctly committed.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 85%.

Workflow ID: wflow_LeKWK9tlFkQNyh0p


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ivanleomk ivanleomk merged commit 593e152 into main Jul 15, 2024
15 of 16 checks passed
@ivanleomk ivanleomk deleted the cosp branch July 15, 2024 06:37
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.

None yet

2 participants