repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/embedding.go
ml/nn/embedding.go
package nn import "github.com/ollama/ollama/ml" type Embedding struct { Weight ml.Tensor `gguf:"weight"` } func (m *Embedding) Forward(ctx ml.Context, hiddenState ml.Tensor) ml.Tensor { return m.Weight.Rows(ctx, hiddenState) }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/rope.go
ml/nn/rope.go
package nn import ( "github.com/ollama/ollama/ml" "github.com/ollama/ollama/ml/nn/rope" ) // fastRoPE is an interface for tensors that support fast rotary positional embedding. type fastRoPE interface { RoPE(ctx ml.Context, positions ml.Tensor, dim int, base, scale float32, options ...func(*rope.Options)) ml.Tenso...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/linear.go
ml/nn/linear.go
package nn import "github.com/ollama/ollama/ml" type Linear struct { Weight ml.Tensor `gguf:"weight"` Bias ml.Tensor `gguf:"bias"` } func (m *Linear) Forward(ctx ml.Context, t ml.Tensor) ml.Tensor { t = m.Weight.Mulmat(ctx, t) if m.Bias != nil { t = t.Add(ctx, m.Bias) } return t } type LinearBatch struct...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/convolution.go
ml/nn/convolution.go
package nn import "github.com/ollama/ollama/ml" type Conv2D struct { Weight ml.Tensor `gguf:"weight"` Bias ml.Tensor `gguf:"bias"` } func (m *Conv2D) Forward(ctx ml.Context, t ml.Tensor, s0, s1, p0, p1, d0, d1 int) ml.Tensor { t = m.Weight.Conv2D(ctx, t, s0, s1, p0, p1, d0, d1) if m.Bias != nil { // Bias sha...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/normalization.go
ml/nn/normalization.go
package nn import ( "github.com/ollama/ollama/ml" ) type LayerNorm struct { Weight ml.Tensor `gguf:"weight"` Bias ml.Tensor `gguf:"bias"` } func (m *LayerNorm) Forward(ctx ml.Context, t ml.Tensor, eps float32) ml.Tensor { return t.LayerNorm(ctx, m.Weight, m.Bias, eps) } type RMSNorm struct { Weight ml.Tensor...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/attention.go
ml/nn/attention.go
package nn import ( "fmt" "github.com/ollama/ollama/kvcache" "github.com/ollama/ollama/ml" ) // Attention implements scaled dot-product attention for transformer models: // Attention(Q, K, V) = softmax(QK^T/√d_k)V // // Parameters: // - ctx: Context for tensor operations // - query: Query tensor (Q) with shap...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/rope/options.go
ml/nn/rope/options.go
// Package rope provides options for RoPE package rope import "github.com/ollama/ollama/ml" // Options contains optional parameters for RoPE function type Options struct { Type int Factors ml.Tensor // YaRN options YaRN struct { OriginalContextLength int ExtrapolationFactor, AttentionFactor, BetaFast,...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/pooling/pooling.go
ml/nn/pooling/pooling.go
package pooling import ( "github.com/ollama/ollama/ml" ) type Type uint32 const ( TypeNone Type = iota TypeMean TypeCLS TypeLast ) func (t Type) String() string { switch t { case TypeMean: return "Mean" case TypeCLS: return "CLS" case TypeLast: return "Last" default: return "Unknown" } } func (t...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/nn/pooling/pooling_test.go
ml/nn/pooling/pooling_test.go
package pooling_test import ( "bytes" "os" "testing" "github.com/google/go-cmp/cmp" fsggml "github.com/ollama/ollama/fs/ggml" "github.com/ollama/ollama/ml" "github.com/ollama/ollama/ml/backend/ggml" "github.com/ollama/ollama/ml/nn/pooling" ) func setup(tb testing.TB, n int) ml.Backend { tb.Helper() f, err...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/auth/auth.go
auth/auth.go
package auth import ( "bytes" "context" "crypto/rand" "encoding/base64" "errors" "fmt" "io" "log/slog" "os" "path/filepath" "strings" "golang.org/x/crypto/ssh" ) const defaultPrivateKey = "id_ed25519" func GetPublicKey() (string, error) { home, err := os.UserHomeDir() if err != nil { return "", err ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/start.go
cmd/start.go
//go:build darwin || windows package cmd import ( "context" "errors" "time" "github.com/ollama/ollama/api" ) func waitForServer(ctx context.Context, client *api.Client) error { // wait for the server to start timeout := time.After(5 * time.Second) tick := time.Tick(500 * time.Millisecond) for { select { ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/interactive_test.go
cmd/interactive_test.go
package cmd import ( "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" ) func TestExtractFilenames(t *testing.T) { // Unix style paths input := ` some preamble ./relative\ path/one.png inbetween1 ./not a valid two.jpg inbetween2 ./1.svg /unescaped space /three.jpeg inbetween3 /valid\ path/d...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/start_windows.go
cmd/start_windows.go
package cmd import ( "context" "errors" "fmt" "log/slog" "os" "os/exec" "path" "path/filepath" "strings" "syscall" "unsafe" "github.com/ollama/ollama/api" "golang.org/x/sys/windows" ) const ( Installer = "OllamaSetup.exe" ) func startApp(ctx context.Context, client *api.Client) error { if len(isProcR...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/warn_thinking_test.go
cmd/warn_thinking_test.go
package cmd import ( "encoding/json" "io" "net/http" "net/http/httptest" "os" "strings" "testing" "github.com/ollama/ollama/api" "github.com/ollama/ollama/types/model" ) // Test that a warning is printed when thinking is requested but not supported. func TestWarnMissingThinking(t *testing.T) { cases := []s...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/cmd_test.go
cmd/cmd_test.go
package cmd import ( "bytes" "encoding/json" "fmt" "io" "net/http" "net/http/httptest" "os" "reflect" "strings" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/spf13/cobra" "github.com/ollama/ollama/api" "github.com/ollama/ollama/types/model" ) func TestShowInfo(t *testing.T) { t.Run("ba...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/interactive.go
cmd/interactive.go
package cmd import ( "cmp" "errors" "fmt" "io" "net/http" "os" "path/filepath" "regexp" "slices" "strings" "github.com/spf13/cobra" "github.com/ollama/ollama/api" "github.com/ollama/ollama/envconfig" "github.com/ollama/ollama/readline" "github.com/ollama/ollama/types/errtypes" "github.com/ollama/olla...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/start_default.go
cmd/start_default.go
//go:build !windows && !darwin package cmd import ( "context" "errors" "github.com/ollama/ollama/api" ) func startApp(ctx context.Context, client *api.Client) error { return errors.New("could not connect to ollama server, run 'ollama serve' to start it") }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/cmd.go
cmd/cmd.go
package cmd import ( "bufio" "context" "crypto/ed25519" "crypto/rand" "encoding/json" "encoding/pem" "errors" "fmt" "io" "log" "math" "net" "net/http" "os" "os/signal" "path/filepath" "runtime" "slices" "sort" "strconv" "strings" "sync/atomic" "syscall" "time" "github.com/containerd/console" ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/start_darwin.go
cmd/start_darwin.go
package cmd import ( "context" "errors" "os" "os/exec" "regexp" "github.com/ollama/ollama/api" ) func startApp(ctx context.Context, client *api.Client) error { exe, err := os.Executable() if err != nil { return err } link, err := os.Readlink(exe) if err != nil { return err } r := regexp.MustCompile(...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/bench/bench_test.go
cmd/bench/bench_test.go
package main import ( "bytes" "crypto/rand" "encoding/json" "io" "net/http" "net/http/httptest" "os" "strings" "testing" "time" "github.com/ollama/ollama/api" ) func createTestFlagOptions() flagOptions { models := "test-model" format := "benchstat" epochs := 1 maxTokens := 100 temperature := 0.7 see...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/bench/bench.go
cmd/bench/bench.go
package main import ( "cmp" "context" "flag" "fmt" "io" "os" "runtime" "slices" "strings" "sync" "time" "github.com/ollama/ollama/api" ) type flagOptions struct { models *string epochs *int maxTokens *int temperature *float64 seed *int timeout *int prompt *string image...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/cmd/runner/main.go
cmd/runner/main.go
package main import ( "fmt" "os" "github.com/ollama/ollama/runner" ) func main() { if err := runner.Execute(os.Args[1:]); err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) os.Exit(1) } }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/llm_image_test.go
integration/llm_image_test.go
//go:build integration package integration import ( "context" "encoding/base64" "testing" "time" "github.com/ollama/ollama/api" ) func TestVisionModels(t *testing.T) { skipUnderMinVRAM(t, 6) type testCase struct { model string } testCases := []testCase{ { model: "qwen2.5vl", }, { model: "llam...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/max_queue_test.go
integration/max_queue_test.go
//go:build integration package integration import ( "context" "errors" "log/slog" "os" "strconv" "strings" "sync" "testing" "time" "github.com/ollama/ollama/api" ) func TestMaxQueue(t *testing.T) { t.Skip("this test needs to be re-evaluated to use a proper embedding model") if os.Getenv("OLLAMA_TEST_EX...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/library_models_test.go
integration/library_models_test.go
//go:build integration && library package integration import ( "context" "fmt" "log/slog" "os" "testing" "time" "github.com/ollama/ollama/api" ) // First run of this scenario on a target system will take a long time to download // ~1.5TB of models. Set a sufficiently large -timeout for your network speed fu...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/embed_test.go
integration/embed_test.go
//go:build integration package integration import ( "context" "errors" "math" "strings" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/ollama/ollama/api" ) func dotProduct[V float32 | float64](v1, v2 []V) V { var result V = 0 if len(v1) != len(v2) { return result } for i := 0; i < len(v1...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/basic_test.go
integration/basic_test.go
//go:build integration package integration import ( "context" "log/slog" "os" "runtime" "testing" "time" "github.com/ollama/ollama/api" ) func TestBlueSky(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() // Set up the test data req := api.ChatRequest{...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/context_test.go
integration/context_test.go
//go:build integration package integration import ( "context" "log/slog" "sync" "testing" "time" "github.com/ollama/ollama/api" ) func TestLongInputContext(t *testing.T) { // Setting NUM_PARALLEL to 1 ensures the allocated context is exactly what // we asked for and there is nothing extra that we could spil...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/api_test.go
integration/api_test.go
//go:build integration package integration import ( "bytes" "context" "fmt" "math/rand" "strings" "testing" "time" "github.com/ollama/ollama/api" ) func assertBytesMatchToken(t *testing.T, label, token string, ints []int) { t.Helper() raw := []byte(token) if len(ints) != len(raw) { t.Errorf("%s expect...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/utils_test.go
integration/utils_test.go
//go:build integration package integration import ( "bytes" "context" "errors" "fmt" "io" "log/slog" "math" "math/rand" "net" "net/http" "net/url" "os" "os/exec" "path/filepath" "runtime" "strconv" "strings" "sync" "testing" "time" "github.com/ollama/ollama/api" "github.com/ollama/ollama/format...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/tools_test.go
integration/tools_test.go
//go:build integration package integration import ( "context" "fmt" "testing" "time" "github.com/ollama/ollama/api" ) // testPropsMap creates a ToolPropertiesMap from a map (convenience function for tests) func testPropsMap(m map[string]api.ToolProperty) *api.ToolPropertiesMap { props := api.NewToolProperties...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/concurrency_test.go
integration/concurrency_test.go
//go:build integration package integration import ( "context" "fmt" "log/slog" "math" "math/rand" "os" "strconv" "sync" "testing" "time" "github.com/ollama/ollama/api" "github.com/ollama/ollama/envconfig" "github.com/ollama/ollama/format" ) // Send multiple requests in parallel (concurrently) to a sing...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/model_perf_test.go
integration/model_perf_test.go
//go:build integration && perf package integration import ( "context" "fmt" "io/ioutil" "log/slog" "math" "os" "path/filepath" "strconv" "strings" "testing" "time" "github.com/ollama/ollama/api" "github.com/ollama/ollama/format" ) var ( // Models that don't work reliably with the large context prompt ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/model_arch_test.go
integration/model_arch_test.go
//go:build integration && models package integration import ( "context" "encoding/json" "fmt" "io/ioutil" "log/slog" "os" "path/filepath" "strconv" "strings" "testing" "time" "github.com/ollama/ollama/api" "github.com/ollama/ollama/format" ) func TestModelsChat(t *testing.T) { softTimeout, hardTimeout...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/integration/quantization_test.go
integration/quantization_test.go
//go:build integration && models package integration import ( "bytes" "context" "fmt" "log/slog" "strings" "testing" "time" "github.com/ollama/ollama/api" ) func TestQuantization(t *testing.T) { sourceModels := []string{ "qwen2.5:0.5b-instruct-fp16", } quantizations := []string{ "Q8_0", "Q4_K_S", ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/openai/openai_test.go
openai/openai_test.go
package openai import ( "encoding/base64" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/ollama/ollama/api" ) // testArgs creates ToolCallFunctionArguments from a map (convenience function for tests) func testArgs(m map[string]any) api.ToolCallFunctionArguments { args := api.NewToolCallFunctionAr...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/openai/responses.go
openai/responses.go
package openai import ( "encoding/json" "fmt" "math/rand" "github.com/ollama/ollama/api" ) // ResponsesContent is a discriminated union for input content types. // Concrete types: ResponsesTextContent, ResponsesImageContent type ResponsesContent interface { responsesContent() // unexported marker method } type...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/openai/openai_encoding_format_test.go
openai/openai_encoding_format_test.go
package openai import ( "encoding/base64" "math" "testing" "github.com/ollama/ollama/api" ) func TestToEmbeddingList(t *testing.T) { testCases := []struct { name string embeddings [][]float32 format string expectType string // "float" or "base64" expectBase64 []string expectCount ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/openai/responses_test.go
openai/responses_test.go
package openai import ( "encoding/json" "testing" "time" "github.com/ollama/ollama/api" ) func TestResponsesInputMessage_UnmarshalJSON(t *testing.T) { tests := []struct { name string json string want ResponsesInputMessage wantErr bool }{ { name: "text content", json: `{"type": "message...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/openai/openai.go
openai/openai.go
// openai package provides core transformation logic for partial compatibility with the OpenAI REST API package openai import ( "bytes" "encoding/base64" "encoding/binary" "encoding/json" "errors" "fmt" "log/slog" "net/http" "slices" "strings" "time" "github.com/ollama/ollama/api" "github.com/ollama/olla...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/tools/tools.go
tools/tools.go
package tools import ( "bytes" "encoding/json" "strings" "text/template" "github.com/ollama/ollama/api" ) type toolsState int const ( toolsState_LookingForTag toolsState = iota toolsState_ToolCalling toolsState_Done ) type Parser struct { tag string tools []api.Tool state toolsState buffer []byte ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/tools/tools_test.go
tools/tools_test.go
package tools import ( "strings" "testing" "text/template" "github.com/google/go-cmp/cmp" "github.com/ollama/ollama/api" ) // argsComparer provides cmp options for comparing ToolCallFunctionArguments by value (order-insensitive) var argsComparer = cmp.Comparer(func(a, b api.ToolCallFunctionArguments) bool { re...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/tools/template_test.go
tools/template_test.go
package tools import ( "testing" "text/template" ) func TestParseTag(t *testing.T) { cases := []struct { name string template string want string }{ { name: "empty", template: "", want: "{", }, { name: "no tag", template: "{{if .ToolCalls}}{{end}}", want: "{", ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/tools/template.go
tools/template.go
package tools import ( "bytes" "log/slog" "slices" "strings" "text/template" "text/template/parse" ) // parseTag finds the tool calling tag from a Go template // often <tool_call> [TOOL_CALL] or similar by finding the // first text node after .ToolCalls and returning the content // if no tag is found, return "{...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/notifyicon.go
app/wintray/notifyicon.go
//go:build windows package wintray import ( "unsafe" "golang.org/x/sys/windows" ) // Contains information that the system needs to display notifications in the notification area. // Used by Shell_NotifyIcon. // https://msdn.microsoft.com/en-us/library/windows/desktop/bb773352(v=vs.85).aspx // https://msdn.microso...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/tray.go
app/wintray/tray.go
//go:build windows package wintray import ( "crypto/md5" "encoding/hex" "fmt" "log/slog" "os" "path/filepath" "sort" "sync" "syscall" "unsafe" "github.com/ollama/ollama/app/assets" "golang.org/x/sys/windows" ) const ( UpdateIconName = "tray_upgrade.ico" IconName = "tray.ico" ClassName = "O...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/w32api.go
app/wintray/w32api.go
//go:build windows package wintray import ( "runtime" "golang.org/x/sys/windows" ) var ( k32 = windows.NewLazySystemDLL("Kernel32.dll") u32 = windows.NewLazySystemDLL("User32.dll") s32 = windows.NewLazySystemDLL("Shell32.dll") pCreatePopupMenu = u32.NewProc("CreatePopupMenu") pCreateWindowEx = ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/eventloop.go
app/wintray/eventloop.go
//go:build windows package wintray import ( "fmt" "log/slog" "sync" "unsafe" "golang.org/x/sys/windows" ) var ( quitOnce sync.Once UI_REQUEST_MSG_ID = WM_USER + 2 FOCUS_WINDOW_MSG_ID = WM_USER + 3 ) func (t *winTray) TrayRun() { // Main message pump. slog.Debug("starting event handling loop"...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/messages.go
app/wintray/messages.go
//go:build windows package wintray const ( firstTimeTitle = "Ollama is running" firstTimeMessage = "Click here to get started" updateTitle = "Update available" updateMessage = "Ollama version %s is ready to install" quitMenuTitle = "Quit Ollama" updateAvailableMenuTitle = "An update is ava...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/winclass.go
app/wintray/winclass.go
//go:build windows package wintray import ( "unsafe" "golang.org/x/sys/windows" ) // Contains window class information. // It is used with the RegisterClassEx and GetClassInfoEx functions. // https://msdn.microsoft.com/en-us/library/ms633577.aspx type wndClassEx struct { Size, Style uint32...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/wintray/menus.go
app/wintray/menus.go
//go:build windows package wintray import ( "fmt" "log/slog" "os" "os/exec" "path/filepath" "syscall" "unsafe" "golang.org/x/sys/windows" ) const ( _ = iota openUIMenuID settingsUIMenuID updateSeparatorMenuID updateAvailableMenuID updateMenuID separatorMenuID diagLogsMenuID diagSeparatorMenuID qui...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/auth/connect.go
app/auth/connect.go
//go:build windows || darwin package auth import ( "encoding/base64" "fmt" "net/url" "os" "github.com/ollama/ollama/auth" ) // BuildConnectURL generates the connect URL with the public key and device name func BuildConnectURL(baseURL string) (string, error) { pubKey, err := auth.GetPublicKey() if err != nil ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/cmd/app/app_darwin.go
app/cmd/app/app_darwin.go
//go:build windows || darwin package main // #cgo CFLAGS: -x objective-c // #cgo LDFLAGS: -framework Webkit -framework Cocoa -framework LocalAuthentication -framework ServiceManagement // #include "app_darwin.h" // #include "../../updater/updater_darwin.h" // typedef const char cchar_t; import "C" import ( "log/slo...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/cmd/app/app_windows.go
app/cmd/app/app_windows.go
//go:build windows || darwin package main import ( "errors" "fmt" "io" "log" "log/slog" "os" "os/exec" "os/signal" "path/filepath" "runtime" "strings" "syscall" "unsafe" "github.com/ollama/ollama/app/updater" "github.com/ollama/ollama/app/version" "github.com/ollama/ollama/app/wintray" "golang.org/x...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/cmd/app/webview.go
app/cmd/app/webview.go
//go:build windows || darwin package main // #include "menu.h" import "C" import ( "encoding/base64" "encoding/json" "fmt" "log/slog" "net/http" "os" "path/filepath" "runtime" "strings" "sync" "time" "unsafe" "github.com/ollama/ollama/app/dialog" "github.com/ollama/ollama/app/store" "github.com/ollam...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/cmd/app/app.go
app/cmd/app/app.go
//go:build windows || darwin package main import ( "context" "encoding/json" "errors" "fmt" "io" "log/slog" "net" "net/http" "net/url" "os" "os/exec" "os/signal" "path/filepath" "runtime" "strings" "syscall" "time" "github.com/google/uuid" "github.com/ollama/ollama/app/auth" "github.com/ollama/ol...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/tools.go
app/tools/tools.go
//go:build windows || darwin package tools import ( "context" "encoding/json" "fmt" ) // Tool defines the interface that all tools must implement type Tool interface { // Name returns the unique identifier for the tool Name() string // Description returns a human-readable description of what the tool does De...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/web_fetch.go
app/tools/web_fetch.go
//go:build windows || darwin package tools import ( "bytes" "context" "encoding/json" "fmt" "net/http" "net/url" "strconv" "strings" "time" "github.com/ollama/ollama/auth" ) type WebFetch struct{} type FetchRequest struct { URL string `json:"url"` } type FetchResponse struct { Title string `json:"...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/browser_test.go
app/tools/browser_test.go
//go:build windows || darwin package tools import ( "strings" "testing" "time" "github.com/ollama/ollama/app/ui/responses" ) func makeTestPage(url string) *responses.Page { return &responses.Page{ URL: url, Title: "Title " + url, Text: "Body for " + url, Lines: []string{"line1", "lin...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/browser.go
app/tools/browser.go
//go:build windows || darwin package tools import ( "context" "fmt" "net/url" "regexp" "strings" "sync" "time" "github.com/ollama/ollama/app/ui/responses" ) type PageType string const ( PageTypeSearchResults PageType = "initial_results" PageTypeWebpage PageType = "webpage" ) // DefaultViewTokens i...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/browser_crawl.go
app/tools/browser_crawl.go
//go:build windows || darwin package tools import ( "context" "encoding/json" "fmt" ) // CrawlContent represents the content of a crawled page type CrawlContent struct { Snippet string `json:"snippet"` FullText string `json:"full_text"` } // CrawlExtras represents additional data from the crawl API type Crawl...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/browser_websearch.go
app/tools/browser_websearch.go
//go:build windows || darwin package tools import ( "context" "encoding/json" "fmt" "strconv" "time" ) // WebSearchContent represents the content of a search result type WebSearchContent struct { Snippet string `json:"snippet"` FullText string `json:"full_text"` } // WebSearchMetadata represents metadata fo...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/tools/web_search.go
app/tools/web_search.go
//go:build windows || darwin package tools import ( "bytes" "context" "encoding/json" "fmt" "net/http" "net/url" "strconv" "strings" "time" "github.com/ollama/ollama/auth" ) type WebSearch struct{} type SearchRequest struct { Query string `json:"query"` MaxResults int `json:"max_results,omitemp...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/dialog/dlgs_darwin.go
app/dialog/dlgs_darwin.go
package dialog import ( "github.com/ollama/ollama/app/dialog/cocoa" ) func (b *MsgBuilder) yesNo() bool { return cocoa.YesNoDlg(b.Msg, b.Dlg.Title) } func (b *MsgBuilder) info() { cocoa.InfoDlg(b.Msg, b.Dlg.Title) } func (b *MsgBuilder) error() { cocoa.ErrorDlg(b.Msg, b.Dlg.Title) } func (b *FileBuilder) load(...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/dialog/dlgs_windows.go
app/dialog/dlgs_windows.go
package dialog import ( "fmt" "reflect" "syscall" "unicode/utf16" "unsafe" "github.com/TheTitanrain/w32" ) const multiFileBufferSize = w32.MAX_PATH * 10 type WinDlgError int func (e WinDlgError) Error() string { return fmt.Sprintf("CommDlgExtendedError: %#x", int(e)) } func err() error { e := w32.CommDlgE...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/dialog/util.go
app/dialog/util.go
//go:build windows package dialog func firstOf(args ...string) string { for _, arg := range args { if arg != "" { return arg } } return "" }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/dialog/dlgs.go
app/dialog/dlgs.go
//go:build windows || darwin // Package dialog provides a simple cross-platform common dialog API. // Eg. to prompt the user with a yes/no dialog: // // if dialog.MsgDlg("%s", "Do you want to continue?").YesNo() { // // user pressed Yes // } // // The general usage pattern is to call one of the toplevel *Dlg funct...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/dialog/cocoa/dlg_darwin.go
app/dialog/cocoa/dlg_darwin.go
package cocoa // #cgo darwin LDFLAGS: -framework Cocoa -framework UniformTypeIdentifiers // #include <stdlib.h> // #include <sys/syslimits.h> // #include "dlg.h" import "C" import ( "bytes" "errors" "unsafe" ) type AlertParams struct { p C.AlertDlgParams } func mkAlertParams(msg, title string, style C.AlertStyl...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/version/version.go
app/version/version.go
//go:build windows || darwin package version var Version string = "0.0.0"
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/database_test.go
app/store/database_test.go
//go:build windows || darwin package store import ( "database/sql" "fmt" "os" "path/filepath" "sort" "strings" "testing" "time" "github.com/google/go-cmp/cmp" _ "github.com/mattn/go-sqlite3" ) func TestSchemaMigrations(t *testing.T) { t.Run("schema comparison after migration", func(t *testing.T) { tmpD...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/image.go
app/store/image.go
//go:build windows || darwin package store import ( "crypto/sha256" "encoding/hex" "fmt" "os" "path/filepath" "strings" ) type Image struct { Filename string `json:"filename"` Path string `json:"path"` Size int64 `json:"size,omitempty"` MimeType string `json:"mime_type,omitempty"` } // Bytes load...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/database.go
app/store/database.go
//go:build windows || darwin package store import ( "database/sql" "encoding/json" "fmt" "strings" "time" sqlite3 "github.com/mattn/go-sqlite3" ) // currentSchemaVersion defines the current database schema version. // Increment this when making schema changes that require migrations. const currentSchemaVersio...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/store_test.go
app/store/store_test.go
//go:build windows || darwin package store import ( "path/filepath" "testing" ) func TestStore(t *testing.T) { s, cleanup := setupTestStore(t) defer cleanup() t.Run("default id", func(t *testing.T) { // ID should be automatically generated id, err := s.ID() if err != nil { t.Fatal(err) } if id == ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/store.go
app/store/store.go
//go:build windows || darwin // Package store provides a simple JSON file store for the desktop application // to save and load data such as ollama server configuration, messages, // login information and more. package store import ( "encoding/json" "fmt" "log/slog" "os" "path/filepath" "runtime" "sync" "time...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/schema_test.go
app/store/schema_test.go
//go:build windows || darwin package store import ( "path/filepath" "testing" ) func TestSchemaVersioning(t *testing.T) { tmpDir := t.TempDir() // Override legacy config path to avoid migration logs oldLegacyConfigPath := legacyConfigPath legacyConfigPath = filepath.Join(tmpDir, "config.json") defer func() { ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/store/migration_test.go
app/store/migration_test.go
//go:build windows || darwin package store import ( "database/sql" "encoding/json" "os" "path/filepath" "testing" ) func TestConfigMigration(t *testing.T) { tmpDir := t.TempDir() // Create a legacy config.json legacyConfig := legacyData{ ID: "test-device-id-12345", FirstTimeRun: true, // In old...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/types/not/found.go
app/types/not/found.go
//go:build windows || darwin package not import ( "errors" ) // Found is an error that indicates that a value was not found. It // may be used by low-level packages to signal to higher-level // packages that a value was not found. // // It exists to avoid using errors.New("not found") in multiple // packages to mea...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/types/not/valids_test.go
app/types/not/valids_test.go
//go:build windows || darwin package not_test import ( "errors" "fmt" "github.com/ollama/ollama/app/types/not" ) func ExampleValids() { // This example demonstrates how to use the Valids type to create // a list of validation errors. // // The Valids type is a slice of ValidError values. Each ValidError // ...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/types/not/valids.go
app/types/not/valids.go
//go:build windows || darwin package not import ( "fmt" ) type ValidError struct { name string msg string args []any } // Valid returns a new validation error with the given name and message. func Valid(name, message string, args ...any) error { return ValidError{name, message, args} } // Message returns the...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/assets/assets.go
app/assets/assets.go
//go:build windows || darwin package assets import ( "embed" "io/fs" ) //go:embed *.ico var icons embed.FS func ListIcons() ([]string, error) { return fs.Glob(icons, "*") } func GetIcon(filename string) ([]byte, error) { return icons.ReadFile(filename) }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/logrotate/logrotate_test.go
app/logrotate/logrotate_test.go
//go:build windows || darwin package logrotate import ( "os" "path/filepath" "strconv" "testing" ) func TestRotate(t *testing.T) { logDir := t.TempDir() logFile := filepath.Join(logDir, "testlog.log") // No log exists Rotate(logFile) if err := os.WriteFile(logFile, []byte("1"), 0o644); err != nil { t.Fa...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/logrotate/logrotate.go
app/logrotate/logrotate.go
//go:build windows || darwin // package logrotate provides utilities for rotating logs // TODO (jmorgan): this most likely doesn't need it's own // package and can be moved to app where log files are created package logrotate import ( "log/slog" "os" "strconv" "strings" ) const MaxLogFiles = 5 func Rotate(filen...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/server/server_test.go
app/server/server_test.go
//go:build windows || darwin package server import ( "context" "os" "path/filepath" "reflect" "strings" "testing" "time" "github.com/ollama/ollama/app/store" ) func TestNew(t *testing.T) { tmpDir := t.TempDir() st := &store.Store{DBPath: filepath.Join(tmpDir, "db.sqlite")} defer st.Close() // Ensure data...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/server/server_unix.go
app/server/server_unix.go
//go:build darwin package server import ( "context" "errors" "fmt" "log/slog" "os" "os/exec" "path/filepath" "strconv" "strings" "syscall" ) var ( pidFile = filepath.Join(os.Getenv("HOME"), "Library", "Application Support", "Ollama", "ollama.pid") serverLogPath = filepath.Join(os.Getenv("HOME"), "....
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/server/server.go
app/server/server.go
//go:build windows || darwin package server import ( "bufio" "context" "errors" "fmt" "io" "log/slog" "os" "os/exec" "path/filepath" "regexp" "runtime" "strconv" "strings" "time" "github.com/ollama/ollama/app/logrotate" "github.com/ollama/ollama/app/store" ) const restartDelay = time.Second // Serv...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/server/server_windows.go
app/server/server_windows.go
package server import ( "context" "fmt" "log/slog" "os" "os/exec" "path/filepath" "strconv" "strings" "syscall" "golang.org/x/sys/windows" ) var ( pidFile = filepath.Join(os.Getenv("LOCALAPPDATA"), "Ollama", "ollama.pid") serverLogPath = filepath.Join(os.Getenv("LOCALAPPDATA"), "Ollama", "server.lo...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/format/field_test.go
app/format/field_test.go
//go:build windows || darwin package format import "testing" func TestKebabCase(t *testing.T) { tests := []struct { input string expected string }{ {"already-kebab-case", "already-kebab-case"}, {"simpleCamelCase", "simple-camel-case"}, {"PascalCase", "pascal-case"}, {"camelCaseWithNumber123", "camel...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/format/field.go
app/format/field.go
//go:build windows || darwin package format import ( "strings" "unicode" ) // KebabCase converts a string from camelCase or PascalCase to kebab-case. // (e.g. "camelCase" -> "camel-case") func KebabCase(str string) string { var result strings.Builder for i, char := range str { if i > 0 { prevChar := rune(s...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater_darwin.go
app/updater/updater_darwin.go
package updater // #cgo CFLAGS: -x objective-c // #cgo LDFLAGS: -framework Webkit -framework Cocoa -framework LocalAuthentication -framework ServiceManagement // #include "updater_darwin.h" // typedef const char cchar_t; import "C" import ( "archive/zip" "errors" "fmt" "io" "log/slog" "os" "os/user" "path/fil...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater_darwin_test.go
app/updater/updater_darwin_test.go
package updater import ( "archive/zip" "io/fs" "os" "path/filepath" "strings" "testing" ) func TestDoUpgrade(t *testing.T) { tmpDir := t.TempDir() BundlePath = filepath.Join(tmpDir, "Ollama.app") appContents := filepath.Join(BundlePath, "Contents") appBackupDir = filepath.Join(tmpDir, "backup") appContents...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater_windows.go
app/updater/updater_windows.go
package updater import ( "errors" "fmt" "log/slog" "os" "os/exec" "path" "path/filepath" "strings" "syscall" "time" "unsafe" "golang.org/x/sys/windows" ) var runningInstaller string type OSVERSIONINFOEXW struct { dwOSVersionInfoSize uint32 dwMajorVersion uint32 dwMinorVersion uint32 dwBuil...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater_windows_test.go
app/updater/updater_windows_test.go
//go:build windows || darwin package updater import ( "log/slog" "testing" ) func TestIsInstallerRunning(t *testing.T) { slog.SetLogLoggerLevel(slog.LevelDebug) Installer = "go.exe" if !isInstallerRunning() { t.Fatal("not running") } }
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater_test.go
app/updater/updater_test.go
//go:build windows || darwin package updater import ( "archive/zip" "bytes" "context" "fmt" "io" "log/slog" "net/http" "net/http/httptest" "testing" "time" "github.com/ollama/ollama/app/store" ) func TestIsNewReleaseAvailable(t *testing.T) { slog.SetLogLoggerLevel(slog.LevelDebug) var server *httptest....
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/updater/updater.go
app/updater/updater.go
//go:build windows || darwin package updater import ( "context" "crypto/rand" "encoding/json" "errors" "fmt" "io" "log/slog" "mime" "net/http" "net/url" "os" "path" "path/filepath" "runtime" "strconv" "strings" "time" "github.com/ollama/ollama/app/store" "github.com/ollama/ollama/app/version" "gi...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/webview/webview.go
app/webview/webview.go
//go:build windows || darwin /* * MIT License * * Copyright (c) 2017 Serge Zaitsev * Copyright (c) 2022 Steffen André Langnes * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software withou...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/ui/ui_test.go
app/ui/ui_test.go
//go:build windows || darwin package ui import ( "bytes" "encoding/json" "io" "net/http" "net/http/httptest" "path/filepath" "runtime" "strings" "testing" "github.com/ollama/ollama/app/store" ) func TestHandlePostApiSettings(t *testing.T) { tests := []struct { name string requested store.Setting...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/ui/extract.go
app/ui/extract.go
//go:build windows || darwin package ui import ( "bytes" "fmt" "path/filepath" "slices" "strings" "unicode/utf8" "github.com/ledongthuc/pdf" ) // convertBytesToText converts raw file bytes to text based on file extension func convertBytesToText(data []byte, filename string) string { ext := strings.ToLower(f...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/ui/ui.go
app/ui/ui.go
//go:build windows || darwin // package ui implements a chat interface for Ollama package ui import ( "context" "encoding/base64" "encoding/json" "errors" "fmt" "log/slog" "net/http" "net/http/httputil" "os" "runtime" "runtime/debug" "slices" "strconv" "strings" "sync" "time" "github.com/google/uuid...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
true
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/ui/app.go
app/ui/app.go
//go:build windows || darwin package ui import ( "bytes" "embed" "errors" "io/fs" "net/http" "strings" "time" ) //go:embed app/dist var appFS embed.FS // appHandler returns an HTTP handler that serves the React SPA. // It tries to serve real files first, then falls back to index.html for React Router. func (...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false
ollama/ollama
https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/app/ui/responses/types.go
app/ui/responses/types.go
//go:build windows || darwin package responses import ( "time" "github.com/ollama/ollama/app/store" "github.com/ollama/ollama/types/model" ) type ChatInfo struct { ID string `json:"id"` Title string `json:"title"` UserExcerpt string `json:"userExcerpt"` CreatedAt time.Time `json:"cr...
go
MIT
626af2d80973270c4d59b8df7153ac47ad67ed7b
2026-01-07T08:35:43.337630Z
false