Skip to content

About

Built while contributing to open-chat-studio to compare LLM APIs & repeat bugs. Experimenting with AI assisted dev

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLM Integration Playbook (Jupyter)

This repository contains Jupyter notebooks used to test and compare LLM integrations across multiple providers and models.

Goals & Learning

Set out to learn:

  • SDK setup and authentication across OpenAI, Gemini, Perplexity, and Anthropic
  • API style differences (Responses API vs Chat Completions) and provider-specific endpoint/model compatibility
  • LangChain abstractions for provider-agnostic workflows
  • AI-assisted development workflow including AGENTS.md and SKILLS.md (with GitHub Copilot, Claude Code)

What came out of it:

  1. Diagnosed a bug in Dimagi Open Chat Studio (OCS): Perplexity's Sonar models use chat-completions style, but its Agent API uses an OpenAI-compatible /v1 base URL. OCS's LLM abstraction layer didn't account for that split. The investigation also clarified how OCS's LLM service abstraction layer is built.
  2. Researched: OpenAI's Responses API file_search tool successfully searches across 2 vector stores in a single call but hard-caps at 2 — a 3rd vector_store_id throws a 400 "maximum of 2 vector stores allowed" error, confirming the undocumented Dimagi OCS Remote Index limitation.

Notebooks

Notebook Purpose Key techniques
OpenAI.ipynb OpenAI Responses API and Chat Completions API key loading (python-dotenv); instructions vs role-based input array; legacy Chat Completions reference
OpenAI-remote-vector-store.ipynb Responses API file_search tool over remote vector stores Multi-vector-store search calls; reproduces the 2-vector-store hard cap (400 error) behind finding #2 above
Gemini.ipynb Google Gemini SDK and LangChain Google integration Direct google-genai usage (genai.Client); content generation & thinking config; ChatGoogleGenerativeAI
Perplexity.ipynb Perplexity Sonar, Search, and Agent API behavior Sonar calls via requests/perplexityai; Search API; Agent API via OpenAI-SDK-compatible base URL
Perplexity-OCS-bug-repro.ipynb Reproduces the OCS bug above Intentional endpoint mismatches showing 404/400 behavior
Claude.ipynb Anthropic API behavior API key validation & error handling; message creation; token counting/usage; tool use via @beta_tool
LangChain-openai.ipynb LangChain wrappers over OpenAI: prompt templates, tool binding, structured output ChatOpenAI invocation patterns; Responses API tool binding (web search); prompt templates (langchain-core); chain composition; structured output via Pydantic
LangChain-perplexity.ipynb LangChain wrapper over Perplexity ChatPerplexity basic invocation; note on use_responses_api incompatibility

requirements.txt holds the Python dependencies shared across all notebooks.

Prerequisites

  • Python 3.12+ (tested on Linux).
  • VS Code with Jupyter extension.
  • API keys for LLM providers you want to test.

Setup and environment

See AGENTS.md for:

AI assisted development and CI

Skills (audit-dependencies, git-rebase) and the @claude PR review workflow are described in AGENTS.md.

References

See AGENTS.md for links to LLM API documentation

About

Built while contributing to open-chat-studio to compare LLM APIs & repeat bugs. Experimenting with AI assisted dev

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages