From 46efd41581c794076b43e8543855359fdafb927d Mon Sep 17 00:00:00 2001 From: Ajay Kumar K V <112631909+Ajaykumarkv17@users.noreply.github.com> Date: Sat, 26 Oct 2024 19:19:29 +0000 Subject: [PATCH 1/2] updated --- myenv/bin/Activate.ps1 | 247 ++++++++++++++++ myenv/bin/activate | 70 +++++ myenv/bin/activate.csh | 27 ++ myenv/bin/activate.fish | 69 +++++ myenv/bin/debugpy | 8 + myenv/bin/distro | 8 + myenv/bin/f2py | 8 + myenv/bin/httpx | 8 + myenv/bin/ipython | 8 + myenv/bin/ipython3 | 8 + myenv/bin/jp.py | 54 ++++ myenv/bin/jupyter | 8 + myenv/bin/jupyter-kernel | 8 + myenv/bin/jupyter-kernelspec | 8 + myenv/bin/jupyter-migrate | 8 + myenv/bin/jupyter-run | 8 + myenv/bin/jupyter-troubleshoot | 8 + myenv/bin/llamaindex-cli | 8 + myenv/bin/llamaindex-legacy-cli | 8 + myenv/bin/nltk | 8 + myenv/bin/normalizer | 8 + myenv/bin/openai | 8 + myenv/bin/pip | 8 + myenv/bin/pip3 | 8 + myenv/bin/pip3.12 | 8 + myenv/bin/pygmentize | 8 + myenv/bin/pyrsa-decrypt | 8 + myenv/bin/pyrsa-encrypt | 8 + myenv/bin/pyrsa-keygen | 8 + myenv/bin/pyrsa-priv2pub | 8 + myenv/bin/pyrsa-sign | 8 + myenv/bin/pyrsa-verify | 8 + myenv/bin/python | 1 + myenv/bin/python3 | 1 + myenv/bin/python3.12 | 1 + myenv/bin/striprtf | 27 ++ myenv/bin/tqdm | 8 + .../site/python3.12/greenlet/greenlet.h | 164 +++++++++++ myenv/lib64 | 1 + myenv/pyvenv.cfg | 5 + .../share/jupyter/kernels/python3/kernel.json | 14 + .../jupyter/kernels/python3/logo-32x32.png | Bin 0 -> 1084 bytes .../jupyter/kernels/python3/logo-64x64.png | Bin 0 -> 2180 bytes .../jupyter/kernels/python3/logo-svg.svg | 265 ++++++++++++++++++ myenv/share/man/man1/ipython.1 | 60 ++++ requirements.txt | 1 + src/beyondllm/llms/__init__.py | 3 +- src/beyondllm/llms/bedrock.py | 208 ++++++++++++++ .../llms/beyondllm_with_bedrock.ipynb | 93 ++++++ 49 files changed, 1534 insertions(+), 1 deletion(-) create mode 100644 myenv/bin/Activate.ps1 create mode 100644 myenv/bin/activate create mode 100644 myenv/bin/activate.csh create mode 100644 myenv/bin/activate.fish create mode 100755 myenv/bin/debugpy create mode 100755 myenv/bin/distro create mode 100755 myenv/bin/f2py create mode 100755 myenv/bin/httpx create mode 100755 myenv/bin/ipython create mode 100755 myenv/bin/ipython3 create mode 100755 myenv/bin/jp.py create mode 100755 myenv/bin/jupyter create mode 100755 myenv/bin/jupyter-kernel create mode 100755 myenv/bin/jupyter-kernelspec create mode 100755 myenv/bin/jupyter-migrate create mode 100755 myenv/bin/jupyter-run create mode 100755 myenv/bin/jupyter-troubleshoot create mode 100755 myenv/bin/llamaindex-cli create mode 100755 myenv/bin/llamaindex-legacy-cli create mode 100755 myenv/bin/nltk create mode 100755 myenv/bin/normalizer create mode 100755 myenv/bin/openai create mode 100755 myenv/bin/pip create mode 100755 myenv/bin/pip3 create mode 100755 myenv/bin/pip3.12 create mode 100755 myenv/bin/pygmentize create mode 100755 myenv/bin/pyrsa-decrypt create mode 100755 myenv/bin/pyrsa-encrypt create mode 100755 myenv/bin/pyrsa-keygen create mode 100755 myenv/bin/pyrsa-priv2pub create mode 100755 myenv/bin/pyrsa-sign create mode 100755 myenv/bin/pyrsa-verify create mode 120000 myenv/bin/python create mode 120000 myenv/bin/python3 create mode 120000 myenv/bin/python3.12 create mode 100755 myenv/bin/striprtf create mode 100755 myenv/bin/tqdm create mode 100644 myenv/include/site/python3.12/greenlet/greenlet.h create mode 120000 myenv/lib64 create mode 100644 myenv/pyvenv.cfg create mode 100644 myenv/share/jupyter/kernels/python3/kernel.json create mode 100644 myenv/share/jupyter/kernels/python3/logo-32x32.png create mode 100644 myenv/share/jupyter/kernels/python3/logo-64x64.png create mode 100644 myenv/share/jupyter/kernels/python3/logo-svg.svg create mode 100644 myenv/share/man/man1/ipython.1 create mode 100644 src/beyondllm/llms/bedrock.py create mode 100644 src/beyondllm/llms/beyondllm_with_bedrock.ipynb diff --git a/myenv/bin/Activate.ps1 b/myenv/bin/Activate.ps1 new file mode 100644 index 0000000..b49d77b --- /dev/null +++ b/myenv/bin/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove VIRTUAL_ENV_PROMPT altogether. + if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { + Remove-Item -Path env:VIRTUAL_ENV_PROMPT + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } + $env:VIRTUAL_ENV_PROMPT = $Prompt +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/myenv/bin/activate b/myenv/bin/activate new file mode 100644 index 0000000..e2d1915 --- /dev/null +++ b/myenv/bin/activate @@ -0,0 +1,70 @@ +# This file must be used with "source bin/activate" *from bash* +# You cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # Call hash to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + hash -r 2> /dev/null + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +# on Windows, a path can contain colons and backslashes and has to be converted: +if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] ; then + # transform D:\path\to\venv to /d/path/to/venv on MSYS + # and to /cygdrive/d/path/to/venv on Cygwin + export VIRTUAL_ENV=$(cygpath "/workspaces/beyondllm/myenv") +else + # use the path as-is + export VIRTUAL_ENV="/workspaces/beyondllm/myenv" +fi + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + PS1="(myenv) ${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT="(myenv) " + export VIRTUAL_ENV_PROMPT +fi + +# Call hash to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +hash -r 2> /dev/null diff --git a/myenv/bin/activate.csh b/myenv/bin/activate.csh new file mode 100644 index 0000000..0c87b69 --- /dev/null +++ b/myenv/bin/activate.csh @@ -0,0 +1,27 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. + +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV "/workspaces/beyondllm/myenv" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = "(myenv) $prompt" + setenv VIRTUAL_ENV_PROMPT "(myenv) " +endif + +alias pydoc python -m pydoc + +rehash diff --git a/myenv/bin/activate.fish b/myenv/bin/activate.fish new file mode 100644 index 0000000..c92d7ed --- /dev/null +++ b/myenv/bin/activate.fish @@ -0,0 +1,69 @@ +# This file must be used with "source /bin/activate.fish" *from fish* +# (https://fishshell.com/). You cannot run it directly. + +function deactivate -d "Exit virtual environment and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + set -e _OLD_FISH_PROMPT_OVERRIDE + # prevents error when using nested fish instances (Issue #93858) + if functions -q _old_fish_prompt + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + end + + set -e VIRTUAL_ENV + set -e VIRTUAL_ENV_PROMPT + if test "$argv[1]" != "nondestructive" + # Self-destruct! + functions -e deactivate + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV "/workspaces/beyondllm/myenv" + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# Unset PYTHONHOME if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # Save the current fish_prompt function as the function _old_fish_prompt. + functions -c fish_prompt _old_fish_prompt + + # With the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command. + set -l old_status $status + + # Output the venv prompt; color taken from the blue of the Python logo. + printf "%s%s%s" (set_color 4B8BBE) "(myenv) " (set_color normal) + + # Restore the return status of the previous command. + echo "exit $old_status" | . + # Output the original/"old" prompt. + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" + set -gx VIRTUAL_ENV_PROMPT "(myenv) " +end diff --git a/myenv/bin/debugpy b/myenv/bin/debugpy new file mode 100755 index 0000000..336659f --- /dev/null +++ b/myenv/bin/debugpy @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from debugpy.server.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/distro b/myenv/bin/distro new file mode 100755 index 0000000..27e37f8 --- /dev/null +++ b/myenv/bin/distro @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from distro.distro import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/f2py b/myenv/bin/f2py new file mode 100755 index 0000000..f2673f8 --- /dev/null +++ b/myenv/bin/f2py @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/httpx b/myenv/bin/httpx new file mode 100755 index 0000000..1d18115 --- /dev/null +++ b/myenv/bin/httpx @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from httpx import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/ipython b/myenv/bin/ipython new file mode 100755 index 0000000..3893bd3 --- /dev/null +++ b/myenv/bin/ipython @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from IPython import start_ipython +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(start_ipython()) diff --git a/myenv/bin/ipython3 b/myenv/bin/ipython3 new file mode 100755 index 0000000..3893bd3 --- /dev/null +++ b/myenv/bin/ipython3 @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from IPython import start_ipython +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(start_ipython()) diff --git a/myenv/bin/jp.py b/myenv/bin/jp.py new file mode 100755 index 0000000..596cfb6 --- /dev/null +++ b/myenv/bin/jp.py @@ -0,0 +1,54 @@ +#!/workspaces/beyondllm/myenv/bin/python3 + +import sys +import json +import argparse +from pprint import pformat + +import jmespath +from jmespath import exceptions + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('expression') + parser.add_argument('-f', '--filename', + help=('The filename containing the input data. ' + 'If a filename is not given then data is ' + 'read from stdin.')) + parser.add_argument('--ast', action='store_true', + help=('Pretty print the AST, do not search the data.')) + args = parser.parse_args() + expression = args.expression + if args.ast: + # Only print the AST + expression = jmespath.compile(args.expression) + sys.stdout.write(pformat(expression.parsed)) + sys.stdout.write('\n') + return 0 + if args.filename: + with open(args.filename, 'r') as f: + data = json.load(f) + else: + data = sys.stdin.read() + data = json.loads(data) + try: + sys.stdout.write(json.dumps( + jmespath.search(expression, data), indent=4, ensure_ascii=False)) + sys.stdout.write('\n') + except exceptions.ArityError as e: + sys.stderr.write("invalid-arity: %s\n" % e) + return 1 + except exceptions.JMESPathTypeError as e: + sys.stderr.write("invalid-type: %s\n" % e) + return 1 + except exceptions.UnknownFunctionError as e: + sys.stderr.write("unknown-function: %s\n" % e) + return 1 + except exceptions.ParseError as e: + sys.stderr.write("syntax-error: %s\n" % e) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/myenv/bin/jupyter b/myenv/bin/jupyter new file mode 100755 index 0000000..49f4877 --- /dev/null +++ b/myenv/bin/jupyter @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_core.command import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/jupyter-kernel b/myenv/bin/jupyter-kernel new file mode 100755 index 0000000..40ce89c --- /dev/null +++ b/myenv/bin/jupyter-kernel @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_client.kernelapp import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/jupyter-kernelspec b/myenv/bin/jupyter-kernelspec new file mode 100755 index 0000000..a47894d --- /dev/null +++ b/myenv/bin/jupyter-kernelspec @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_client.kernelspecapp import KernelSpecApp +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(KernelSpecApp.launch_instance()) diff --git a/myenv/bin/jupyter-migrate b/myenv/bin/jupyter-migrate new file mode 100755 index 0000000..1d70f1f --- /dev/null +++ b/myenv/bin/jupyter-migrate @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_core.migrate import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/jupyter-run b/myenv/bin/jupyter-run new file mode 100755 index 0000000..9447fc3 --- /dev/null +++ b/myenv/bin/jupyter-run @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_client.runapp import RunApp +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(RunApp.launch_instance()) diff --git a/myenv/bin/jupyter-troubleshoot b/myenv/bin/jupyter-troubleshoot new file mode 100755 index 0000000..06a9c0c --- /dev/null +++ b/myenv/bin/jupyter-troubleshoot @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from jupyter_core.troubleshoot import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/llamaindex-cli b/myenv/bin/llamaindex-cli new file mode 100755 index 0000000..efcfbdf --- /dev/null +++ b/myenv/bin/llamaindex-cli @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from llama_index.cli.command_line import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/llamaindex-legacy-cli b/myenv/bin/llamaindex-legacy-cli new file mode 100755 index 0000000..1a9cdec --- /dev/null +++ b/myenv/bin/llamaindex-legacy-cli @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from llama_index.legacy.command_line.command_line import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/nltk b/myenv/bin/nltk new file mode 100755 index 0000000..aa323a3 --- /dev/null +++ b/myenv/bin/nltk @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from nltk.cli import cli +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli()) diff --git a/myenv/bin/normalizer b/myenv/bin/normalizer new file mode 100755 index 0000000..c6e75c1 --- /dev/null +++ b/myenv/bin/normalizer @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/myenv/bin/openai b/myenv/bin/openai new file mode 100755 index 0000000..ab3b5b0 --- /dev/null +++ b/myenv/bin/openai @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from openai.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/pip b/myenv/bin/pip new file mode 100755 index 0000000..1fe7019 --- /dev/null +++ b/myenv/bin/pip @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/pip3 b/myenv/bin/pip3 new file mode 100755 index 0000000..1fe7019 --- /dev/null +++ b/myenv/bin/pip3 @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/pip3.12 b/myenv/bin/pip3.12 new file mode 100755 index 0000000..1fe7019 --- /dev/null +++ b/myenv/bin/pip3.12 @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/pygmentize b/myenv/bin/pygmentize new file mode 100755 index 0000000..a10fe57 --- /dev/null +++ b/myenv/bin/pygmentize @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from pygments.cmdline import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/bin/pyrsa-decrypt b/myenv/bin/pyrsa-decrypt new file mode 100755 index 0000000..e618238 --- /dev/null +++ b/myenv/bin/pyrsa-decrypt @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import decrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(decrypt()) diff --git a/myenv/bin/pyrsa-encrypt b/myenv/bin/pyrsa-encrypt new file mode 100755 index 0000000..a4ab708 --- /dev/null +++ b/myenv/bin/pyrsa-encrypt @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import encrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(encrypt()) diff --git a/myenv/bin/pyrsa-keygen b/myenv/bin/pyrsa-keygen new file mode 100755 index 0000000..1bc4353 --- /dev/null +++ b/myenv/bin/pyrsa-keygen @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import keygen +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(keygen()) diff --git a/myenv/bin/pyrsa-priv2pub b/myenv/bin/pyrsa-priv2pub new file mode 100755 index 0000000..cf47179 --- /dev/null +++ b/myenv/bin/pyrsa-priv2pub @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.util import private_to_public +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(private_to_public()) diff --git a/myenv/bin/pyrsa-sign b/myenv/bin/pyrsa-sign new file mode 100755 index 0000000..f0962ab --- /dev/null +++ b/myenv/bin/pyrsa-sign @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import sign +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(sign()) diff --git a/myenv/bin/pyrsa-verify b/myenv/bin/pyrsa-verify new file mode 100755 index 0000000..7e4d192 --- /dev/null +++ b/myenv/bin/pyrsa-verify @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import verify +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(verify()) diff --git a/myenv/bin/python b/myenv/bin/python new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/myenv/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/myenv/bin/python3 b/myenv/bin/python3 new file mode 120000 index 0000000..eba8551 --- /dev/null +++ b/myenv/bin/python3 @@ -0,0 +1 @@ +/home/codespace/.python/current/bin/python3 \ No newline at end of file diff --git a/myenv/bin/python3.12 b/myenv/bin/python3.12 new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/myenv/bin/python3.12 @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/myenv/bin/striprtf b/myenv/bin/striprtf new file mode 100755 index 0000000..b2fb610 --- /dev/null +++ b/myenv/bin/striprtf @@ -0,0 +1,27 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +import argparse +import sys + +from striprtf.striprtf import rtf_to_text +from striprtf._version import __version__ as version + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "rtf_file", + nargs="?", + type=argparse.FileType("r", encoding="UTF-8"), + default=sys.stdin, + ) + parser.add_argument("--version", action="version", version="%s" % version) + args = parser.parse_args() + in_rtf = args.rtf_file.read() + args.rtf_file.close() + + content = rtf_to_text(in_rtf) + print(content) + + +if __name__ == "__main__": + main() diff --git a/myenv/bin/tqdm b/myenv/bin/tqdm new file mode 100755 index 0000000..f871521 --- /dev/null +++ b/myenv/bin/tqdm @@ -0,0 +1,8 @@ +#!/workspaces/beyondllm/myenv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from tqdm.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/myenv/include/site/python3.12/greenlet/greenlet.h b/myenv/include/site/python3.12/greenlet/greenlet.h new file mode 100644 index 0000000..d02a16e --- /dev/null +++ b/myenv/include/site/python3.12/greenlet/greenlet.h @@ -0,0 +1,164 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */ + +/* Greenlet object interface */ + +#ifndef Py_GREENLETOBJECT_H +#define Py_GREENLETOBJECT_H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is deprecated and undocumented. It does not change. */ +#define GREENLET_VERSION "1.0.0" + +#ifndef GREENLET_MODULE +#define implementation_ptr_t void* +#endif + +typedef struct _greenlet { + PyObject_HEAD + PyObject* weakreflist; + PyObject* dict; + implementation_ptr_t pimpl; +} PyGreenlet; + +#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type)) + + +/* C API functions */ + +/* Total number of symbols that are exported */ +#define PyGreenlet_API_pointers 12 + +#define PyGreenlet_Type_NUM 0 +#define PyExc_GreenletError_NUM 1 +#define PyExc_GreenletExit_NUM 2 + +#define PyGreenlet_New_NUM 3 +#define PyGreenlet_GetCurrent_NUM 4 +#define PyGreenlet_Throw_NUM 5 +#define PyGreenlet_Switch_NUM 6 +#define PyGreenlet_SetParent_NUM 7 + +#define PyGreenlet_MAIN_NUM 8 +#define PyGreenlet_STARTED_NUM 9 +#define PyGreenlet_ACTIVE_NUM 10 +#define PyGreenlet_GET_PARENT_NUM 11 + +#ifndef GREENLET_MODULE +/* This section is used by modules that uses the greenlet C API */ +static void** _PyGreenlet_API = NULL; + +# define PyGreenlet_Type \ + (*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM]) + +# define PyExc_GreenletError \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM]) + +# define PyExc_GreenletExit \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM]) + +/* + * PyGreenlet_New(PyObject *args) + * + * greenlet.greenlet(run, parent=None) + */ +# define PyGreenlet_New \ + (*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \ + _PyGreenlet_API[PyGreenlet_New_NUM]) + +/* + * PyGreenlet_GetCurrent(void) + * + * greenlet.getcurrent() + */ +# define PyGreenlet_GetCurrent \ + (*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM]) + +/* + * PyGreenlet_Throw( + * PyGreenlet *greenlet, + * PyObject *typ, + * PyObject *val, + * PyObject *tb) + * + * g.throw(...) + */ +# define PyGreenlet_Throw \ + (*(PyObject * (*)(PyGreenlet * self, \ + PyObject * typ, \ + PyObject * val, \ + PyObject * tb)) \ + _PyGreenlet_API[PyGreenlet_Throw_NUM]) + +/* + * PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args) + * + * g.switch(*args, **kwargs) + */ +# define PyGreenlet_Switch \ + (*(PyObject * \ + (*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \ + _PyGreenlet_API[PyGreenlet_Switch_NUM]) + +/* + * PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent) + * + * g.parent = new_parent + */ +# define PyGreenlet_SetParent \ + (*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \ + _PyGreenlet_API[PyGreenlet_SetParent_NUM]) + +/* + * PyGreenlet_GetParent(PyObject* greenlet) + * + * return greenlet.parent; + * + * This could return NULL even if there is no exception active. + * If it does not return NULL, you are responsible for decrementing the + * reference count. + */ +# define PyGreenlet_GetParent \ + (*(PyGreenlet* (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_GET_PARENT_NUM]) + +/* + * deprecated, undocumented alias. + */ +# define PyGreenlet_GET_PARENT PyGreenlet_GetParent + +# define PyGreenlet_MAIN \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_MAIN_NUM]) + +# define PyGreenlet_STARTED \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_STARTED_NUM]) + +# define PyGreenlet_ACTIVE \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_ACTIVE_NUM]) + + + + +/* Macro that imports greenlet and initializes C API */ +/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we + keep the older definition to be sure older code that might have a copy of + the header still works. */ +# define PyGreenlet_Import() \ + { \ + _PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \ + } + +#endif /* GREENLET_MODULE */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GREENLETOBJECT_H */ diff --git a/myenv/lib64 b/myenv/lib64 new file mode 120000 index 0000000..7951405 --- /dev/null +++ b/myenv/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/myenv/pyvenv.cfg b/myenv/pyvenv.cfg new file mode 100644 index 0000000..5aff01a --- /dev/null +++ b/myenv/pyvenv.cfg @@ -0,0 +1,5 @@ +home = /home/codespace/.python/current/bin +include-system-site-packages = false +version = 3.12.1 +executable = /usr/local/python/3.12.1/bin/python3.12 +command = /home/codespace/.python/current/bin/python3 -m venv /workspaces/beyondllm/myenv diff --git a/myenv/share/jupyter/kernels/python3/kernel.json b/myenv/share/jupyter/kernels/python3/kernel.json new file mode 100644 index 0000000..cca38a4 --- /dev/null +++ b/myenv/share/jupyter/kernels/python3/kernel.json @@ -0,0 +1,14 @@ +{ + "argv": [ + "python", + "-m", + "ipykernel_launcher", + "-f", + "{connection_file}" + ], + "display_name": "Python 3 (ipykernel)", + "language": "python", + "metadata": { + "debugger": true + } +} \ No newline at end of file diff --git a/myenv/share/jupyter/kernels/python3/logo-32x32.png b/myenv/share/jupyter/kernels/python3/logo-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..be81330765764699553aa4fbaf0e9fc27c20c6d2 GIT binary patch literal 1084 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 + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/myenv/share/man/man1/ipython.1 b/myenv/share/man/man1/ipython.1 new file mode 100644 index 0000000..0f4a191 --- /dev/null +++ b/myenv/share/man/man1/ipython.1 @@ -0,0 +1,60 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH IPYTHON 1 "July 15, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) and groff_man(7) +.\" .SH section heading +.\" .SS secondary section heading +.\" +.\" +.\" To preview this page as plain text: nroff -man ipython.1 +.\" +.SH NAME +ipython \- Tools for Interactive Computing in Python. +.SH SYNOPSIS +.B ipython +.RI [ options ] " files" ... + +.B ipython subcommand +.RI [ options ] ... + +.SH DESCRIPTION +An interactive Python shell with automatic history (input and output), dynamic +object introspection, easier configuration, command completion, access to the +system shell, integration with numerical and scientific computing tools, +web notebook, Qt console, and more. + +For more information on how to use IPython, see 'ipython \-\-help', +or 'ipython \-\-help\-all' for all available command\(hyline options. + +.SH "ENVIRONMENT VARIABLES" +.sp +.PP +\fIIPYTHONDIR\fR +.RS 4 +This is the location where IPython stores all its configuration files. The default +is $HOME/.ipython if IPYTHONDIR is not defined. + +You can see the computed value of IPYTHONDIR with `ipython locate`. + +.SH FILES + +IPython uses various configuration files stored in profiles within IPYTHONDIR. +To generate the default configuration files and start configuring IPython, +do 'ipython profile create', and edit '*_config.py' files located in +IPYTHONDIR/profile_default. + +.SH AUTHORS +IPython is written by the IPython Development Team . diff --git a/requirements.txt b/requirements.txt index 3a23689..e788ad6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -85,3 +85,4 @@ tzdata==2024.1 ; python_version >= "3.9" and python_version < "3.12" urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.12" wrapt==1.16.0 ; python_version >= "3.9" and python_version < "3.12" yarl==1.9.4 ; python_version >= "3.9" and python_version < "3.12" +boto3==1.28.57 diff --git a/src/beyondllm/llms/__init__.py b/src/beyondllm/llms/__init__.py index 255f364..826eba1 100644 --- a/src/beyondllm/llms/__init__.py +++ b/src/beyondllm/llms/__init__.py @@ -8,4 +8,5 @@ from .gpt4o import GPT4oOpenAIModel from .chatgroq import GroqModel from .claude import ClaudeModel -from .mistral import MistralModel \ No newline at end of file +from .mistral import MistralModel +from .bedrock import BedrockModel \ No newline at end of file diff --git a/src/beyondllm/llms/bedrock.py b/src/beyondllm/llms/bedrock.py new file mode 100644 index 0000000..2e8dd48 --- /dev/null +++ b/src/beyondllm/llms/bedrock.py @@ -0,0 +1,208 @@ +from beyondllm.llms.base import BaseLLMModel, ModelConfig +from typing import Any, Dict, List, Optional +import os +from dataclasses import dataclass, field +import json +import boto3 +import botocore + +@dataclass +class BedrockModel: + """ + Class representing AWS Bedrock service for accessing various LLMs + + Authentication Methods (in order of precedence): + 1. Explicitly provided credentials in constructor + 2. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) + 3. AWS credentials file (~/.aws/credentials) + 4. IAM role (if running on AWS) + + Example: + from beyondllm.llms import BedrockModel + + # Method 1: Using environment variables (recommended) + # First set these environment variables: + # export AWS_ACCESS_KEY_ID="your_access_key" + # export AWS_SECRET_ACCESS_KEY="your_secret_key" + # export AWS_DEFAULT_REGION="us-east-1" + llm = BedrockModel(model_id="anthropic.claude-instant-v1") + + # Method 2: Using AWS profile + llm = BedrockModel( + model_id="anthropic.claude-instant-v1", + profile_name="my-aws-profile" + ) + + # Method 3: Explicit credentials (not recommended for production) + llm = BedrockModel( + model_id="anthropic.claude-instant-v1", + aws_access_key_id="your_access_key", + aws_secret_access_key="your_secret_key", + region="us-east-1" + ) + """ + model_id: str = field(default="anthropic.claude-instant-v1") + region: str = field(default="") + model_kwargs: dict = field(default_factory=lambda: { + "max_tokens_to_sample": 500, + "temperature": 0, + "top_p": 1, + }) + aws_access_key_id: str = field(default="") + aws_secret_access_key: str = field(default="") + profile_name: str = field(default="") + + def __post_init__(self): + # Set region from environment if not provided + if not self.region: + self.region = os.getenv("AWS_DEFAULT_REGION", "us-east-1") + + # Set credentials from environment if not provided + if not self.aws_access_key_id: + self.aws_access_key_id = os.getenv("AWS_ACCESS_KEY_ID", "") + if not self.aws_secret_access_key: + self.aws_secret_access_key = os.getenv("AWS_SECRET_ACCESS_KEY", "") + + self.load_llm() + + def _get_bedrock_client(self): + """ + Creates and returns a boto3 client for Amazon Bedrock Runtime + """ + try: + session_kwargs = {"region_name": self.region} + + # If profile is specified, use it + if self.profile_name: + session_kwargs["profile_name"] = self.profile_name + # If explicit credentials are provided, use them + elif self.aws_access_key_id and self.aws_secret_access_key: + session_kwargs["aws_access_key_id"] = self.aws_access_key_id + session_kwargs["aws_secret_access_key"] = self.aws_secret_access_key + + # Create session with retry configuration + retry_config = botocore.config.Config( + region_name=self.region, + retries={ + "max_attempts": 10, + "mode": "standard" + } + ) + + session = boto3.Session(**session_kwargs) + + # Create the Bedrock Runtime client + bedrock_client = session.client( + service_name='bedrock-runtime', + config=retry_config + ) + + + + return bedrock_client + + except botocore.exceptions.ProfileNotFound: + raise ValueError(f"AWS profile '{self.profile_name}' not found in credentials file") + except botocore.exceptions.NoCredentialsError: + raise ValueError( + "No AWS credentials found. Please provide credentials using one of these methods:\n" + "1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)\n" + "2. AWS credentials file (~/.aws/credentials)\n" + "3. IAM role (if running on AWS)\n" + "4. Explicit credentials in constructor" + ) + except Exception as e: + raise Exception(f"Failed to initialize Bedrock client: {str(e)}") + + def load_llm(self): + """ + Initialize the Bedrock client + """ + self.client = self._get_bedrock_client() + return self.client + + def _format_prompt(self, prompt: str) -> Dict: + """ + Format the prompt based on the model provider + """ + if self.model_id.startswith("anthropic."): + return { + "prompt": f"\n\nHuman: {prompt}\n\nAssistant:", + "max_tokens_to_sample": self.model_kwargs.get("max_tokens_to_sample", 500), + "temperature": self.model_kwargs.get("temperature", 0), + "top_p": self.model_kwargs.get("top_p", 1), + } + + elif self.model_id.startswith("meta."): + return{ + "prompt": prompt + } + elif self.model_id.startswith("amazon."): + return { + "inputText": prompt, + + } + elif self.model_id.startswith("ai21."): + return { + "prompt": prompt, + "maxTokens": self.model_kwargs.get("max_tokens_to_sample", 500), + "temperature": self.model_kwargs.get("temperature", 0), + **self.model_kwargs + } + else: + raise ValueError(f"Unsupported model provider in model_id: {self.model_id}") + + def _parse_response(self, response: Dict) -> str: + """ + Parse the response based on the model provider + """ + response_body = json.loads(response.get("body").read()) + + if self.model_id.startswith("anthropic."): + return response_body.get("completion", "") + elif self.model_id.startswith("amazon."): + return response_body.get("results", [{}])[0].get("outputText", "") + elif self.model_id.startswith("ai21."): + return response_body.get("completions", [{}])[0].get("data", {}).get("text", "") + + elif self.model_id.startswith("meta."): + return response_body.get("generation") + else: + raise ValueError(f"Unsupported model provider in model_id: {self.model_id}") + + def predict(self, prompt: Any) -> str: + """ + Generate prediction using the Bedrock model + + Parameters: + prompt (Any): Input prompt for generation + + Returns: + str: Generated text response + """ + try: + # Format the request body based on the model provider + body = self._format_prompt(prompt) + + # Invoke the model + response = self.client.invoke_model( + body=json.dumps(body), + modelId=self.model_id, + accept="application/json", + contentType="application/json" + ) + + # Parse and return the response + return self._parse_response(response) + + except Exception as e: + raise Exception(f"Error in prediction: {str(e)}") + + @staticmethod + def load_from_kwargs(self, kwargs): + """ + Load model configuration from kwargs + """ + model_config = ModelConfig(**kwargs) + self.config = model_config + self.load_llm() \ No newline at end of file diff --git a/src/beyondllm/llms/beyondllm_with_bedrock.ipynb b/src/beyondllm/llms/beyondllm_with_bedrock.ipynb new file mode 100644 index 0000000..78c3e98 --- /dev/null +++ b/src/beyondllm/llms/beyondllm_with_bedrock.ipynb @@ -0,0 +1,93 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " <>\n", + "\n", + "**Title:** \"The Art of Strong Business Decisions: A Leader's Guide\"\n", + "\n", + "**Introduction:**\n", + "\n", + "As a leader, making strong business decisions is crucial to the success of your organization. It requires a combination of strategic thinking, analytical skills, and effective communication. In this blog, we will explore the key principles and best practices for making informed and effective business decisions as a leader.\n", + "\n", + "**1. Define Your Goals and Objectives:**\n", + "\n", + "Before making any decision, it's essential to define your goals and objectives. What are your company's mission, vision, and values? What are your short-term and long-term goals? What are the key performance indicators (KPIs) that will measure your success? By having a clear understanding of your goals and objectives, you will be able to make decisions that align with your company's overall strategy.\n", + "\n", + "**2. Gather and Analyze Data:**\n", + "\n", + "Data is the foundation of informed decision-making. Gather relevant data and analyze it to identify trends, patterns, and correlations. This will help you to make data-driven decisions rather than relying on intuition or personal biases. Use tools such as spreadsheets, charts, and graphs to visualize the data and make it easier to understand.\n", + "\n", + "**3. Consider Multiple Perspectives:**\n", + "\n", + "No one person has all the answers. Consider multiple perspectives and opinions to get a well-rounded view of the situation. This will help you to identify potential risks and opportunities that you may not have considered otherwise. Encourage open communication and collaboration among your team members to foster a culture of shared knowledge and expertise.\n", + "\n", + "**4. Weigh the Pros and Cons:**\n", + "\n", + "When evaluating a decision, weigh the pros and cons carefully. Consider the potential benefits and drawbacks of each option, and think about the potential impact on your company and its stakeholders. Use a decision-making framework such as a pros and cons list, a SWOT analysis, or a decision tree to help you evaluate the options.\n", + "\n", + "**5. Trust Your Instincts:**\n", + "\n", + "While data and analysis are important, they are not the only factors to consider. Trust your instincts and use your experience and judgment to make decisions. As a leader, you have a unique perspective and understanding of your company and its industry. Use this insight to inform your decisions and make adjustments as needed.\n", + "\n", + "**6. Be Flexible and Adaptable:**\n", + "\n", + "Business decisions are not set in stone. Be prepared to adjust your decisions as new information becomes available or as circumstances change. Stay flexible and adaptable, and be willing to pivot when necessary.\n", + "\n", + "**Conclusion:**\n", + "\n", + "\n" + ] + } + ], + "source": [ + "\n", + "from bedrock import BedrockModel\n", + "\n", + "\n", + "llm = BedrockModel(\n", + " model_id=\"meta.llama3-8b-instruct-v1:0\"\n", + ")\n", + "\n", + "prompt=\"\"\"[INST] <>\n", + "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n", + "If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n", + "<>\n", + "\n", + "Write me a blog about making strong business decisions as a leader. [/INST]\"\"\"\n", + "resp=llm.predict(prompt=prompt)\n", + "\n", + "print(resp)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "myenv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From e1f2b05074ada23904b904fecf840cf346338e50 Mon Sep 17 00:00:00 2001 From: Ajay Kumar K V <112631909+Ajaykumarkv17@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:10:31 +0000 Subject: [PATCH 2/2] updated --- src/beyondllm/llms/bedrock.py | 48 ++++++++-- .../llms/beyondllm_with_bedrock.ipynb | 93 ------------------- 2 files changed, 41 insertions(+), 100 deletions(-) delete mode 100644 src/beyondllm/llms/beyondllm_with_bedrock.ipynb diff --git a/src/beyondllm/llms/bedrock.py b/src/beyondllm/llms/bedrock.py index 2e8dd48..050de56 100644 --- a/src/beyondllm/llms/bedrock.py +++ b/src/beyondllm/llms/bedrock.py @@ -41,7 +41,7 @@ class BedrockModel: region="us-east-1" ) """ - model_id: str = field(default="anthropic.claude-instant-v1") + model_id: str = field(default="anthropic.claude-3-haiku-20240307-v1:0") region: str = field(default="") model_kwargs: dict = field(default_factory=lambda: { "max_tokens_to_sample": 500, @@ -127,10 +127,18 @@ def _format_prompt(self, prompt: str) -> Dict: """ if self.model_id.startswith("anthropic."): return { - "prompt": f"\n\nHuman: {prompt}\n\nAssistant:", - "max_tokens_to_sample": self.model_kwargs.get("max_tokens_to_sample", 500), + "anthropic_version": "bedrock-2023-05-31", + "max_tokens": self.model_kwargs.get("max_tokens_to_sample", 500), "temperature": self.model_kwargs.get("temperature", 0), "top_p": self.model_kwargs.get("top_p", 1), + "messages": [ + { + "role": "user", + "content": [ + {"type": "text", "text": prompt} + ] + } + ] } elif self.model_id.startswith("meta."): @@ -142,12 +150,22 @@ def _format_prompt(self, prompt: str) -> Dict: "inputText": prompt, } + elif self.model_id.startswith("ai21."): return { "prompt": prompt, - "maxTokens": self.model_kwargs.get("max_tokens_to_sample", 500), - "temperature": self.model_kwargs.get("temperature", 0), - **self.model_kwargs + "maxTokens": self.model_kwargs.get("max_tokens_to_sample", 200), + "temperature": self.model_kwargs.get("temperature", 0.5), + "topP": self.model_kwargs.get("top_p", 0.5) + } + elif self.model_id.startswith("mistral."): + return { + "messages": [ + { + "role": "user", + "content": prompt + } + ] } else: raise ValueError(f"Unsupported model provider in model_id: {self.model_id}") @@ -159,7 +177,12 @@ def _parse_response(self, response: Dict) -> str: response_body = json.loads(response.get("body").read()) if self.model_id.startswith("anthropic."): - return response_body.get("completion", "") + # Extract the text content from the response + messages = response_body.get("content", []) + for message in messages: + if message.get("type") == "text": + return message.get("text", "") + return "" elif self.model_id.startswith("amazon."): return response_body.get("results", [{}])[0].get("outputText", "") elif self.model_id.startswith("ai21."): @@ -167,6 +190,17 @@ def _parse_response(self, response: Dict) -> str: elif self.model_id.startswith("meta."): return response_body.get("generation") + elif self.model_id.startswith("ai21."): + + completions = response_body.get("completions", []) + if completions and "data" in completions[0]: + return completions[0]["data"].get("text", "") + return "" + + elif self.model_id.startswith("mistral."): + # Mistral models respond with a body containing the formatted messages + return response_body.get("messages", [{}])[0].get("content", "") + else: raise ValueError(f"Unsupported model provider in model_id: {self.model_id}") diff --git a/src/beyondllm/llms/beyondllm_with_bedrock.ipynb b/src/beyondllm/llms/beyondllm_with_bedrock.ipynb deleted file mode 100644 index 78c3e98..0000000 --- a/src/beyondllm/llms/beyondllm_with_bedrock.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " <>\n", - "\n", - "**Title:** \"The Art of Strong Business Decisions: A Leader's Guide\"\n", - "\n", - "**Introduction:**\n", - "\n", - "As a leader, making strong business decisions is crucial to the success of your organization. It requires a combination of strategic thinking, analytical skills, and effective communication. In this blog, we will explore the key principles and best practices for making informed and effective business decisions as a leader.\n", - "\n", - "**1. Define Your Goals and Objectives:**\n", - "\n", - "Before making any decision, it's essential to define your goals and objectives. What are your company's mission, vision, and values? What are your short-term and long-term goals? What are the key performance indicators (KPIs) that will measure your success? By having a clear understanding of your goals and objectives, you will be able to make decisions that align with your company's overall strategy.\n", - "\n", - "**2. Gather and Analyze Data:**\n", - "\n", - "Data is the foundation of informed decision-making. Gather relevant data and analyze it to identify trends, patterns, and correlations. This will help you to make data-driven decisions rather than relying on intuition or personal biases. Use tools such as spreadsheets, charts, and graphs to visualize the data and make it easier to understand.\n", - "\n", - "**3. Consider Multiple Perspectives:**\n", - "\n", - "No one person has all the answers. Consider multiple perspectives and opinions to get a well-rounded view of the situation. This will help you to identify potential risks and opportunities that you may not have considered otherwise. Encourage open communication and collaboration among your team members to foster a culture of shared knowledge and expertise.\n", - "\n", - "**4. Weigh the Pros and Cons:**\n", - "\n", - "When evaluating a decision, weigh the pros and cons carefully. Consider the potential benefits and drawbacks of each option, and think about the potential impact on your company and its stakeholders. Use a decision-making framework such as a pros and cons list, a SWOT analysis, or a decision tree to help you evaluate the options.\n", - "\n", - "**5. Trust Your Instincts:**\n", - "\n", - "While data and analysis are important, they are not the only factors to consider. Trust your instincts and use your experience and judgment to make decisions. As a leader, you have a unique perspective and understanding of your company and its industry. Use this insight to inform your decisions and make adjustments as needed.\n", - "\n", - "**6. Be Flexible and Adaptable:**\n", - "\n", - "Business decisions are not set in stone. Be prepared to adjust your decisions as new information becomes available or as circumstances change. Stay flexible and adaptable, and be willing to pivot when necessary.\n", - "\n", - "**Conclusion:**\n", - "\n", - "\n" - ] - } - ], - "source": [ - "\n", - "from bedrock import BedrockModel\n", - "\n", - "\n", - "llm = BedrockModel(\n", - " model_id=\"meta.llama3-8b-instruct-v1:0\"\n", - ")\n", - "\n", - "prompt=\"\"\"[INST] <>\n", - "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n", - "If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n", - "<>\n", - "\n", - "Write me a blog about making strong business decisions as a leader. [/INST]\"\"\"\n", - "resp=llm.predict(prompt=prompt)\n", - "\n", - "print(resp)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "myenv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.1" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}