-
-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gui/move-container-test-to-test-package
- Loading branch information
Showing
112 changed files
with
2,370 additions
and
780 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
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
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
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,81 @@ | ||
# Ollama | ||
|
||
Since testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go/releases/tag/v0.29.0"><span class="tc-version">:material-tag: v0.29.0</span></a> | ||
|
||
## Introduction | ||
|
||
The Testcontainers module for Ollama. | ||
|
||
## Adding this module to your project dependencies | ||
|
||
Please run the following command to add the Ollama module to your Go dependencies: | ||
|
||
``` | ||
go get github.com/testcontainers/testcontainers-go/modules/ollama | ||
``` | ||
|
||
## Usage example | ||
|
||
<!--codeinclude--> | ||
[Creating a Ollama container](../../modules/ollama/examples_test.go) inside_block:runOllamaContainer | ||
<!--/codeinclude--> | ||
|
||
## Module reference | ||
|
||
The Ollama module exposes one entrypoint function to create the Ollama container, and this function receives two parameters: | ||
|
||
```golang | ||
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*OllamaContainer, error) | ||
``` | ||
|
||
- `context.Context`, the Go context. | ||
- `testcontainers.ContainerCustomizer`, a variadic argument for passing options. | ||
|
||
### Container Options | ||
|
||
When starting the Ollama container, you can pass options in a variadic way to configure it. | ||
|
||
#### Image | ||
|
||
If you need to set a different Ollama Docker image, you can use `testcontainers.WithImage` with a valid Docker image | ||
for Ollama. E.g. `testcontainers.WithImage("ollama/ollama:0.1.25")`. | ||
|
||
{% include "../features/common_functional_options.md" %} | ||
|
||
### Container Methods | ||
|
||
The Ollama container exposes the following methods: | ||
|
||
#### ConnectionString | ||
|
||
This method returns the connection string to connect to the Ollama container, using the default `11434` port. | ||
|
||
<!--codeinclude--> | ||
[Get connection string](../../modules/ollama/ollama_test.go) inside_block:connectionString | ||
<!--/codeinclude--> | ||
|
||
#### Commit | ||
|
||
This method commits the container to a new image, returning the new image ID. | ||
It should be used after a model has been pulled and loaded into the container in order to create a new image with the model, | ||
and eventually use it as the base image for a new container. That will speed up the execution of the following containers. | ||
|
||
<!--codeinclude--> | ||
[Commit Ollama image](../../modules/ollama/ollama_test.go) inside_block:commitOllamaContainer | ||
<!--/codeinclude--> | ||
|
||
## Examples | ||
|
||
### Loading Models | ||
|
||
It's possible to initialise the Ollama container with a specific model passed as parameter. The supported models are described in the Ollama project: [https://github.com/ollama/ollama?tab=readme-ov-file](https://github.com/ollama/ollama?tab=readme-ov-file) and [https://ollama.com/library](https://ollama.com/library). | ||
!!!warning | ||
At the moment you use one of those models, the Ollama image will load the model and could take longer to start because of that. | ||
The following examples use the `llama2` model to connect to the Ollama container using HTTP and Langchain. | ||
<!--codeinclude--> | ||
[Using HTTP](../../modules/ollama/examples_test.go) inside_block:withHTTPModelLlama2 | ||
[Using Langchaingo](../../modules/ollama/examples_test.go) inside_block:withLangchainModelLlama2 | ||
<!--/codeinclude--> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# SurrealDB | ||
|
||
Since testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go/releases/tag/v0.29.0"><span class="tc-version">:material-tag: v0.29.0</span></a> | ||
|
||
## Introduction | ||
|
||
The Testcontainers module for SurrealDB. | ||
|
||
## Adding this module to your project dependencies | ||
|
||
Please run the following command to add the SurrealDB module to your Go dependencies: | ||
|
||
``` | ||
go get github.com/testcontainers/testcontainers-go/modules/surrealdb | ||
``` | ||
|
||
## Usage example | ||
|
||
<!--codeinclude--> | ||
[Creating a SurrealDB container](../../modules/surrealdb/examples_test.go) inside_block:runSurrealDBContainer | ||
<!--/codeinclude--> | ||
|
||
## Module reference | ||
|
||
The SurrealDB module exposes one entrypoint function to create the SurrealDB container, and this function receives two parameters: | ||
|
||
```golang | ||
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*SurrealDBContainer, error) | ||
``` | ||
|
||
- `context.Context`, the Go context. | ||
- `testcontainers.ContainerCustomizer`, a variadic argument for passing options. | ||
|
||
### Container Options | ||
|
||
When starting the SurrealDB container, you can pass options in a variadic way to configure it. | ||
|
||
#### Image | ||
|
||
If you need to set a different SurrealDB Docker image, you can use `testcontainers.WithImage` with a valid Docker image | ||
for SurrealDB. E.g. `testcontainers.WithImage("surrealdb/surrealdb:v1.1.1")`. | ||
|
||
{% include "../features/common_functional_options.md" %} | ||
|
||
#### Set username and password | ||
|
||
If you need to set different credentials, you can use `WithUsername` and `WithPassword` options. | ||
|
||
!!!info | ||
The default values for the username and the password is `root`. | ||
|
||
#### WithAuthentication | ||
|
||
If you need to enable authentication, you can use `WithAuthentication` option. By default, it is disabled. | ||
|
||
#### WithStrictMode | ||
|
||
If you need to enable the strict mode for SurrealDB, you can use `WithStrictMode` option. By default, it is disabled. | ||
|
||
### WithAllowAllCaps | ||
|
||
If you need to enable the all caps mode for SurrealDB, you can use `WithAllowAllCaps` option. By default, it is disabled. | ||
|
||
### Container Methods | ||
|
||
The SurrealDB container exposes the following methods: | ||
|
||
#### URL | ||
|
||
This method returns the websocket URL string to connect to the SurrealDB API, using the `8000` port. | ||
|
||
<!--codeinclude--> | ||
[Get websocket URL string](../../modules/surrealdb/surrealdb_test.go) inside_block:websocketURL | ||
<!--/codeinclude--> |
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.