Add ability to "inject"options from the results of other `Evaluatable`s
- Lenguaje dominante
- Python
- Estrellas
- 17
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
There are times when you want to dynamically generate the value of an option using a dataset or other `Evaluatable` object. This is most often useful when using a `dataset` that someone else wrote.
Currently, a similar ability exists in the [`Map`](https://8451.github.io/labrea/usage.html#map) type, but only when iterating over the result of an `Evaluatable` that returns an interable.
The most natural way to do this would probably be to extend the `WithOptions` type (which powers the `Dataset.with_options` method) so that you can provide dynamic options as well as static ones. For example
```python
from labrea import dataset, Option
@dataset
def foo(bar: str = Option("BAR")) -> str:
return bar
@dataset
def bar(msg: str = Option("MSG")) -> str:
return msg
foo.with_options({"BAR": bar}).evaluate({"MSG": "Hello World!"})
# 'Hello World!'
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.