Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
8f99f165
Unverified
Commit
8f99f165
authored
Aug 28, 2024
by
drbh
Committed by
GitHub
Aug 28, 2024
Browse files
fix: improve regex expression (#2468)
parent
21187c27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
docs/source/basic_tutorials/using_guidance.md
docs/source/basic_tutorials/using_guidance.md
+7
-2
No files found.
docs/source/basic_tutorials/using_guidance.md
View file @
8f99f165
...
...
@@ -157,7 +157,12 @@ from huggingface_hub import InferenceClient
client
=
InferenceClient
(
"http://localhost:3000"
)
regexp
=
"((25[0-5]|2[0-4]
\\
d|[01]?
\\
d
\\
d?)
\\
.){3}(25[0-5]|2[0-4]
\\
d|[01]?
\\
d
\\
d?)"
section_regex
=
"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
regexp
=
f
"HELLO\.
{
section_regex
}
\.WORLD\.
{
section_regex
}
"
# This is a more realistic example of an ip address regex
# regexp = f"{section_regex}\.{section_regex}\.{section_regex}\.{section_regex}"
resp
=
client
.
text_generation
(
f
"Whats Googles DNS? Please use the following regex:
{
regexp
}
"
,
...
...
@@ -170,7 +175,7 @@ resp = client.text_generation(
print
(
resp
)
#
7.1.1.1
#
HELLO.255.WORLD.255
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment