Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class TestCopilotChatModelIntegration(ChatModelIntegrationTests):

### Version Pinning

The project pins `langchain-tests>=1.0.0` to ensure test stability. When updating:
The project pins `langchain-tests>=1.1.9` to ensure test stability. When updating:

```bash
# Update langchain-tests
Expand Down
3 changes: 2 additions & 1 deletion examples/01_simple_invoke.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Example 1: Simple synchronous invocation."""

from langchain_copilot import CopilotChatModel
from langchain_core.messages import HumanMessage, SystemMessage

from langchain_copilot import CopilotChatModel


def main():
"""Simple synchronous invocation example."""
Expand Down
3 changes: 2 additions & 1 deletion examples/02_streaming.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Example 2: Streaming response."""

from langchain_copilot import CopilotChatModel
from langchain_core.messages import HumanMessage

from langchain_copilot import CopilotChatModel


def main():
"""Streaming response example."""
Expand Down
4 changes: 3 additions & 1 deletion examples/03_async_invoke.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Example 3: Asynchronous invocation."""

import asyncio
from langchain_copilot import CopilotChatModel

from langchain_core.messages import HumanMessage

from langchain_copilot import CopilotChatModel


async def main():
"""Asynchronous invocation example."""
Expand Down
4 changes: 3 additions & 1 deletion examples/04_async_streaming.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Example 4: Asynchronous streaming."""

import asyncio
from langchain_copilot import CopilotChatModel

from langchain_core.messages import HumanMessage

from langchain_copilot import CopilotChatModel


async def main():
"""Asynchronous streaming example."""
Expand Down
5 changes: 3 additions & 2 deletions examples/05_langchain_chain.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Example 5: Using in a LangChain chain."""

from langchain_copilot import CopilotChatModel
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

from langchain_copilot import CopilotChatModel


def main():
Expand Down
5 changes: 3 additions & 2 deletions examples/07_tools.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Example 7: Using tools with Copilot."""

from langchain_copilot import CopilotChatModel
from langchain_core.messages import HumanMessage
from copilot import define_tool
from langchain_core.messages import HumanMessage
from pydantic import BaseModel, Field

from langchain_copilot import CopilotChatModel


# Define a tool parameter schema using Pydantic
class WeatherParams(BaseModel):
Expand Down
11 changes: 6 additions & 5 deletions examples/08_bind_tools.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Example 8: Using bind_tools for LangChain integration."""

from langchain_copilot import CopilotChatModel
from copilot import define_tool
from langchain_core.messages import HumanMessage
from langchain_core.tools import tool
from copilot import define_tool
from pydantic import BaseModel, Field

from langchain_copilot import CopilotChatModel


# Method 1: Using Copilot SDK's @define_tool decorator
class WeatherParams(BaseModel):
Expand Down Expand Up @@ -42,9 +43,9 @@ def search_web(query: str) -> str:
"langchain": "LangChain is a framework for developing applications with LLMs...",
"copilot": "GitHub Copilot is an AI pair programmer...",
}
for key in results:
for key, value in results.items():
if key in query.lower():
return results[key]
return value
return f"No results found for: {query}"


Expand Down Expand Up @@ -73,8 +74,8 @@ def main():

# You can also bind tools and use in chains
print("\n[Query 3] Using in a chain:")
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

prompt = ChatPromptTemplate.from_messages(
[
Expand Down
3 changes: 2 additions & 1 deletion examples/09_memory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from langchain.agents import create_agent
from langchain_core.runnables import RunnableConfig
from langgraph.checkpoint.memory import InMemorySaver

from langchain_copilot import CopilotChatModel
from langchain_core.runnables import RunnableConfig

agent = create_agent(
model=CopilotChatModel(model="gpt-5-mini"),
Expand Down
3 changes: 2 additions & 1 deletion examples/10_image_input.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import base64
from pathlib import Path

from langchain_copilot import CopilotChatModel
from langchain_core.messages import HumanMessage

from langchain_copilot import CopilotChatModel

model = CopilotChatModel(model_name="gpt-5-mini")

image_path = Path(__file__).with_name("10_image.png")
Expand Down
32 changes: 23 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ classifiers = [
]

dependencies = [
"github-copilot-sdk==0.3.0",
"langchain-core>=1.4.0",
"pydantic>=2.13.4",
"github-copilot-sdk==1.0.13",
"langchain-core>=1.6.2",
"pydantic>=2.13.5",
]

[project.urls]
Expand All @@ -29,13 +29,13 @@ Changelog = "https://github.com/derf974/copilot-langchain/blob/main/CHANGELOG.md

[project.optional-dependencies]
dev = [
"pytest>=9,<10",
"pytest-asyncio>=1.3.0,<2",
"black>=26.3.1",
"ruff>=0.15.13",
"langchain-tests>=1.1.7",
"pytest>=9.1.1,<10",
"pytest-asyncio>=1.4.0,<2",
"black>=26.5.1",
"ruff>=0.16.7",
"langchain-tests>=1.1.9",
"pytest-cov>=7.1.0",
"langchain>=1.3.0",
"langchain>=1.4.0",
]

[build-system]
Expand All @@ -47,3 +47,17 @@ packages = ["src/langchain_copilot"]

[tool.hatch.version]
path = "src/langchain_copilot/__init__.py"

[tool.black]
target-version = ["py313"]

[dependency-groups]
dev = [
"black>=26.5.1",
"langchain>=1.4.0",
"langchain-tests>=1.1.9",
"pytest>=9.1.1,<10",
"pytest-asyncio>=1.4.0,<2",
"pytest-cov>=7.1.0",
"ruff>=0.16.7",
]
Loading
Loading