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

feat(Instructor): introduce Instructor Hub with tutorials, examples, and new CLI #439

Merged
merged 31 commits into from
Feb 18, 2024

Conversation

jxnl
Copy link
Collaborator

@jxnl jxnl commented Feb 17, 2024

Ellipsis 🚀 This PR description was created by Ellipsis for commit 4eedd5e.

Summary:

This PR introduces the 'Instructor Hub', a new CLI, updates documentation, adds tests, demonstrates the OpenAI API, adds a Cloudflare worker, modifies the get_py function, removes old tutorials, creates a new SQL table for analytics, updates request and response handling, removes the mkdoc_yaml_url function, and updates the HubClient class and pull function.

Key points:

  • Introduced Instructor Hub with tutorials and examples.
  • Implemented a new CLI for interaction with the hub.
  • Updated mkdocs.yml to include the new hub in the documentation.
  • Added tests for the new hub.
  • Demonstrated single-label classification using the OpenAI API.
  • Added a Cloudflare worker in router.ts for serving the hub content.
  • Modified get_py function to include a source comment in the generated Python code.
  • Removed old tutorials in the tutorials directory.
  • Created a new SQL table hub_analytics for tracking analytics.
  • Updated index.ts and router.ts in the instructor-hub-proxy directory to handle requests and responses, and to track analytics.
  • Removed mkdoc_yaml_url function in instructor/cli/hub.py.
  • Updated HubClient class in instructor/cli/hub.py to include methods for getting cookbooks by id and slug.
  • Updated pull function in instructor/cli/hub.py to use these new methods.

Generated with ❤️ by ellipsis.dev

@ellipsis-dev ellipsis-dev bot changed the title ... feat(Instructor): introduce Instructor Hub with tutorials, examples, and new CLI Feb 17, 2024
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 entire PR up to commit 3c5cadc

Reviewed 369 lines of code across 6 files in 1 minute(s) and 8 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 5 additional comments.
  • Workflow ID: wflow_dnUvfKyraK0H2LBs
View 5 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 5 comments under confidence threshold

Filtered comment at mkdocs.yml:167

Confidence changes required: 0%

Commentary: The new file docs/hub/index.md has been added to the mkdocs.yml file as required. This is good as it ensures the new documentation will be included in the generated site.

Good job on updating the mkdocs.yml file to include the new documentation file.

Filtered comment at mkdocs.yml:168

Confidence changes required: 0%

Commentary: The new file docs/hub/single_classification.md has been added to the mkdocs.yml file as required. This is good as it ensures the new documentation will be included in the generated site.

Good job on updating the mkdocs.yml file to include the new documentation file.

Filtered comment at instructor/cli/cli.py:15

Confidence changes required: 0%

Commentary: The new hub command has been added to the CLI in instructor/cli/cli.py. This is good as it ensures the new functionality will be available to users.

Good job on updating the CLI to include the new hub command.

Filtered comment at instructor/cli/hub.py:3

Confidence changes required: 66%

Commentary: The new file instructor/cli/hub.py contains the implementation of the hub command. The code looks well-structured and follows good practices. However, I noticed that the httpx library is used for making HTTP requests. This could potentially lead to performance issues if many requests are made in a short period of time, as each request will block the execution of the program until a response is received. It might be beneficial to use an asynchronous HTTP library such as aiohttp instead.

Consider using an asynchronous HTTP library like aiohttp for making HTTP requests. This can improve performance by allowing other tasks to run while waiting for a response.

Filtered comment at tests/openai/docs/test_hub.py:6

Confidence changes required: 80%

Commentary: The new test file tests/openai/docs/test_hub.py has been added. This is good as it ensures the new functionality is tested. However, the test function name test_format_blog does not accurately describe what is being tested. It would be better to use a more descriptive name.

Consider renaming the test function to something more descriptive, such as test_hub_examples.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit 68b5b96

Reviewed 12 lines of code across 1 files in 57 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 2 additional comments.
  • Workflow ID: wflow_camJnaOK6Cz7w1kF
View 2 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 2 comments under confidence threshold

Filtered comment at /docs/hub/single_classification.md:5

Confidence changes required: 80%

Commentary: The code seems to be well written and follows good practices. However, there is a lack of comments explaining what the code does. This is especially important in a tutorial where the goal is to teach users how to use the API. Adding comments would make the code more understandable for users who are not familiar with the OpenAI API or the gpt-3.5-turbo model.

Consider adding comments to explain what the code does. This is especially important in a tutorial where the goal is to teach users how to use the API. For example, explain what the gpt-3.5-turbo model is and how it is used in this context.

Filtered comment at /docs/hub/single_classification.md:6

Confidence changes required: 80%

Commentary: The code seems to be well written and follows good practices. However, there is a lack of comments explaining what the code does. This is especially important in a tutorial where the goal is to teach users how to use the API. Adding comments would make the code more understandable for users who are not familiar with the OpenAI API or the gpt-3.5-turbo model.

Consider adding comments to explain what the instructor.patch(OpenAI()) does. This would help users understand the purpose of this line of code.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit f199042

Reviewed 12 lines of code across 1 files in 53 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 0 additional comments.
  • Workflow ID: wflow_9lb9OpP6UABgnsj3

Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

instructor/cli/hub.py 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.

Changes requested. Incremental review on commit b4fa5e5

Reviewed 105 lines of code across 1 files in 1 minute(s) and 21 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 0 additional comments.
  • Workflow ID: wflow_SGSnTTBnPuRj3zNt

Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

data = yaml.safe_load(mkdocs_config)

# Replace with Hub key
cookbooks = [obj["Hub"] for obj in data.get("nav", []) if "Hub" in obj][0]
Copy link
Contributor

Choose a reason for hiding this comment

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

The function list_hub assumes that the 'Hub' key will always be present in the mkdocs configuration file. If the 'Hub' key is not present, this line will raise an error. Consider adding error handling for this case.

Suggested change
cookbooks = [obj["Hub"] for obj in data.get("nav", []) if "Hub" in obj][0]
cookbooks = [obj.get('Hub', []) for obj in data.get('nav', [])]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If they are missing we want an error

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jxnl, at the moment you'll need to explicitly tag us

False, "--page", "-p", help="Paginate the output with a less-like pager"
),
):
cookbook = (
Copy link
Contributor

Choose a reason for hiding this comment

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

The function pull only considers the id if both an id and a slug are provided. This could lead to confusion for the user. Consider adding error handling for this case.

Suggested change
cookbook = (
if id and slug:
typer.echo('Please provide either a cookbook id or slug, not both.')
raise typer.Exit(code=1)
cookbook = get_cookbook_by_id(id, branch) if id else get_cookbook_by_slug(slug, branch)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@hbrooks really reasonable!

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 commit eeaeab1

Reviewed 40 lines of code across 1 files in 42 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_9nIVrAAYSFkDz2Vu
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at /instructor/cli/hub.py:38

Confidence changes required: 50%

Commentary: The code seems to be well-structured and follows good practices. However, there are no comments explaining what the functions do. This could make it difficult for other developers to understand the code.

Consider adding docstrings to your functions to explain what they do. This will make your code easier to understand for other developers.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit 1e83bcc

Reviewed 70 lines of code across 1 files in 1 minute(s) and 6 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_rNavCALGYloSeShh
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at /instructor/cli/hub.py:75

Confidence changes required: 70%

Commentary: The function get_cookbook_by_id and get_cookbook_by_slug are iterating over the list of HubPage objects generated by generate_pages to find a specific cookbook. However, they are not very efficient because they always iterate over the entire list, even if the cookbook is found early in the list. A more efficient approach would be to return the cookbook as soon as it is found and stop the iteration.

The function get_cookbook_by_id could be more efficient. Consider returning the cookbook as soon as it is found to avoid unnecessary iterations. The same applies to get_cookbook_by_slug function.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev



def generate_pages(branch="main") -> Iterable[HubPage]:
resp = httpx.get(mkdoc_yaml_url(branch))
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no error handling for the HTTP request in generate_pages. Consider adding error handling to account for potential issues such as network errors or unexpected responses.

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 commit 261a551

Reviewed 13 lines of code across 1 files in 52 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_AbSk6EMwZTMCZ0Bi
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 additional comments

Comment at mkdocs.yml:236

The PR description mentions that the mkdocs.yml file was updated to include the new hub in the documentation. However, I don't see any changes in the mkdocs.yml file in the diff. Please ensure that the new hub is included in the mkdocs.yml file.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit b74a5d7

Reviewed 264 lines of code across 6 files in 1 minute(s) and 1 second(s).

See details
  • Skipped files: 9 (please contact us to request support for these files): instructor-hub-proxy/.editorconfig, instructor-hub-proxy/.gitignore, instructor-hub-proxy/.prettierrc, instructor-hub-proxy/package-lock.json, instructor-hub-proxy/package.json, instructor-hub-proxy/tsconfig.json, instructor-hub-proxy/wrangler.toml, tutorials/assets/article.txt, tutorials/requirements.txt
  • Confidence threshold: 85%
  • Drafted 0 additional comments.
  • Workflow ID: wflow_x3P1A3l41uy86iVt

Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

instructor/cli/hub.py 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.

Changes requested. Incremental review on commit 3d27bf1

Reviewed 42 lines of code across 1 files in 1 minute(s) and 9 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 2 additional comments.
  • Workflow ID: wflow_vsc6HZpt3QTUhjPz
View 2 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor-hub-proxy/src/router.ts:9

Confidence changes required: 80%

Commentary: The console.log statements in the router.ts file are used for logging events. However, in a production environment, it would be better to use a proper logging library or service that can handle different log levels (info, warn, error, etc.) and can also provide more context about the running application. This would make it easier to track and debug issues.

Consider replacing the console.log statements with a proper logging library or service. This would provide more context about the running application and make it easier to track and debug issues.

Drafted 1 additional comments

Comment at instructor-hub-proxy/src/router.ts:16

Consider replacing var with let or const for variable declarations. This would make the code more predictable and easier to understand.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

timestamp: new Date().toISOString(),
});
const url = `https://raw.githubusercontent.com/jxnl/instructor/${params.branch}/mkdocs.yml?raw=true`;
const mkdoc_yml = await fetch(url).then((res) => res.text());
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding error handling for the fetch operation. This would prevent unhandled promise rejections and improve the robustness of the code.

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 commit fd69385

Reviewed 123 lines of code across 3 files in 1 minute(s) and 13 second(s).

See details
  • Skipped files: 1 (please contact us to request support for these files): instructor-hub-proxy/wrangler.toml
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_N0lPIRUeQ0SrlBUS
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at /instructor-hub-proxy/create.sql:1

Confidence changes required: 80%

Commentary: The SQL script for creating the hub_analytics table does not include any indexes. This could potentially lead to performance issues when the table grows large and queries are performed on it. It would be beneficial to add indexes on the columns that are frequently queried, such as event_type, request_ip, request_time, branch, and slug.

Consider adding indexes to the columns that are frequently queried to improve query performance. This could include columns such as event_type, request_ip, request_time, branch, and slug.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

// and should return a Response (optionally wrapped in a Promise)
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
// @ts-ignore
request.env = env;
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid modifying the request object directly. Consider passing the environment variable as a separate argument to the function that needs it.

const router = Router();

// Function to track analytics
async function trackAnalytics(request: any, env: Env, event_type: string, slug: string, branch: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using 'any' as the type for the request parameter. Consider defining an interface or use an existing one that accurately describes the shape of the request object.

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 commit 6482854

Reviewed 151 lines of code across 1 files in 1 minute(s) and 12 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 2 additional comments.
  • Workflow ID: wflow_6g4ebiWGICXmSkzg
View 2 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 2 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:36

Confidence changes required: 80%

Commentary: The 'HubClient' class methods 'get_cookbooks', 'get_content_markdown', and 'get_content_python' all raise a generic Exception when the HTTP response status code is not 200. While this is not necessarily wrong, it would be more informative to raise a more specific exception, such as an HTTPError, and include the response text in the error message. This would provide more context about the error and make debugging easier.

Consider raising a more specific exception, such as an HTTPError, and include the response text in the error message. This would provide more context about the error and make debugging easier. This applies to the 'get_cookbooks', 'get_content_markdown', and 'get_content_python' methods of the 'HubClient' class.

Filtered comment at instructor/cli/hub.py:81

Confidence changes required: 70%

Commentary: The 'HubClient' class is instantiated multiple times in the 'get_cookbook_by_id', 'get_cookbook_by_slug', 'list_cookbooks', and 'pull' functions. This could be inefficient if the instantiation of the 'HubClient' class is expensive (e.g., if it establishes a database connection or opens a file). A better approach might be to instantiate the 'HubClient' class once and pass it as an argument to the functions that need it.

The 'HubClient' class is instantiated multiple times in different functions. Consider instantiating it once and passing it as an argument to the functions that need it. This could improve efficiency, especially if the instantiation of the 'HubClient' class is expensive.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

)
console = Console()

import requests
Copy link
Contributor

Choose a reason for hiding this comment

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

The code imports both 'requests' and 'httpx' libraries for making HTTP requests. It's better to stick to one library for consistency and simplicity. Consider replacing 'requests' with 'httpx' in the 'get_content_python' method of the 'HubClient' class.

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 commit fb272a8

Reviewed 15 lines of code across 1 files in 52 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_f8kZMQeDd1Ht0iNo
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:73

Confidence changes required: 66%

Commentary: The function mkdoc_yaml_url has been removed but it's not clear if it's being used elsewhere in the codebase. I need to check if this function is being used in other parts of the codebase and if its removal could potentially break something.

The function mkdoc_yaml_url has been removed. Please ensure that this function is not being used elsewhere in the codebase, as its removal could potentially break other parts of the application.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit 5515978

Reviewed 41 lines of code across 1 files in 1 minute(s) and 15 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_fEjX8Kij2S5KLw2a
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 additional comments

Comment at instructor-hub-proxy/src/router.ts:24

The 'router.get' functions do not check if the params are valid before using them. If the params are not valid, the server will crash. It would be better to add checks to ensure the params are valid before using them.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

* results: [ { slug: 'single_classification', 'n': 2 } ]
* }
*/
const counts = await env.DB.prepare(
Copy link
Contributor

Choose a reason for hiding this comment

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

The SQL query does not have any error handling. If the query fails for any reason, the server will crash. Please add error handling to prevent this. This comment is also applicable to the 'trackAnalytics' function and the 'router.get' functions.

.all();

const url = `https://raw.githubusercontent.com/jxnl/instructor/${params.branch}/mkdocs.yml?raw=true`;
const mkdoc_yml = await fetch(url).then((res) => res.text());
Copy link
Contributor

Choose a reason for hiding this comment

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

The 'router.get' functions do not have any error handling for the fetch calls. If the fetch calls fail, the server will crash. It would be better to add error handling to prevent this.

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 commit d9a327b

Reviewed 28 lines of code across 1 files in 57 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_xq78TH5ucrmO1juP
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:97

Confidence changes required: 80%

Commentary: The HubClient class has two methods, get_cookbook_id and get_cookbook_slug, which both iterate over the entire list of cookbooks to find a match. This could be inefficient if the list of cookbooks is large. A more efficient approach would be to create a dictionary mapping ids and slugs to cookbooks when the cookbooks are fetched, and then use this dictionary to look up cookbooks by id or slug.

Consider creating a dictionary mapping ids and slugs to cookbooks when the cookbooks are fetched. This would allow you to look up cookbooks by id or slug in constant time, which could be more efficient if the list of cookbooks is large.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit c728c81

Reviewed 91 lines of code across 2 files in 55 second(s).

See details
  • Skipped files: 2 (please contact us to request support for these files): instructor-hub-proxy/package-lock.json, instructor-hub-proxy/package.json
  • Confidence threshold: 85%
  • Drafted 2 additional comments.
  • Workflow ID: wflow_V8LWudhxeLDW8Opb
View 2 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 2 comments under confidence threshold

Filtered comment at docs/hub/multiple_classification.md:1

Confidence changes required: 50%

Commentary: The new file docs/hub/multiple_classification.md contains a Python script for multi-label classification. The script seems to be logically correct and follows good practices. However, it would be beneficial to add more comments explaining the purpose and functionality of the code, especially for complex sections. This would make the code more understandable for other developers or users who might use this as a reference.

Consider adding more comments in the Python script to explain the purpose and functionality of the code. This would make the code more understandable for other developers or users.

Filtered comment at instructor-hub-proxy/src/router.ts:1

Confidence changes required: 50%

Commentary: The file instructor-hub-proxy/src/router.ts contains the router for the Instructor Hub. The code seems to be logically correct and follows good practices. However, there are some sections of the code that could benefit from additional comments to explain their purpose and functionality. This would make the code more understandable for other developers.

Consider adding more comments in the router code to explain the purpose and functionality of complex sections. This would make the code more understandable for other developers.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit a06e132

Reviewed 12 lines of code across 1 files in 51 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_r0OUdLoCQHODw95O
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at mkdocs.yml:169

Confidence changes required: 50%

Commentary: The PR description mentions that a new 'Instructor Hub' has been introduced with tutorials and examples. The diff shows that a new section 'Multiple Classification Model' has been added to the 'Hub' section in the mkdocs.yml file. This is consistent with the PR description. However, I need to check if the corresponding markdown file 'multi_classification.md' has been created in the 'hub' directory.

Please ensure that the file 'multi_classification.md' is created in the 'hub' directory as it is referenced in the mkdocs.yml file.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit eb2d20b

Reviewed 13 lines of code across 1 files in 44 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_Hdar52RE3rQr8VqM
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at mkdocs.yml:169

Confidence changes required: 50%

Commentary: The PR description mentions that a new 'Instructor Hub' has been introduced and the documentation has been updated. The diff shows a change in the 'mkdocs.yml' file where the name of a document under the 'Hub' section has been changed from 'multi_classification.md' to 'multiple_classification.md'. This change seems to be in line with the PR description. However, I need to check if the file 'multiple_classification.md' actually exists in the 'hub' directory and if the content is relevant and correctly linked.

Please ensure that the file 'multiple_classification.md' exists in the 'hub' directory and the content is relevant and correctly linked.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

@hbrooks
Copy link
Collaborator

hbrooks commented Feb 18, 2024

Ellipsis is working on hard on this PR!

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 commit ed7774c

Reviewed 10 lines of code across 1 files in 51 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_fw52oqzWp6xr5mhV
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:1

Confidence changes required: 80%

Commentary: The get_cookbook_id and get_cookbook_slug methods in the HubClient class are making a network request each time they are called to fetch all cookbooks and then iterating over them to find the matching id or slug. This could be inefficient if there are a large number of cookbooks. It would be more efficient to have a single method that fetches a cookbook by id or slug directly from the server, if the server supports this operation.

Consider refactoring the get_cookbook_id and get_cookbook_slug methods to fetch a cookbook directly by id or slug from the server, if the server supports this operation. This would be more efficient than fetching all cookbooks and iterating over them to find the matching id or slug.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit daaa8db

Reviewed 60 lines of code across 1 files in 1 minute(s) and 11 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 0 additional comments.
  • Workflow ID: wflow_yagBcBi9yqf2VLLJ

Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

def __init__(
self, base_url: str = "https://instructor-hub-proxy.jason-a3f.workers.dev"
):
self.base_url = "http://localhost:8787"
Copy link
Contributor

Choose a reason for hiding this comment

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

The base_url is hardcoded to 'http://localhost:8787'. This should be set to the base_url parameter passed to the init method.

Suggested change
self.base_url = "http://localhost:8787"
self.base_url = base_url

short_help="Pull the latest cookbooks",
)
def pull(
id: Optional[int] = typer.Option(None, "--id", "-i", help="The cookbook id"),
Copy link
Contributor

Choose a reason for hiding this comment

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

The pull function does not handle the case where both id and slug are None. This could lead to unexpected behavior. Consider adding a check at the beginning of the function to ensure at least one of them is not None.

Suggested change
id: Optional[int] = typer.Option(None, "--id", "-i", help="The cookbook id"),
if id is None and slug is None:
raise ValueError('Either id or slug must be provided.')

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 commit 7b162e8

Reviewed 74 lines of code across 2 files in 1 minute(s) and 17 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_ATtpKNXBHbxHXE21
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:52

Confidence changes required: 80%

Commentary: The get_cookbooks method in the HubClient class has been updated to include optional parameters for searching and sorting cookbooks. This is a good addition as it provides more flexibility for users. However, the method could be improved by handling potential exceptions that might occur during the HTTP request. For instance, if the server is down or the request times out, the program will crash. It would be better to catch these exceptions and provide a user-friendly error message.

Consider adding exception handling for potential HTTP errors when making the request in the get_cookbooks method. This could include handling for timeouts, connection errors, and server errors. Providing a user-friendly error message can improve the user experience.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit 95eaf97

Reviewed 12 lines of code across 1 files in 52 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_sPq9oMlMORpKC8VH
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:54

Confidence changes required: 80%

Commentary: The get_cookbooks method in the HubClient class does not handle the case where the response from the server is not a 200 status code. This could lead to unexpected behavior if the server returns an error.

The get_cookbooks method does not handle the case where the response from the server is not a 200 status code. This could lead to unexpected behavior if the server returns an error. Consider adding error handling for non-200 status codes.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit 03fed94

Reviewed 107 lines of code across 2 files in 1 minute(s) and 28 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 1 additional comments.
  • Workflow ID: wflow_76AnFhyBpJY85cVw
View 1 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 1 additional comments

Comment at instructor/cli/hub.py:43

The base_url is hardcoded to a specific URL. Consider making this configurable to allow for flexibility in deployment environments.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev


### List Cookbooks

By running `instructor hub list` you can see all the available tutorials and examples. By clickony (doc) you can see the full tutorial back on this website.
Copy link
Contributor

Choose a reason for hiding this comment

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

The term 'clickony' seems to be a typo. Please correct it to 'clicking on'.

Copy link
Contributor

ellipsis-dev bot commented Feb 18, 2024

Skipped PR review on f08674f because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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.

Changes requested. Incremental review on commit 4b62a35

Reviewed 22 lines of code across 1 files in 1 minute(s) and 26 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 0 additional comments.
  • Workflow ID: wflow_fO9TNjTLDS2NhnE0

Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

- [ ] Open Examples, together, anyscale, ollama, llama-cpp, etc
- [ ] Query Expansion examples
- [ ] Batch Data Processing examples
- [ ] Batch Data Processing examples with Cache
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be a repetition in the 'Call for Contributions' section. The last two points are both 'Batch Data Processing examples'. Could you please clarify the difference between these two points? If they are the same, one of them should be removed to avoid confusion.

@jxnl jxnl merged commit 4eedd5e into main Feb 18, 2024
11 checks passed
@jxnl jxnl deleted the hub branch February 18, 2024 02:04
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 commit 2256299

Reviewed 22 lines of code across 1 files in 1 minute(s) and 7 second(s).

See details
  • Skipped files: 0
  • Confidence threshold: 85%
  • Drafted 2 additional comments.
  • Workflow ID: wflow_PkMnvze4NFnKw5Ww
View 2 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 2 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:132

Confidence changes required: 50%

Commentary: The pull function in the hub.py file has a branch parameter with a default value of 'main'. This is a change from the previous default value of 'hub'. This change is not reflected in the PR description. It's important to ensure that this change is intentional and won't cause any unexpected behavior.

The default value for the branch parameter in the pull function has been changed from 'hub' to 'main'. Please confirm if this change is intentional and update the PR description to reflect this change.

Filtered comment at instructor/cli/hub.py:99

Confidence changes required: 50%

Commentary: The list_cookbooks function in the hub.py file has a branch parameter with a default value of 'main'. This is a change from the previous default value of 'hub'. This change is not reflected in the PR description. It's important to ensure that this change is intentional and won't cause any unexpected behavior.

The default value for the branch parameter in the list_cookbooks function has been changed from 'hub' to 'main'. Please confirm if this change is intentional and update the PR description to reflect this change.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

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! Incremental review on commit 4eedd5e

Reviewed 770 lines of code across 13 files in 1 minute(s) and 39 second(s).

See details
  • Skipped files: 10 (please contact us to request support for these files): instructor-hub-proxy/.editorconfig, instructor-hub-proxy/.gitignore, instructor-hub-proxy/.prettierrc, instructor-hub-proxy/package-lock.json, instructor-hub-proxy/package.json, instructor-hub-proxy/tsconfig.json, instructor-hub-proxy/wrangler.toml, pyproject.toml, tutorials/assets/article.txt, tutorials/requirements.txt
  • Confidence threshold: 85%
  • Drafted 3 additional comments.
  • Workflow ID: wflow_O1P3erggWwWMrQpT
View 3 draft comments

These comments were drafted by Ellipsis, but were filtered out of the final review. They're included here so you can see our internal thought process and help you configure your ellipsis.yaml.

Drafted 3 comments under confidence threshold

Filtered comment at instructor/cli/hub.py:167

Confidence changes required: 10%

Commentary: The PR introduces a new feature called 'Instructor Hub' which includes tutorials, examples, and a new CLI. The PR also updates the documentation, adds tests, and modifies some functions. The PR description is well-written and provides a clear summary of the changes. The code changes are well-structured and follow good coding practices. The new SQL table for analytics is properly created. The new CLI commands for interacting with the hub are well-implemented. The tests for the new hub are also added. The PR also updates the mkdocs.yml to include the new hub in the documentation. Overall, the PR is well-done and doesn't seem to have any major issues.

The new CLI commands for interacting with the hub are well-implemented. Good job!

Filtered comment at instructor-hub-proxy/src/router.ts:128

Confidence changes required: 10%

Commentary: The PR introduces a new feature called 'Instructor Hub' which includes tutorials, examples, and a new CLI. The PR also updates the documentation, adds tests, and modifies some functions. The PR description is well-written and provides a clear summary of the changes. The code changes are well-structured and follow good coding practices. The new SQL table for analytics is properly created. The new CLI commands for interacting with the hub are well-implemented. The tests for the new hub are also added. The PR also updates the mkdocs.yml to include the new hub in the documentation. Overall, the PR is well-done and doesn't seem to have any major issues.

The new Cloudflare worker for serving the hub content is well-implemented. Good job!

Filtered comment at docs/hub/index.md:92

Confidence changes required: 10%

Commentary: The PR introduces a new feature called 'Instructor Hub' which includes tutorials, examples, and a new CLI. The PR also updates the documentation, adds tests, and modifies some functions. The PR description is well-written and provides a clear summary of the changes. The code changes are well-structured and follow good coding practices. The new SQL table for analytics is properly created. The new CLI commands for interacting with the hub are well-implemented. The tests for the new hub are also added. The PR also updates the mkdocs.yml to include the new hub in the documentation. Overall, the PR is well-done and doesn't seem to have any major issues.

The documentation for the new 'Instructor Hub' is well-written and provides clear instructions. Good job!


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

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.

2 participants