Skip to content

Export non-echo schemas#77

Open
cpfiffer wants to merge 1 commit intosvilupp:mainfrom
cpfiffer:cpfiffer/exports
Open

Export non-echo schemas#77
cpfiffer wants to merge 1 commit intosvilupp:mainfrom
cpfiffer:cpfiffer/exports

Conversation

@cpfiffer
Copy link
Copy Markdown
Collaborator

Mostly a convenience PR to permit direct schema access. I typically use Ollama exclusively, so it's nice to be able to do

aigenerate(OllamaSchema(), ...)

instead of

aigenerate(PromptingTools.OllamaSchema(), ...)

@svilupp
Copy link
Copy Markdown
Owner

svilupp commented Feb 17, 2024

Is it okay if I run a quick poll on Slack first?

I was trying to be conservative with exports, since some users have it in their startup.jl
Btw since users only ever need 1 our of the 10ish schemas and that list will grow a lot
over time, isn’t it a bad precedent?

2 workflow questions

  • why not import OllamaSchema specifically when you import PT?
  • why not just register the model (PT.register_model!) you use at the top of the script? Then you never have to provide schema. In my usage, I never use the schemas because the models set them for me.

@svilupp
Copy link
Copy Markdown
Owner

svilupp commented Feb 18, 2024

The specific workaround I mentioned was: https://siml.earth/PromptingTools.jl/dev/examples/working_with_ollama/#Schema-Changes-/-Custom-models

PT.register_model!(;
    name = "llama123",
    schema = PT.OllamaSchema(),
    description = "Some model")
PT.MODEL_ALIASES["l123"] = "llama123" # set an alias you like for it

Then you can simply run: ai"Say hi"llama123 (no need for any schemas)

@cpfiffer
Copy link
Copy Markdown
Collaborator Author

I'm typically against const PT = PromptingTools, usually I prefer to export relatively judiciously (especially since these names are extremely unique and unlikely to clash).

Users who prefer to prefix by package name should probably use import, or at least that's been my take. using is for quick-and-dirty access, and if you use it you are typically doing so for access to exports from the package.

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