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
ollama
Commits
f2ea8470
Commit
f2ea8470
authored
Apr 16, 2024
by
Daniel Hiltgen
Browse files
Local unicode test case
parent
34b9db5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
integration/basic_test.go
integration/basic_test.go
+43
-0
No files found.
integration/basic_test.go
View file @
f2ea8470
...
@@ -4,10 +4,14 @@ package integration
...
@@ -4,10 +4,14 @@ package integration
import
(
import
(
"context"
"context"
"log/slog"
"os"
"runtime"
"testing"
"testing"
"time"
"time"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/api"
"github.com/stretchr/testify/require"
)
)
func
TestOrcaMiniBlueSky
(
t
*
testing
.
T
)
{
func
TestOrcaMiniBlueSky
(
t
*
testing
.
T
)
{
...
@@ -25,3 +29,42 @@ func TestOrcaMiniBlueSky(t *testing.T) {
...
@@ -25,3 +29,42 @@ func TestOrcaMiniBlueSky(t *testing.T) {
}
}
GenerateTestHelper
(
ctx
,
t
,
req
,
[]
string
{
"rayleigh"
,
"scattering"
})
GenerateTestHelper
(
ctx
,
t
,
req
,
[]
string
{
"rayleigh"
,
"scattering"
})
}
}
func
TestUnicodeModelDir
(
t
*
testing
.
T
)
{
// This is only useful for Windows with utf-16 characters, so skip this test for other platforms
if
runtime
.
GOOS
!=
"windows"
{
t
.
Skip
(
"Unicode test only applicable to windows"
)
}
// Only works for local testing
if
os
.
Getenv
(
"OLLAMA_TEST_EXISTING"
)
!=
""
{
t
.
Skip
(
"TestUnicodeModelDir only works for local testing, skipping"
)
}
modelDir
,
err
:=
os
.
MkdirTemp
(
""
,
"ollama_埃"
)
require
.
NoError
(
t
,
err
)
defer
os
.
RemoveAll
(
modelDir
)
slog
.
Info
(
"unicode"
,
"OLLAMA_MODELS"
,
modelDir
)
oldModelsDir
:=
os
.
Getenv
(
"OLLAMA_MODELS"
)
if
oldModelsDir
==
""
{
defer
os
.
Unsetenv
(
"OLLAMA_MODELS"
)
}
else
{
defer
os
.
Setenv
(
"OLLAMA_MODELS"
,
oldModelsDir
)
}
err
=
os
.
Setenv
(
"OLLAMA_MODELS"
,
modelDir
)
require
.
NoError
(
t
,
err
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
2
*
time
.
Minute
)
defer
cancel
()
req
:=
api
.
GenerateRequest
{
Model
:
"orca-mini"
,
Prompt
:
"why is the sky blue?"
,
Stream
:
&
stream
,
Options
:
map
[
string
]
interface
{}{
"temperature"
:
0
,
"seed"
:
123
,
},
}
GenerateTestHelper
(
ctx
,
t
,
req
,
[]
string
{
"rayleigh"
,
"scattering"
})
}
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