### Install Vibe Python Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Installs the Vibe Python package using pip or from source. Requires Python 3.7+ and specific versions of openai and requests. ```bash pip install vibepygo ``` ```bash git clone https://github.com/qqqqqf-q/vibe_pygo.git cd vibepygo pip install . ``` -------------------------------- ### Quick Start: Execute Python Code Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Demonstrates the basic usage of the vibe_python library to execute a simple Python string. It includes setting API key, model, and executing a print statement. ```python import vibe_python # Configure API settings vibe_python.set_api_key("your_api_key_here") vibe_python.set_model("gpt-4") vibe_python.set_api_url("https://api.openai.com/v1") # Execute Python code result = vibe_python.run_vibe("print('Hello, World!')") print(result) # Output: Hello, World! ``` -------------------------------- ### Vibe Python Command Line Interface Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Provides examples of using the vibe_pygo command-line tool to execute Python scripts, with options for custom settings, local execution, and custom API URLs. ```bash # Execute a Python file vibepygo script.py # With custom settings vibepygo script.py --api-key your_key --model gpt-4 # Local execution vibepygo script.py --local # Custom API URL vibepygo script.py --api-url https://custom-api.com/v1 ``` -------------------------------- ### Execute Python Code String Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Example of executing a multi-line Python code string using vibe_python.run_vibe, including a simple calculation and printing the result. ```python import vibe_python # Configure vibe_python.set_api_key("your_key") vibe_python.set_model("gpt-4") # Simple calculation code = """ x = 10 y = 20 print(f"Sum: {x + y}") """ result = vibe_python.run_vibe(code) print(result) # Output: Sum: 30 ``` -------------------------------- ### Programmatic API Configuration Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Illustrates how to programmatically set API key, model, API URL, and temperature using the vibe_python library. Also shows how to retrieve the current configuration. ```python import vibe_python # Set API key vibe_python.set_api_key("your_api_key_here") # Set model name vibe_python.set_model("gpt-4") # Set API URL (for custom endpoints) vibe_python.set_api_url("https://api.openai.com/v1") # Set temperature (0.0 to 2.0) vibe_python.set_temperature(0.7) # Get current configuration config = vibe_python.get_config() print(config.get_config_dict()) ``` -------------------------------- ### Configure API Settings via Environment Variables Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Shows how to configure Vibe Python's API settings using environment variables for API key, model, and API URL. ```bash export OPENAI_API_KEY="your_api_key_here" export OPENAI_MODEL="gpt-4" export OPENAI_API_URL="https://api.openai.com/v1" ``` -------------------------------- ### Execute Python File Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Demonstrates how to execute a Python script file using the vibe_python.run_vibe function. ```python import vibe_python # Configure vibe_python.set_api_key("your_key") # Execute a Python file result = vibe_python.run_vibe("my_script.py") print(result) ``` -------------------------------- ### Test Vibe Python with Custom Settings Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Demonstrates how to configure Vibe Python with custom API settings and then run a test code snippet to verify functionality. ```python import vibe_python # Configure with your settings vibe_python.set_api_key("your_key") vibe_python.set_model("gpt-4") vibe_python.set_temperature(0.5) # Test simple code result = vibe_python.run_vibe(""" import math print(f"Square root of 16: {math.sqrt(16)}") for i in range(3): print(f"Count: {i}") """) print(result) ``` -------------------------------- ### Run Pytest Suite Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Command to execute the project's test suite using pytest, useful for verifying the library's functionality. ```bash pytest tests/ -v ``` -------------------------------- ### Advanced Usage: Custom Temperature Settings Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Explains how to adjust the `temperature` parameter for different execution behaviors, from deterministic to more creative outputs. ```python import vibe_python # Set different temperature values for different use cases vibe_python.set_temperature(0.0) # Deterministic output result1 = vibe_python.run_vibe("print('Deterministic')") vibe_python.set_temperature(1.0) # More creative output result2 = vibe_python.run_vibe("print('Creative')") ``` -------------------------------- ### Local Execution Fallback Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Shows how to execute Python code locally without using the OpenAI API by setting the `use_local` parameter to True. ```python import vibe_python # Execute locally without using OpenAI API result = vibe_python.run_vibe("print('Local execution')", use_local=True) print(result) ``` -------------------------------- ### Advanced Usage: Batch Processing Files Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Shows how to process multiple Python files in a batch using Vibe Python, including error handling for each file execution. ```python import vibe_python # Configure once vibe_python.set_api_key("your_key") vibe_python.set_model("gpt-4") # Process multiple files files = ["script1.py", "script2.py", "script3.py"] results = [] for file in files: try: result = vibe_python.run_vibe(file) results.append({"file": file, "result": result, "success": True}) except Exception as e: results.append({"file": file, "error": str(e), "success": False}) # Print results for r in results: print(f"{r['file']}: {'✓' if r['success'] else '✗'}") ``` -------------------------------- ### Handle Code Execution Errors Source: https://github.com/qqqqqf-q/vibe_pygo/blob/main/README.md Illustrates how Vibe Python handles and reports errors during code execution, such as using undefined variables. ```python import vibe_python # Code with error error_code = "print(undefined_variable)" result = vibe_python.run_vibe(error_code) print(result) # Will show the error message ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.