Skip to content

add local Ollama FastContext config#28

Open
marcusschiesser wants to merge 1 commit into
microsoft:mainfrom
marcusschiesser:codex/ollama-fc-env-config
Open

add local Ollama FastContext config#28
marcusschiesser wants to merge 1 commit into
microsoft:mainfrom
marcusschiesser:codex/ollama-fc-env-config

Conversation

@marcusschiesser

Copy link
Copy Markdown

Summary

  • Prefer FC_MODEL, FC_BASE_URL, and optional FC_API_KEY for CLI model configuration.
  • Allow local OpenAI-compatible endpoints such as Ollama to run without an API key.
  • Document a macOS Ollama quick start for the quantized FastContext model.

Validation

  • uv run python -m py_compile src/fastcontext/agent/agent_factory.py src/fastcontext/agent/llm.py
  • Focused smoke check with FC_BASE_URL, FC_MODEL, and no API key.

Notes

uv run pytest currently reports existing async test collection failures for async test functions without async markers/configuration; unrelated synchronous tests passed.

@marcusschiesser marcusschiesser marked this pull request as ready for review June 25, 2026 03:55
@maoquan-ms maoquan-ms requested a review from Copilot June 25, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates FastContext’s local/CLI configuration to prefer FC_* environment variables, allows running against local OpenAI-compatible endpoints (e.g., Ollama) without supplying a real API key, and documents a macOS Ollama quick start for a quantized FastContext model.

Changes:

  • Switched agent factory configuration to FC_MODEL, FC_BASE_URL, with optional FC_API_KEY (while still supporting legacy MODEL/BASE_URL/API_KEY).
  • Updated the LLM client initialization to tolerate a missing API key and expanded reasoning-field parsing for responses.
  • Added README documentation for local Ollama setup and updated environment variable names in docs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/fastcontext/agent/llm.py Allows missing API key via placeholder, adds FC_REASONING_EFFORT, and broadens reasoning extraction from responses.
src/fastcontext/agent/agent_factory.py Introduces FC_* env var helpers with legacy fallback and requires model/base URL to be set.
README.md Documents FC_* configuration and adds an Ollama quick start section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to 81
reasoning_effort = os.getenv("FC_REASONING_EFFORT")
if reasoning_effort:
payload["reasoning_effort"] = reasoning_effort
if "qwen" in self.model:
payload["extra_body"] = {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants