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 |
|---|---|---|---|---|---|---|---|---|
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/base64_test.go | pkg/utils/base64_test.go | package utils_test
import (
. "github.com/mudler/LocalAI/pkg/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("utils/base64 tests", func() {
It("GetImageURLAsBase64 can strip jpeg data url prefixes", func() {
// This one doesn't actually _care_ that it's base64, so feed "bad" d... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/hash.go | pkg/utils/hash.go | package utils
import (
"crypto/md5"
"fmt"
)
func MD5(s string) string {
return fmt.Sprintf("%x", md5.Sum([]byte(s)))
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/untar.go | pkg/utils/untar.go | package utils
import (
"fmt"
"os"
"github.com/mholt/archiver/v3"
)
func IsArchive(file string) bool {
uaIface, err := archiver.ByExtension(file)
if err != nil {
return false
}
_, ok := uaIface.(archiver.Unarchiver)
return ok
}
func ExtractArchive(archive, dst string) error {
uaIface, err := archiver.ByE... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/strings.go | pkg/utils/strings.go | package utils
import (
"math/rand"
"time"
)
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func init() {
rand.Seed(time.Now().UnixNano())
}
func RandString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return stri... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/utils_suite_test.go | pkg/utils/utils_suite_test.go | package utils_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestUtils(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Utils test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/utils/base64.go | pkg/utils/base64.go | package utils
import (
"encoding/base64"
"fmt"
"io"
"net/http"
"regexp"
"strings"
"time"
"github.com/mudler/xlog"
)
var base64DownloadClient http.Client = http.Client{
Timeout: 30 * time.Second,
}
var dataURIPattern = regexp.MustCompile(`^data:([^;]+);base64,`)
// GetContentURIAsBase64 checks if the strin... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/audio/audio.go | pkg/audio/audio.go | package audio
// Copied from VoxInput
import (
"encoding/binary"
"io"
)
// WAVHeader represents the WAV file header (44 bytes for PCM)
type WAVHeader struct {
// RIFF Chunk (12 bytes)
ChunkID [4]byte
ChunkSize uint32
Format [4]byte
// fmt Subchunk (16 bytes)
Subchunk1ID [4]byte
Subchunk1Siz... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/langchain/langchain.go | pkg/langchain/langchain.go | package langchain
type PredictOptions struct {
Model string `json:"model"`
// MaxTokens is the maximum number of tokens to generate.
MaxTokens int `json:"max_tokens"`
// Temperature is the temperature for sampling, between 0 and 1.
Temperature float64 `json:"temperature"`
// StopWords is a list of words to stop ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/langchain/huggingface.go | pkg/langchain/huggingface.go | package langchain
import (
"context"
"fmt"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/llms/huggingface"
)
type HuggingFace struct {
modelPath string
token string
}
func NewHuggingFace(repoId, token string) (*HuggingFace, error) {
if token == "" {
return nil, fmt.Errorf("no huggingfac... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/signals/handler.go | pkg/signals/handler.go | package signals
import (
"os"
"os/signal"
"sync"
"syscall"
)
var (
signalHandlers []func()
signalHandlersMutex sync.Mutex
signalHandlersOnce sync.Once
)
func RegisterGracefulTerminationHandler(fn func()) {
signalHandlersMutex.Lock()
defer signalHandlersMutex.Unlock()
signalHandlers = append(signalHan... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/embed.go | pkg/grpc/embed.go | package grpc
import (
"context"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
var _ Backend = new(embedBackend)
var _ pb.Backend_PredictStreamServer = new(embedBackendServerStream)
type embedBackend struct {
s *server
}
func (e *embedBackend) IsBusy... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/client.go | pkg/grpc/client.go | package grpc
import (
"context"
"fmt"
"io"
"sync"
"time"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
type Client struct {
address string
busy bool
parallel bool
sync.Mutex
opMutex sync.Mutex
wd WatchDog
}
type WatchDo... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/interface.go | pkg/grpc/interface.go | package grpc
import (
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
)
type AIModel interface {
Busy() bool
Lock()
Unlock()
Locking() bool
Predict(*pb.PredictOptions) (string, error)
PredictStream(*pb.PredictOptions, chan string) error
Load(*pb.ModelOptions) error
Embeddings(*pb.PredictOptions) ([]float32, er... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/server.go | pkg/grpc/server.go | package grpc
import (
"context"
"fmt"
"log"
"net"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"google.golang.org/grpc"
)
// A GRPC Server that allows to run LLM inference.
// It is used by the LLMServices to expose the LLM functionalities that are called by the client.
// The GRPC Service is general, trying ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/backend.go | pkg/grpc/backend.go | package grpc
import (
"context"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"google.golang.org/grpc"
)
var embeds = map[string]*embedBackend{}
func Provide(addr string, llm AIModel) {
embeds[addr] = &embedBackend{s: &server{llm: llm}}
}
func NewClient(address string, parallel bool, wd WatchDog, enableWatchDo... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/base/base.go | pkg/grpc/base/base.go | package base
// This is a wrapper to satisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"fmt"
"os"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
gopsutil "github.com/shirou/gopsutil/v3/process"
)
// Bas... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/grpc/base/singlethread.go | pkg/grpc/base/singlethread.go | package base
import (
"sync"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
)
// SingleThread are backends that does not support multiple requests.
// There will be only one request being served at the time.
// This is useful for models that are not thread safe and cannot run
// multiple requests at the same time.
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/downloader/downloader_suite_test.go | pkg/downloader/downloader_suite_test.go | package downloader
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestDownloader(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Downloader test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/downloader/progress.go | pkg/downloader/progress.go | package downloader
import (
"context"
"hash"
)
type progressWriter struct {
fileName string
total int64
fileNo int
totalFiles int
written int64
downloadStatus func(string, string, string, float64)
hash hash.Hash
ctx context.Context
}
func (pw *progress... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/downloader/uri.go | pkg/downloader/uri.go | package downloader
import (
"context"
"crypto/sha256"
"errors"
"fmt"
"hash"
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/google/go-containerregistry/pkg/v1/tarball"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/mudler/LocalAI/pkg/oci"
"github... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/downloader/uri_test.go | pkg/downloader/uri_test.go | package downloader_test
import (
"crypto/rand"
"crypto/sha256"
"fmt"
"net/http"
"net/http/httptest"
"os"
"regexp"
"strconv"
. "github.com/mudler/LocalAI/pkg/downloader"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Gallery API tests", func() {
Context("URI", func() {
It("... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/downloader/huggingface.go | pkg/downloader/huggingface.go | package downloader
import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"strings"
)
type HuggingFaceScanResult struct {
RepositoryId string `json:"repositoryId"`
Revision string `json:"revision"`
HasUnsafeFiles bool `json:"hasUnsafeFile"`
ClamAVInfectedFiles []string `json:... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/sound/int16.go | pkg/sound/int16.go | package sound
import (
"encoding/binary"
"math"
)
/*
MIT License
Copyright (c) 2024 Xbozon
*/
// calculateRMS16 calculates the root mean square of the audio buffer for int16 samples.
func CalculateRMS16(buffer []int16) float64 {
var sumSquares float64
for _, sample := range buffer {
val := float64(sample) /... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/sound/float32.go | pkg/sound/float32.go | package sound
import (
"encoding/binary"
"math"
)
func BytesFloat32(bytes []byte) float32 {
bits := binary.LittleEndian.Uint32(bytes)
float := math.Float32frombits(bits)
return float
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/ollama.go | pkg/oci/ollama.go | package oci
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
// Define the main struct for the JSON data
type Manifest struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Config ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/tarball.go | pkg/oci/tarball.go | package oci
import (
"io"
"os"
containerdCompression "github.com/containerd/containerd/archive/compression"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/m... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/ollama_test.go | pkg/oci/ollama_test.go | package oci_test
import (
"context"
"os"
. "github.com/mudler/LocalAI/pkg/oci" // Update with your module path
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("OCI", func() {
Context("ollama", func() {
It("pulls model files", func() {
f, err := os.CreateTemp("", "ollama")
Ex... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/oci_suite_test.go | pkg/oci/oci_suite_test.go | package oci_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestOCI(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "OCI test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/image.go | pkg/oci/image.go | package oci
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"os"
"runtime"
"strconv"
"strings"
"syscall"
"time"
"github.com/containerd/containerd/archive"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregi... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/image_test.go | pkg/oci/image_test.go | package oci_test
import (
"context"
"os"
"runtime"
. "github.com/mudler/LocalAI/pkg/oci" // Update with your module path
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("OCI", func() {
Context("when template is loaded successfully", func() {
It("should evaluate the template corr... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/blob_test.go | pkg/oci/blob_test.go | package oci_test
import (
"context"
"os"
. "github.com/mudler/LocalAI/pkg/oci" // Update with your module path
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("OCI", func() {
Context("pulling images", func() {
It("should fetch blobs correctly", func() {
f, err := os.CreateTemp(... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/oci/blob.go | pkg/oci/blob.go | package oci
import (
"context"
"fmt"
"io"
"os"
"github.com/mudler/LocalAI/pkg/xio"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
oras "oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry/remote"
)
func FetchImageBlob(ctx context.Context, r, reference, dst string, statusReader func(ocispec.Desc... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/function_structure.go | pkg/functions/function_structure.go | package functions
import (
"encoding/json"
"github.com/mudler/LocalAI/pkg/functions/grammars"
)
type Item struct {
Type string `json:"type"`
Properties map[string]interface{} `json:"properties"`
}
type JSONFunctionStructure struct {
OneOf []Item `json:"oneOf,omitempty"`
A... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/parse_test.go | pkg/functions/parse_test.go | package functions_test
import (
"encoding/json"
"regexp"
"strings"
. "github.com/mudler/LocalAI/pkg/functions"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("LocalAI function parse tests", func() {
var functionConfig FunctionsConfig
BeforeEach(func() {
// Default configuratio... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/iterative_parser.go | pkg/functions/iterative_parser.go | package functions
import (
"encoding/json"
"errors"
"fmt"
"math/rand"
"regexp"
"strings"
"unicode"
"unicode/utf8"
"github.com/mudler/xlog"
)
// ChatMsgPartialException represents a partial parsing exception (recoverable)
type ChatMsgPartialException struct {
Message string
}
func (e *ChatMsgPartialExcepti... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/functions.go | pkg/functions/functions.go | package functions
import (
"encoding/json"
"github.com/mudler/xlog"
)
const (
defaultFunctionNameKey = "name"
defaultFunctionArgumentsKey = "arguments"
)
type Function struct {
Name string `json:"name"`
Description string `json:"description"`
Strict bool ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/functions_test.go | pkg/functions/functions_test.go | package functions_test
import (
. "github.com/mudler/LocalAI/pkg/functions"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("LocalAI grammar functions", func() {
Describe("ToJSONStructure()", func() {
It("converts a list of functions to a JSON structure that can be parsed to a gramma... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/json_mode.go | pkg/functions/json_mode.go | package functions
const (
JSONBNF = `root ::= object
value ::= object | array | string | number | ("true" | "false" | "null") ws
object ::=
"{" ws (
string ":" ws value
("," ws string ":" ws value)*
)? "}" ws
array ::=
"[" ws (
value
("," ws value)*
)? "]" ws
string ::=
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/parse.go | pkg/functions/parse.go | package functions
import (
"encoding/json"
"errors"
"io"
"regexp"
"slices"
"strings"
"unicode/utf8"
"github.com/mudler/LocalAI/pkg/functions/grammars"
"github.com/mudler/LocalAI/pkg/utils"
"github.com/mudler/xlog"
)
// @Description GrammarConfig contains configuration for grammar parsing
type GrammarConfig... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/json_stack_parser.go | pkg/functions/json_stack_parser.go | package functions
import (
"encoding/json"
"errors"
"regexp"
"strings"
"unicode"
)
// JSONStackElementType represents the type of JSON stack element
type JSONStackElementType int
const (
JSONStackElementObject JSONStackElementType = iota
JSONStackElementKey
JSONStackElementArray
)
// JSONStackElement repres... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/functions_suite_test.go | pkg/functions/functions_suite_test.go | package functions_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestFunctions(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Functions test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/llama31_schema_test.go | pkg/functions/grammars/llama31_schema_test.go | package grammars_test
import (
"strings"
. "github.com/mudler/LocalAI/pkg/functions/grammars"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
const (
testllama31Input1 = `
{
"oneOf": [
{
"type": "object",
"properties": {
"function": {"const": "create_event"},
"arguments": {
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/rules.go | pkg/functions/grammars/rules.go | package grammars
import (
"fmt"
"strings"
"github.com/mudler/LocalAI/pkg/utils"
)
type Rules map[string]string
func (rules Rules) ToGrammar(options ...func(*GrammarOption)) string {
grammarOpts := &GrammarOption{}
grammarOpts.Apply(options...)
prefix := grammarOpts.Prefix
maybeArray := grammarOpts.MaybeArra... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/types.go | pkg/functions/grammars/types.go | package grammars
type SchemaConverterType int
const (
JSONSchema SchemaConverterType = iota
LLama31Schema
)
const (
LlamaType string = "llama3.1"
JSONType string = "json"
)
func (s SchemaConverterType) String() string {
switch s {
case JSONSchema:
return JSONType
case LLama31Schema:
return LlamaType
}
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/llama31_schema.go | pkg/functions/grammars/llama31_schema.go | package grammars
import (
"encoding/json"
"fmt"
"regexp"
"sort"
"strings"
)
type LLama31SchemaConverter struct {
fnName string
rules Rules
}
func NewLLama31SchemaConverter(fnName string) *LLama31SchemaConverter {
rules := make(map[string]string)
rules["space"] = SPACE_RULE
if fnName == "" {
fnName = "na... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/json_schema_test.go | pkg/functions/grammars/json_schema_test.go | package grammars_test
import (
"strings"
. "github.com/mudler/LocalAI/pkg/functions"
. "github.com/mudler/LocalAI/pkg/functions/grammars"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var testFunctions = []Item{
{
Type: "object",
Properties: createFunction(
"function",
"arguments",
"c... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/json_schema.go | pkg/functions/grammars/json_schema.go | package grammars
// a golang port of https://github.com/ggerganov/llama.cpp/pull/1887
import (
"encoding/json"
"fmt"
"sort"
"strings"
)
type JSONSchemaConverter struct {
propOrder map[string]int
rules Rules
}
func NewJSONSchemaConverter(propOrder string) *JSONSchemaConverter {
propOrderSlice := strings.S... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/options.go | pkg/functions/grammars/options.go | package grammars
type GrammarOption struct {
PropOrder string
Prefix string
MaybeArray bool
DisableParallelNewLines bool
MaybeString bool
NoMixedFreeString bool
ExpectStringsAfterJSON bool
FunctionName string
SchemaType SchemaConverterType
}
f... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/bnf_rules.go | pkg/functions/grammars/bnf_rules.go | package grammars
import (
"encoding/json"
"regexp"
)
var (
PRIMITIVE_RULES = map[string]string{
"boolean": `("true" | "false") space`,
"number": `("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? space`,
"integer": `("-"? ([0-9] | [1-9] [0-9]*)) space`,
"string": `"\"" (
[^"\\] |
"\\"... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/functions/grammars/grammars_suite_test.go | pkg/functions/grammars/grammars_suite_test.go | package grammars_test
import (
"testing"
. "github.com/mudler/LocalAI/pkg/functions"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestGrammar(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Grammar test suite")
}
func createFunction(field1 string, field2 string, name string, propert... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/xsync/map_test.go | pkg/xsync/map_test.go | package xsync_test
import (
. "github.com/mudler/LocalAI/pkg/xsync"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("SyncMap", func() {
Context("Syncmap", func() {
It("sets and gets", func() {
m := NewSyncedMap[string, string]()
m.Set("foo", "bar")
Expect(m.Get("foo")).To(... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/xsync/sync_suite_test.go | pkg/xsync/sync_suite_test.go | package xsync_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestSync(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "LocalAI sync test")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/pkg/xsync/map.go | pkg/xsync/map.go | package xsync
import (
"sync"
)
type SyncedMap[K comparable, V any] struct {
mu sync.RWMutex
m map[K]V
}
func NewSyncedMap[K comparable, V any]() *SyncedMap[K, V] {
return &SyncedMap[K, V]{
m: make(map[K]V),
}
}
func (m *SyncedMap[K, V]) Map() map[K]V {
m.mu.RLock()
defer m.mu.RUnlock()
return m.m
}
fun... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/icon.go | cmd/launcher/icon.go | package main
import (
_ "embed"
"fyne.io/fyne/v2"
)
//go:embed logo.png
var logoData []byte
// resourceIconPng is the LocalAI logo icon
var resourceIconPng = &fyne.StaticResource{
StaticName: "logo.png",
StaticContent: logoData,
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/main.go | cmd/launcher/main.go | package main
import (
"log"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/driver/desktop"
coreLauncher "github.com/mudler/LocalAI/cmd/launcher/internal"
"github.com/mudler/LocalAI/pkg/signals"
)
func main() {
// Create the application with unique ID
myApp := app.NewWithID("com.localai.launcher")
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/launcher_test.go | cmd/launcher/internal/launcher_test.go | package launcher_test
import (
"os"
"path/filepath"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"fyne.io/fyne/v2/app"
launcher "github.com/mudler/LocalAI/cmd/launcher/internal"
)
var _ = Describe("Launcher", func() {
var (
launcherInstance *launcher.Launcher
tempDir stri... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/launcher.go | cmd/launcher/internal/launcher.go | package launcher
import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"log"
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
"syscall"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
)
// Config represents the launcher configuration
t... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/launcher_suite_test.go | cmd/launcher/internal/launcher_suite_test.go | package launcher_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestLauncher(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Launcher Suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/systray_manager.go | cmd/launcher/internal/systray_manager.go | package launcher
import (
"fmt"
"log"
"net/url"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/widget"
)
// SystrayManager manages the system tray functionality
type SystrayManager struct {
launcher *Launcher
window fyne.Window
ap... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/release_manager_test.go | cmd/launcher/internal/release_manager_test.go | package launcher_test
import (
"os"
"path/filepath"
"runtime"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
launcher "github.com/mudler/LocalAI/cmd/launcher/internal"
)
var _ = Describe("ReleaseManager", func() {
var (
rm *launcher.ReleaseManager
tempDir string
)
BeforeEach(fun... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/ui.go | cmd/launcher/internal/ui.go | package launcher
import (
"fmt"
"log"
"net/url"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
)
// EnvVar represents an environment variable
type EnvVar struct {
Key string
Value string
}
// LauncherUI handles the user interface
type LauncherUI struct {
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/launcher/internal/release_manager.go | cmd/launcher/internal/release_manager.go | package launcher
import (
"bufio"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/mudler/LocalAI/internal"
)
// Release represents a LocalAI release
type Release struct {
Version string `json:"tag_... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/cmd/local-ai/main.go | cmd/local-ai/main.go | package main
import (
"os"
"path/filepath"
"github.com/alecthomas/kong"
"github.com/joho/godotenv"
"github.com/mudler/LocalAI/core/cli"
"github.com/mudler/LocalAI/internal"
"github.com/mudler/xlog"
_ "github.com/mudler/LocalAI/swagger"
)
func main() {
var err error
// Initialize xlog at a level of INFO, ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/integration/stores_test.go | tests/integration/stores_test.go | package integration_test
import (
"context"
"math"
"math/rand"
"os"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/mudler/xlog"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/pkg/grpc"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/store"
"g... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/integration/integration_suite_test.go | tests/integration/integration_suite_test.go | package integration_test
import (
"os"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/mudler/xlog"
)
func TestLocalAI(t *testing.T) {
xlog.SetLogger(xlog.NewLogger(xlog.LogLevel("info"), "text"))
RegisterFailHandler(Fail)
RunSpecs(t, "LocalAI test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/e2e-aio/e2e_test.go | tests/e2e-aio/e2e_test.go | package e2e_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"github.com/mudler/LocalAI/core/schema"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/jsonschema"
)
var _ = Describe("E2E test", func() ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/e2e-aio/sample_data_test.go | tests/e2e-aio/sample_data_test.go | package e2e_test
// e2e VAD test has had issues with wav files. Temporarily test by using a manually-dumped slice of data obtained via:
// Downloaded https://models.silero.ai/vad_models/en.wav
// Converted with:
// ffmpeg -t 15 -i en.wav -f f32le -acodec pcm_f32le - | od -An -v -t f4 | awk '{for(i=1;i<=NF;i++) printf ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/e2e-aio/e2e_suite_test.go | tests/e2e-aio/e2e_suite_test.go | package e2e_test
import (
"context"
"fmt"
"os"
"runtime"
"testing"
"time"
"github.com/docker/go-connections/nat"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/sashabaranov/go-openai"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/e2e/e2e_test.go | tests/e2e/e2e_test.go | package e2e_test
import (
"context"
"fmt"
"os"
"os/exec"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
openaigo "github.com/otiai10/openaigo"
"github.com/sashabaranov/go-openai"
)
var _ = Describe("E2E test", func() {
var client *openai.Client
var client2 *openaigo.Client
Context("API with ep... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/tests/e2e/e2e_suite_test.go | tests/e2e/e2e_suite_test.go | package e2e_test
import (
"os"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var (
localAIURL = os.Getenv("LOCALAI_API")
)
func TestLocalAI(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "LocalAI E2E test suite")
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/swagger/docs.go | swagger/docs.go | // Package swagger Code generated by swaggo/swag. DO NOT EDIT
package swagger
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {
... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/bark-cpp/gobark.go | backend/go/bark-cpp/gobark.go | package main
// #cgo CXXFLAGS: -I${SRCDIR}/sources/bark.cpp/ -I${SRCDIR}/sources/bark.cpp/encodec.cpp -I${SRCDIR}/sources/bark.cpp/encodec.cpp/ggml/include -I${SRCDIR}/sources/bark.cpp/examples -I${SRCDIR}/sources/bark.cpp/spm-headers
// #cgo LDFLAGS: -L${SRCDIR}/ -L${SRCDIR}/sources/bark.cpp/build/examples -L${SRCDIR... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/bark-cpp/main.go | backend/go/bark-cpp/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
flag.Parse()
if err := grpc.StartServer(*addr, &Bark... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/huggingface/langchain.go | backend/go/huggingface/langchain.go | package main
// This is a wrapper to statisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"fmt"
"os"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"github.com/mu... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/huggingface/main.go | backend/go/huggingface/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
flag.Parse()
if err := grpc.StartServer(*addr, &LLM... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/silero-vad/vad.go | backend/go/silero-vad/vad.go | package main
// This is a wrapper to statisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"fmt"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"github.com/streamer... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/silero-vad/main.go | backend/go/silero-vad/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
flag.Parse()
if err := grpc.StartServer(*addr, &VAD... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/local-store/debug.go | backend/go/local-store/debug.go | //go:build debug
// +build debug
package main
import (
"github.com/mudler/xlog"
)
func assert(cond bool, msg string) {
if !cond {
xlog.Fatal().Stack().Msg(msg)
}
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/local-store/production.go | backend/go/local-store/production.go | //go:build !debug
// +build !debug
package main
func assert(cond bool, msg string) {
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/local-store/store.go | backend/go/local-store/store.go | package main
// This is a wrapper to statisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"container/heap"
"errors"
"fmt"
"math"
"slices"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/local-store/main.go | backend/go/local-store/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each store
import (
"flag"
"os"
grpc "github.com/mudler/LocalAI/pkg/grpc"
"github.com/mudler/xlog"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
xlog.SetLogger(xlog.N... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/llm/llama/llama.go | backend/go/llm/llama/llama.go | package main
// This is a wrapper to statisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"fmt"
"path/filepath"
"github.com/go-skynet/go-llama.cpp"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.co... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/llm/llama/main.go | backend/go/llm/llama/main.go | package main
// GRPC Falcon server
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
flag.Parse()
if err := grpc.... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/stablediffusion-ggml/gosd.go | backend/go/stablediffusion-ggml/gosd.go | package main
import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"unsafe"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"github.com/mudler/LocalAI/pkg/utils"
)
type SDGGML struct {
base.SingleThread
threads int
sampleMethod string
cfgScale float32
}... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/stablediffusion-ggml/main.go | backend/go/stablediffusion-ggml/main.go | package main
import (
"flag"
"github.com/ebitengine/purego"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
type LibFuncs struct {
FuncPtr any
Name string
}
func main() {
gosd, err := purego.Dlopen("./libgosd.so", purego.RTLD_... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/whisper/gowhisper.go | backend/go/whisper/gowhisper.go | package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"unsafe"
"github.com/go-audio/wav"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
"github.com/mudler/LocalAI/pkg/utils"
)
var (
CppLoadModel func(modelPath string) int
CppLoadModelVAD ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/whisper/main.go | backend/go/whisper/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
"os"
"github.com/ebitengine/purego"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
type LibFuncs struct {
FuncPtr... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/piper/piper.go | backend/go/piper/piper.go | package main
// This is a wrapper to statisfy the GRPC service interface
// It is meant to be used by the main executable that is the server for the specific backend type (falcon, gpt3, etc)
import (
"fmt"
"os"
"path/filepath"
"github.com/mudler/LocalAI/pkg/grpc/base"
pb "github.com/mudler/LocalAI/pkg/grpc/proto... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/backend/go/piper/main.go | backend/go/piper/main.go | package main
// Note: this is started internally by LocalAI and a server is allocated for each model
import (
"flag"
grpc "github.com/mudler/LocalAI/pkg/grpc"
)
var (
addr = flag.String("addr", "localhost:50051", "the address to connect to")
)
func main() {
flag.Parse()
if err := grpc.StartServer(*addr, &Pip... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/internal/version.go | internal/version.go | package internal
import "fmt"
var Version = ""
var Commit = ""
func PrintableVersion() string {
return fmt.Sprintf("%s (%s)", Version, Commit)
}
| go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/dependencies_manager/manager.go | core/dependencies_manager/manager.go | package main
import (
"fmt"
"os"
"path/filepath"
"github.com/mudler/LocalAI/pkg/downloader"
"github.com/mudler/LocalAI/pkg/utils"
"gopkg.in/yaml.v3"
)
type Asset struct {
FileName string `yaml:"filename"`
URL string `yaml:"url"`
SHA string `yaml:"sha"`
}
func main() {
// read the YAML file whic... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/list_models.go | core/services/list_models.go | package services
import (
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/pkg/model"
)
type LooseFilePolicy int
const (
LOOSE_ONLY LooseFilePolicy = iota
SKIP_IF_CONFIGURED
SKIP_ALWAYS
ALWAYS_INCLUDE
)
func ListModels(bcl *config.ModelConfigLoader, ml *model.ModelLoader, filter config.Model... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/metrics.go | core/services/metrics.go | package services
import (
"context"
"github.com/mudler/xlog"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/metric"
metricApi "go.opentelemetry.io/otel/sdk/metric"
)
type LocalAIMetricsService struct {
Meter metric.Meter
ApiTimeMetric me... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/models.go | core/services/models.go | package services
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/gallery"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/system"
"github.com/mudler/LocalAI/pkg/utils"
"github.com/mudler/xlog"
"gopkg.in/yam... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/backends_test.go | core/services/backends_test.go | package services_test
import (
"context"
"os"
"path/filepath"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/services"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/system"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"
)
var _ =... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/gallery.go | core/services/gallery.go | package services
import (
"context"
"fmt"
"sync"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/gallery"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/system"
)
type GalleryService struct {
appConfig *config.ApplicationConfig
sync.Mutex
ModelGalleryChannel ... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/operation.go | core/services/operation.go | package services
import (
"context"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/pkg/xsync"
)
type GalleryOp[T any, E any] struct {
ID string
GalleryElementName string
Delete bool
Req T
// If specified, we install directly the gallery element
GalleryElemen... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/backends.go | core/services/backends.go | package services
import (
"context"
"errors"
"fmt"
"path/filepath"
"strings"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/gallery"
"github.com/mudler/LocalAI/pkg/downloader"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/system"
"github.com/mudler/LocalAI/p... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/agent_jobs.go | core/services/agent_jobs.go | package services
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"os"
"path/filepath"
"sort"
"strings"
"sync"
"text/template"
"time"
"github.com/Masterminds/sprig/v3"
"github.com/google/uuid"
"github.com/mudler/LocalAI/core/config"
mcpTools "github... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | true |
mudler/LocalAI | https://github.com/mudler/LocalAI/blob/23df29fbd3eec1af3944521205fd62b20d4149e5/core/services/backend_monitor.go | core/services/backend_monitor.go | package services
import (
"context"
"fmt"
"strings"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/schema"
"github.com/mudler/LocalAI/pkg/grpc/proto"
"github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/xlog"
gopsutil "github.com/shirou/gopsutil/v3/process"
)
type BackendMonit... | go | MIT | 23df29fbd3eec1af3944521205fd62b20d4149e5 | 2026-01-07T08:35:47.749878Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.