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
c5d5c4a9
Unverified
Commit
c5d5c4a9
authored
Apr 04, 2024
by
Daniel Hiltgen
Committed by
GitHub
Apr 04, 2024
Browse files
Merge pull request #3491 from dhiltgen/context_bust_test
Add test case for context exhaustion
parents
dfe330fa
aeb1fb51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
integration/context_test.go
integration/context_test.go
+29
-0
No files found.
integration/context_test.go
0 → 100644
View file @
c5d5c4a9
//go:build integration
package
integration
import
(
"context"
"net/http"
"testing"
"time"
"github.com/ollama/ollama/api"
)
func
TestContextExhaustion
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
2
*
time
.
Minute
)
// TODO maybe shorter?
defer
cancel
()
// Set up the test data
req
:=
api
.
GenerateRequest
{
Model
:
"llama2"
,
Prompt
:
"Write me a story with a ton of emojis?"
,
Stream
:
&
stream
,
Options
:
map
[
string
]
interface
{}{
"temperature"
:
0
,
"seed"
:
123
,
"num_ctx"
:
128
,
},
}
GenerateTestHelper
(
ctx
,
t
,
&
http
.
Client
{},
req
,
[]
string
{
"once"
,
"upon"
,
"lived"
})
}
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