Skip to content

Commit

Permalink
Finalize model selection demo
Browse files Browse the repository at this point in the history
  • Loading branch information
klntsky committed Nov 14, 2024
1 parent a2063c2 commit 17900c5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ This is an early work-in-progress. Follow [me on twitter](https://x.com/klntsky)
- [ ] Runtime system
- [x] Support variable definition at runtime
- [x] dynamic model switching (via `MODEL` variable - [example](./python/examples/model-change.metaprompt))
- [ ] Multiple chat instances and ability to switch between them, to distribute data between chat contexts. E.g. `[$chat1: the object is the moon][$chat2: the object is the sun][$chat1: what is the object?]`
- [ ] exceptions
- [ ] throwing exceptions
- [ ] recovering from exceptions
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ MetaPrompt's basic use case is substituting parameter values instead of variable
Write me a poem about [:subject] in the style of [:style]
```

## Meta-prompting
## Prompt rewriting

Meta-prompting is a technique of asking an LLM to create/modify/expand an LLM prompt.
Prompt rewriting is a technique of asking an LLM to create/modify/expand an LLM prompt.

- Dynamically crafting task-specific prompts based on a set of high level principles
- Modifying prompts to increase accuracy
Expand Down
10 changes: 10 additions & 0 deletions python/examples/choose-model.metaprompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[$ You must choose the best LLM for a given prompt, considering all the options listed below:

- `gpt-3.5-turbo` - Best for tasks that don't require reasoning, like data processing or generation.
- `gpt-4o` - Will offer a very high level of intelligence and strong performance. Suitable for programming tasks that require reasoning about software architecture.
- `gpt-4o-mini` - Suitable for programming tasks that involve straightforward implementations, like utility functions.

Output format: output ONLY the model ID without qoutes.

The prompt: [:prompt]
]
3 changes: 3 additions & 0 deletions python/examples/model-selection-demo.metaprompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[:MODEL=[:use ./choose-model :prompt=[:prompt]]]
Selected model: [:MODEL]
[$[:prompt]]
2 changes: 1 addition & 1 deletion python/src/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, config, env):
self.cwd = os.getcwd()

def get_current_model(self):
return self.env.get("MODEL")
return self.env.get("MODEL").strip()

def set_variable(self, var_name, value):
self.env.set(var_name, value)
Expand Down

0 comments on commit 17900c5

Please sign in to comment.