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

Typo corrections #1782

Merged
merged 4 commits into from
Nov 6, 2024
Merged

Typo corrections #1782

merged 4 commits into from
Nov 6, 2024

Conversation

mdqst
Copy link
Contributor

@mdqst mdqst commented Nov 6, 2024

Overview

Added typo corrections to documentation for the following files:

tutorials/golang-client-tutorial.md

"This section tutorial will guide you" — the correct phrasing would be "This tutorial section will guide you".

The mistake is in the word order. "Section tutorial" should be rephrased as "tutorial section" or "section of the tutorial."

tutorials/integrate-celestia.md

"When getting started Celestia" — should be "When getting started with Celestia".

The word "with" is missing.
The correct phrase is "getting started with Celestia."

tutorials/prompt-scavenger.md

"order to sign up for an account and generate an OpenAI API key."

This sentence has an extra "order" at the beginning. It should be:
"In order to sign up for an account and generate an OpenAI API key."

tutorials/rust-client-tutorial.md

"This section tutorial will guide you through using the most common RPC endpoints with..."
The word "section" is incorrect here. It should be:

"This tutorial section will guide you through using the most common RPC endpoints with..."
This change ensures the sentence flows correctly and makes more sense grammatically.

The purpose of corrections

Correct grammatical errors and improve readability of the documentation.

Summary by CodeRabbit

  • New Features

    • Introduced a tutorial for "Prompt Scavenger," detailing setup and interaction with Celestia’s Node API and OpenAI’s GPT-3.5.
  • Improvements

    • Updated titles and introductory texts in the Golang and Rust client tutorials for clarity.
    • Enhanced readability in the "Integrate Celestia for service providers" document.
  • Bug Fixes

    • Minor grammatical corrections across various tutorials for improved clarity.

"This section tutorial will guide you" — the correct phrasing would be "This tutorial section will guide you».

The mistake is in the word order. "Section tutorial" should be rephrased as "tutorial section" or "section of the tutorial."
"When getting started Celestia" — should be "When getting started with Celestia".
The word "with" is missing. The correct phrase is "getting started with Celestia."
"order to sign up for an account and generate an OpenAI API key."

This sentence has an extra "order" at the beginning.
It should be:
"In order to sign up for an account and generate an OpenAI API key."
"This section tutorial will guide you through using the most common RPC endpoints with..."

The word "section" is incorrect here. It should be:

"This tutorial section will guide you through using the most common RPC endpoints with..."

This change ensures the sentence flows correctly and makes more sense grammatically.
Copy link
Contributor

coderabbitai bot commented Nov 6, 2024

Walkthrough

This pull request introduces several textual modifications across multiple tutorial documents. The changes include grammatical corrections and improvements for clarity in the Golang client library tutorial, the integration tutorial for Celestia, and the Rust client library tutorial. Additionally, a new tutorial for a game called "Prompt Scavenger" is added, detailing the use of Celestia’s Node API and OpenAI’s GPT-3.5 in Golang, along with new functions to facilitate interaction with the blockchain and AI.

Changes

File Path Change Summary
tutorials/golang-client-tutorial.md Introductory sentence modified for clarity: "This section tutorial will guide you" → "This tutorial section will guide you."
tutorials/integrate-celestia.md Title updated: "Integrating Wallets for developers" → "Integrate Celestia for service providers"; Introductory text modified for clarity.
tutorials/prompt-scavenger.md New tutorial introduced detailing setup and interaction with Celestia’s Node API and OpenAI’s GPT-3.5; new utility function gpt3 added.
tutorials/rust-client-tutorial.md Introductory text modified for clarity: "This section tutorial" → "This tutorial section."

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • jcstein

Poem

🐇 In the land of code where rabbits play,
Tutorials bloom in a bright new way.
With clearer words and paths to explore,
Celestia's secrets, we now adore!
From blobs to prompts, our journey's begun,
Hopping through code, oh what fun! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
tutorials/prompt-scavenger.md (3)

Line range hint 297-324: Consider parameterizing network-specific values

The function works well but has hardcoded values that could limit its reusability:

  1. Gas price is fixed to default
  2. Explorer URL is specific to Arabica network

Consider making these configurable:

 func createAndSubmitBlob(
 	ctx context.Context,
 	client *nodeclient.Client,
 	ns share.Namespace,
 	payload string,
+	gasPrice uint64,
+	explorerURL string,
 ) (*blob.Blob, uint64, error) {
 	createdBlob, err := blob.NewBlobV0(ns, []byte(payload))
 	if err != nil {
 		return nil, 0, fmt.Errorf("Failed to create blob: %w", err)
 	}
-	height, err := client.Blob.Submit(ctx, []*blob.Blob{createdBlob}, blob.DefaultGasPrice())
+	height, err := client.Blob.Submit(ctx, []*blob.Blob{createdBlob}, gasPrice)
 	if err != nil {
 		return nil, 0, fmt.Errorf("Failed to submit blob: %v", err)
 	}
 	log.Printf("Blob submitted successfully at height: %d! \n", height)
-	log.Printf("Explorer link: https://arabica.celenium.io/block/%d \n", height)
+	log.Printf("Explorer link: %s/block/%d \n", explorerURL, height)
 	return createdBlob, height, nil
 }
🧰 Tools
🪛 LanguageTool

[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...

(IN_ORDER_TO_PREMIUM)


Line range hint 442-471: Enhance security and reliability of OpenAI API interaction

Consider the following security and reliability improvements:

  1. Add context timeout for API calls
  2. Consider providing a more secure way to handle API keys

Apply these improvements:

 func gpt3(ctx context.Context, msg string) (string, error) {
+    // Add timeout to prevent hanging
+    ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
+    defer cancel()
+
     openAIKey := os.Getenv("OPENAI_KEY")
    	if openAIKey == "" {
     	return "", fmt.Errorf("OPENAI_KEY environment variable not set")
     }
+    
+    // Consider using a secrets manager in production
     client := openai.NewClient(openAIKey)
     resp, err := client.CreateChatCompletion(
 		ctx,
         openai.ChatCompletionRequest{
             Model: openai.GPT3Dot5Turbo,
             Messages: []openai.ChatCompletionMessage{
                 {
                     Role:    openai.ChatMessageRoleUser,
                     Content: msg,
                 },
             },
         },
     )

Don't forget to add the time package to imports:

+import "time"
🧰 Tools
🪛 LanguageTool

[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...

(IN_ORDER_TO_PREMIUM)


Line range hint 475-527: Enhance error handling and add graceful shutdown

The main function works well but could benefit from these improvements:

  1. Add signal handling for graceful shutdown
  2. Improve error messages for better user experience

Consider these improvements:

+import (
+    "os/signal"
+    "syscall"
+)

 func main() {
 	ctx, cancel := context.WithCancel(context.Background())
+    
+    // Setup signal handling
+    sigChan := make(chan os.Signal, 1)
+    signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
+    go func() {
+        <-sigChan
+        log.Println("Shutting down gracefully...")
+        cancel()
+    }()
+
 	defer cancel()

 	if len(os.Args) != 4 {
-		log.Fatal("Usage: go run main.go <nodeIP> <namespace> <prompt>")
+		log.Fatal("Error: Incorrect number of arguments\n\n" +
+			"Usage: go run main.go <nodeIP> <namespace> <prompt>\n" +
+			"Example: go run main.go ws://localhost:26658 ce1e5714 'What is a modular blockchain?'")
 	}
 	
 	// ... rest of the code ...
 	
 	client, err := nodeclient.NewClient(ctx, nodeIP, "")
 	if err != nil {
-		log.Fatalf("Failed to create client: %v", err)
+		log.Fatalf("Error connecting to node at %s: %v\n"+
+			"Please ensure your Celestia node is running and accessible.", nodeIP, err)
 	}
 	defer client.Close()
🧰 Tools
🪛 LanguageTool

[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...

(IN_ORDER_TO_PREMIUM)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ecf496e and cbd33d6.

📒 Files selected for processing (4)
  • tutorials/golang-client-tutorial.md (1 hunks)
  • tutorials/integrate-celestia.md (1 hunks)
  • tutorials/prompt-scavenger.md (1 hunks)
  • tutorials/rust-client-tutorial.md (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • tutorials/golang-client-tutorial.md
  • tutorials/integrate-celestia.md
  • tutorials/rust-client-tutorial.md
🔇 Additional comments (2)
tutorials/prompt-scavenger.md (2)

83-83: LGTM: Text correction improves readability

The removal of the redundant "order" word makes the sentence clearer and more concise.


Line range hint 279-290: LGTM: Well-structured namespace conversion function

The function properly handles hex string conversion with appropriate error handling and clear documentation.

🧰 Tools
🪛 LanguageTool

[style] ~82-~82: Consider a shorter alternative to avoid wordiness.
Context: ...for an account and generate an API key. In order to sign up for an account and generate an ...

(IN_ORDER_TO_PREMIUM)

@jcstein jcstein merged commit 8bbd033 into celestiaorg:main Nov 6, 2024
2 checks passed
Copy link

gitpoap-bot bot commented Nov 6, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 Celestia Contributor:

GitPOAP: 2024 Celestia Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

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