GithubHelp home page GithubHelp logo

uglygpt's Introduction

UglyGPT

这是一个个人项目,主要解决如何更好的使用大模型的问题。

Usage

Core

LLM

这是最基础的模型调用类,其他的高级类也都继承和使用了这个类的基本功能。

快速使用:

from core import LLM, Model
llm = LLM()
print(llm("你是谁?")) # 与模型对话,返回字符串的回答

调整基础配置选项:

llm = LLM(model = Model.YI) # 可以选择更多的模型,如 Model.GPT3_TURBO、Model.GPT4 等等
llm = LLM(system_prompt = "我想让你担任职业顾问。我将为您提供一个在职业生涯中寻求指导的人,您的任务是帮助他们根据自己的技能、兴趣和经验确定最适合的职业。您还应该对可用的各种选项进行研究,解释不同行业的就业市场趋势,并就哪些资格对追求特定领域有益提出建议。") # 可以对模型设置角色,这样模型就会以这个角色的视角来回答问题。设置的内容保存在 System Message 中。

参数化 prompt:

llm = LLM(prompt_template = "{object}的{position}是谁?")
print(llm(object = "《红楼梦》", position = "作者"))
print(llm(object = "上海市", position = "市长"))

对于 prompt 中只有一个参数的情况,可以直接传入参数:

llm = LLM("介绍一下{object}")
print(llm("Transformer"))

结构化返回结果:

class UserDetail(BaseModel):
    name: str
    age: int

llm = LLM(response_model=UserDetail)
print(llm("Extract Jason is 25 years old")) # UserDetail(name='Jason', age=25)

MapChain

这是一个可以并行对同类型 Prompt 进行调用的类,可以大大提高调用效率。

uglygpt's People

Contributors

uglyboy-tl avatar

Stargazers

Binqiang Zhao avatar  avatar Qiang Liu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.