在LLM虚拟环境中运行Python解释器
项目描述
llm-python
在LLM虚拟环境中运行Python解释器
安装
在LLM相同的环境中安装此插件。
llm install llm-python
用法
此插件为LLM添加了一个新的python
命令。该命令在LLM自身的虚拟环境中执行Python。
您可以使用此命令检查Python版本
llm python --version
# Should output 'Python 3.10.10' or similar
或启动一个Python shell。在那个shell中,您可以导入llm
并与模型交互
llm python
Python 3.10.10 (main, Mar 21 2023, 13:41:05) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import llm
>>> m = llm.get_model("mistral-7b-instruct-v0")
>>> print(m.prompt("Three fun facts about pelicans"))
1. Pelicans have a unique method of hunting for food. They fly high above the water and then fold their wings into a disc shape, creating a large scoop that they use to catch fish. This technique is called “plunge diving” and it allows them to catch up to six pounds of fish in one dive!
2. Pelicans have an incredible memory when it comes to finding food. They can remember the location of every single fishing spot they’ve ever visited, even if it’s been years since they last went there. This is because they use a combination of visual cues and the earth’s magnetic field to navigate.
3. Pelicans are incredibly social birds that form large flocks called “rookeries.” These rookeries can contain thousands of pelicans, and they are often found in areas with abundant food sources such as coastlines or offshore islands. In these groups, pelicans will engage in a variety of behaviors, including preening, grooming, and even playing with one another.
开发
要本地设置此插件,首先检出代码。然后创建一个新的虚拟环境
cd llm-python
python3 -m venv venv
source venv/bin/activate
现在安装依赖项和测试依赖项
llm install -e '.[test]'
要运行测试
pytest
项目详情
下载文件
下载适用于您的平台文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
llm-python-0.1.tar.gz (7.1 kB 查看哈希)
构建分布
llm_python-0.1-py3-none-any.whl (7.2 kB 查看哈希)