-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ollama): support calling the Ollama local process (#2923)
* feat: support running ollama from the local binary * fix: wrong working dir at CI * chore: extract wait to a function * chore: print local binary logs on error * chore: remove debug logs * fix(ci): kill ollama before the tests * chore: stop ollama using systemctl * chore: support setting log file from the env * chore: support running ollama commands, only * fix: release lock on error * chore: add more test coverage for the option * chore: simplify useLocal checks * chore: simpolify * chore: pass context to runLocal * chore: move ctx to the right scope * chore: remove not needed * chore: use a container function * chore: support reading OLLAMA_HOST * chore: return error with copy APIs * chore: simply execute the script * chore: simplify var initialisation * chore: return nil * fix: return errors on terminate * chore: remove options type * chore: use a map * chor: simplify error on wait * chore: wrap start logic around the localContext * chor: fold * chore: merge wait into start * fix: use proper ContainersState * fix: remove extra conversion * chore: handle remove log file errors properly * chore: go back to string in env vars * refactor(ollama): local process Refactor local process handling for Ollama using a container implementation avoiding the wrapping methods. This defaults to running the binary with an ephemeral port to avoid port conflicts. This behaviour can be overridden my setting OLLAMA_HOST either in the parent environment or in the values passed via WithUseLocal. Improve API compatibility with: - Multiplexed output streams - State reporting - Exec option processing - WaitingFor customisation Fix Container implementation: - Port management - Running checks - Terminate processing - Endpoint argument definition - Add missing methods - Consistent environment handling * chore(ollama): refactor local to use log sub match. Refactor local processing to use the new log sub match functionality. * feat(ollama): validate container request Validate the container request to ensure the user configuration can be processed and no fields that would be ignored are present. * chore(ollama): remove temporary test Remove temporary simple test. * feat(ollama): configurable local process binary Allow the local ollama binary name to be configured using the image name. * docs(ollama): detail local process supported fields Detail the container request supported fields. * docs(ollama): update local process site docs Update local process site docs to match recent changes. * chore: refactor to support TerminateOption Refactor Terminate to support testcontainers.TerminateOption. * fix: remove unused var --------- Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
- Loading branch information
1 parent
632249a
commit 6ec91f1
Showing
10 changed files
with
1,630 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
curl -fsSL https://ollama.com/install.sh | sh | ||
|
||
# kill any running ollama process so that the tests can start from a clean state | ||
sudo systemctl stop ollama.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.