Comments (5)
Is this still needed? I'm interested in contributing.
from guardrails.
Hi @leifu1128, I talked about this with @ShreyaR, and we realized that an Enum
type is unnecessary given the Choice
datatype and valid-choices
validator.
But one similar thing we would like is to support Literal
types in guards created from pydantic models.
Here's a minimal code sample that throws an "Unsupported type" error:
from typing import Literal
from guardrails import Guard
from pydantic import BaseModel
class Model(BaseModel):
type_: Literal["a", "b"]
Guard.from_pydantic(Model, prompt=...)
Let me know if this is something you're interested in picking up :)
from guardrails.
Is it possible currently to add a Enum or Literal -like validated field when creating a guard from pydantic model? I can use an explicit validator, but is there a nicer way to do it?
from guardrails.
Hey @irgolic. Sorry for the late response, just got back from vacation. Should I make it so create_xml_element_for_field
converts Literal
to string
+ valid-choices
?
from guardrails.
Resolving as this is now available via https://www.guardrailsai.com/docs/defining_guards/strings
from guardrails.
Related Issues (20)
- [feat] Support punkt_tab instead of punkt HOT 1
- [bug] Guards that dont exist in settings.use_remote = True dont error and openAI api error for guard not found not helpful HOT 2
- [bug] ToxicLanguage validator's "fix" behaviour breaks "fix-reask"
- [bug] GuardRunnable may not be reporting tokens appropriately if reasks are allowed HOT 1
- [bug] Verify Filter, Reask, and Refrain ser/de HOT 1
- [feat] Async validate when using multiple validators HOT 1
- [bug] ToxicLanguage seems not to work in french HOT 2
- [documentation] update RAIL docs for hub validators
- [bug] Error after installing SensitiveTopics, error: ModuleNotFoundError: No module named 'guardrails.hub.tryolabs' HOT 3
- [bug] Error: zsh: bus error guardrails start --config config.py HOT 1
- Update hub validators to support remote inference
- [bug] email address [email protected] not receiving emails: "Delivery Status Notification (Failure)" HOT 1
- [docs] request: Add doc examples of how to call the new Guardrail Server endpoints. HOT 1
- [bug] Trouble calling guard without using openai or azure openai APIs HOT 7
- [docs][Bug] HOT 1
- How to use gemini model insted of openai HOT 2
- [feat] Functionality for testing a Guard configured to run on prompt in isolation HOT 1
- [feat] More readable validation failures HOT 2
- [docs] Missing docs for in-code hub installs
- [bug] Toxic language validator returning 500 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guardrails.