Skip to content

Commit 2bbd960

Browse files
committed
Update instructor dependency to 1.7.7 and fix the streamlit example
1 parent a28cdf1 commit 2bbd960

File tree

13 files changed

+97
-85
lines changed

13 files changed

+97
-85
lines changed

examples/mcp_basic_agent/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@ async def example_usage():
8080
llm = await finder_agent.attach_llm(AnthropicAugmentedLLM)
8181

8282
result = await llm.generate_str(
83-
message="Print the first 2 paragraphs of https://www.anthropic.com/research/building-effective-agents",
84-
)
85-
logger.info(
86-
f"First 2 paragraphs of Building Effective Agents blog post: {result}"
83+
message="Print the first 2 paragraphs of https://modelcontextprotocol.io/introduction",
8784
)
85+
logger.info(f"First 2 paragraphs of Model Context Protocol docs: {result}")
8886

8987
# Multi-turn conversations
9088
result = await llm.generate_str(

examples/mcp_basic_ollama_agent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def example_usage():
4242

4343
# Let's switch the same agent to a different LLM
4444
result = await llm.generate_str(
45-
message="Print the first 2 paragraphs of https://www.anthropic.com/research/building-effective-agents",
45+
message="Print the first 2 paragraphs of https://modelcontextprotocol.io/introduction",
4646
request_params=RequestParams(model="llama3.1:8b"),
4747
)
4848
logger.info(f"Result: {result}")

examples/streamlit_mcp_basic_agent/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ This Streamlit example shows a "finder" Agent which has access to the 'fetch' an
55
You can ask it information about local files or URLs, and it will make the determination on what to use at what time to satisfy the request.
66

77
To run this example:
8-
```bash
9-
streamlit run main.py
10-
```
118

129
With uv:
1310

1411
```bash
15-
uv run streamlit run ./main.py
12+
uv pip install -r requirements.txt
13+
uv run streamlit run main.py
1614
```
1715

1816
<img src="https://github.com/user-attachments/assets/7ad27d23-9ed6-4e0e-ba7f-2d3b0afef847" height="512">

examples/streamlit_mcp_basic_agent/mcp_agent.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ logger:
1010
http_endpoint:
1111
http_headers:
1212
http_timeout: 5
13+
progress_display: false
1314

1415
mcp:
1516
servers:

examples/streamlit_mcp_basic_agent/pyproject.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/streamlit_mcp_rag_agent/mcp_agent.config.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ logger:
1010
http_endpoint:
1111
http_headers:
1212
http_timeout: 5
13+
progress_display: false
1314

1415
mcp:
1516
servers:
1617
qdrant:
1718
command: "uvx"
18-
args:
19-
[
20-
"mcp-server-qdrant"
21-
]
19+
args: ["mcp-server-qdrant"]
2220
env:
2321
{
2422
"QDRANT_URL": "http://localhost:6333",
2523
"COLLECTION_NAME": "my_collection",
26-
"EMBEDDING_MODEL": "BAAI/bge-small-en-v1.5"
24+
"EMBEDDING_MODEL": "BAAI/bge-small-en-v1.5",
2725
}
2826

2927
openai:
Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,82 @@
1-
# Graded Report for 'The Battle of Glimmerwood'
1+
# Graded Report: Evaluation of "The Battle of Glimmerwood"
22

3-
This report provides aggregated feedback on the student's short story, covering three key areas: Proofreading and Grammar, Factual/Logical Consistency, and APA Style Adherence. Below are detailed observations and recommendations for improvement.
3+
This report consolidates feedback on the short story in three key areas: proofreading, factual/logical consistency, and APA style adherence. The goal is to offer actionable recommendations to improve both the narrative clarity and its academic presentation.
44

5-
## I. Proofreading and Grammar
5+
---
66

7-
- **Spelling and Word Choice:**
8-
- Replace "knowed" with "known".
9-
- Change "live peacefully" to "lived peacefully".
10-
- Correct "shaterred" to "shattered" and "aproached" to "approached".
11-
- Adjust verbs for past tense consistency (e.g., "attack" to "attacked", "lead" to "led", "aim" to "aimed").
7+
## 1. Proofreading Feedback
128

13-
- **Punctuation and Sentence Structure:**
14-
- Address comma splices by splitting run-on sentences or using semicolons appropriately.
15-
- Add missing apostrophes for possessives (e.g., "forests natural defenses" should be "forest's natural defenses", "Glimmerstones true power" should be "Glimmerstones' true power").
16-
- Improve overall clarity by breaking overly long sentences into shorter, more digestible segments.
9+
The text contains several typographical, grammatical, and punctuation issues. Key points include:
1710

18-
## II. Factuality and Logical Consistency
11+
- **Spelling Errors:**
12+
- *"knowed"* should be replaced by *"known"*.
13+
- *"choas"* should be corrected to *"chaos"*.
14+
- *"shaterred"* should be changed to *"shattered"*.
15+
- *"aproached"* should be corrected to *"approached"*.
1916

20-
- **Narrative Consistency:**
21-
- The fantasy world is generally well-established with a mystical setting and clear roles (villagers, Dark Marauders, heroic Elara).
22-
23-
- **Ambiguity in Key Elements:**
24-
- There is an inconsistency regarding the Glimmerstones. Initially presented as objects believed to grant immortality, their true power is later described as unconfirmed. Clarifying this point would enhance the logical coherence of the narrative.
17+
- **Grammatical Inconsistencies:**
18+
- Phrases like *"who were live peacefully"* need revision to *"who lived peacefully"*.
19+
- Some verb tenses and subject-verb agreements are inconsistent (e.g., *"aim"* vs. *"aimed"*; *"captured"* instead of *"capture"*).
2520

26-
## III. APA Style Adherence
21+
- **Punctuation Issues:**
22+
- Comma splices in sentences (e.g., joining two independent clauses with only a comma) should be revised using semicolons or by splitting into separate sentences.
23+
- Missing commas after introductory phrases and before non-restrictive clauses reduce clarity.
2724

28-
- **Title Page and Formatting:**
29-
- APA style requires a dedicated title page with the title in title case, centered along with author and institutional information. The markdown header ("## The Battle of Glimmerwood") does not meet this requirement.
25+
Addressing these issues will enhance readability and ensure the narrative is polished.
3026

31-
- **Running Head and Page Numbers:**
32-
- Include a running head (a shortened version of the title) and page numbers on each page of the document.
27+
---
3328

34-
- **General Formatting Guidelines:**
35-
- The document should adhere to 1-inch margins, be double spaced, and use a consistent font (e.g., 12-point Times New Roman).
36-
- Any references or external sources must be cited in APA format, with a reference list using hanging indents.
29+
## 2. Fact-Checking and Logical Consistency
3730

38-
## IV. Overall Recommendations
31+
The story is set within a fantasy framework and largely maintains internal consistency. Notable points include:
3932

40-
- Correct all identified spelling and grammatical errors.
41-
- Rework sentences to eliminate comma splices and improve clarity.
42-
- Clarify the ambiguous narrative elements (specifically the true nature and role of the Glimmerstones) to enhance logical consistency.
43-
- Reformat the document to comply fully with APA guidelines, including the creation of a separate title page, inclusion of a running head, and proper citation formatting where necessary.
33+
- **Consistency with the Genre:**
34+
- The narrative establishes a mystical setting (Glimmerwood) with magical creatures and powerful artifacts (Glimmerstones) that fit within the fantasy genre.
4435

45-
**Conclusion:**
46-
Implementing these recommendations will significantly improve the clarity, coherence, and professional presentation of the narrative. The feedback provided should serve as a comprehensive guide to refining the story both stylistically and academically.
36+
- **Ambiguity in Plot Elements:**
37+
- The true power of the Glimmerstones is left ambiguous (stated as never being fully confirmed), which could be a deliberate narrative device but may confuse readers if not further clarified.
38+
- The rapid resolution of conflict—such as the sudden appearance of magical defenses—could be enhanced by providing more background on the villagers’ relationship with these creatures.
39+
40+
Overall, while the internal logic is maintained, clarifying these ambiguities could strengthen the narrative coherence.
41+
42+
---
43+
44+
## 3. APA Style and Formatting Evaluation
45+
46+
The document in its current Markdown format does not adhere to APA formatting guidelines. Key considerations include:
47+
48+
- **Title Page and Running Head:**
49+
- APA style requires a separate title page with centered title, author information, institutional affiliation, and a running head with page numbers. The narrative presently uses a markdown header instead.
50+
51+
- **Headings and Text Formatting:**
52+
- APA requires a specific hierarchy for headings. Replace Markdown-style headers with APA-compliant formatting (e.g., centered, bold, and appropriately leveled headings).
53+
- Use 12-point Times New Roman font, double spacing, and 1-inch margins throughout the document.
54+
55+
- **References and Citations:**
56+
- If external sources are cited, they must be formatted with hanging indents and correct capitalization. Although the narrative does not include citations, any future references should comply with APA guidelines.
57+
58+
Adopting these APA standards will ensure the document meets academic requirements and appears professionally formatted.
59+
60+
---
61+
62+
## 4. Overall Recommendations
63+
64+
While "The Battle of Glimmerwood" is imaginative and engaging, consider the following actions to further refine the work:
65+
66+
- **Proofreading:** Address the identified spelling, grammar, and punctuation errors to improve clarity and professionalism.
67+
- **Narrative Clarity:** Provide additional context for certain fantasy elements (e.g., the nature of the Glimmerstones and the villagers’ relationship with magical creatures) to bolster logical consistency.
68+
- **APA Formatting:** Transition the document from Markdown to an APA-compliant format by creating a proper title page, adjusting heading styles, and ensuring standard text formatting (12-point Times New Roman, double spacing, 1-inch margins).
69+
70+
Implementing these revisions will enhance both the readability and academic rigor of the work.
71+
72+
---
73+
74+
*End of Report*
75+
76+
---
77+
78+
## Final Consolidation and Objective Completion
79+
80+
Based on the analysis across proofreading, factual/logical consistency, and APA style adherence, all criteria have been met. Minor enhancements, such as adding a dedicated fact-checking section, have been recommended, but these do not impede the overall completion of the objective.
81+
82+
Objective Status: Complete.

examples/workflow_router/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def example_usage():
108108
# This should route the query to fetch MCP server (inferring just by the server name alone!)
109109
# You can also specify a server description in mcp_agent.config.yaml to help the router make a more informed decision
110110
results = await anthropic_router.route_to_server(
111-
request="Print the first two paragraphs of https://www.anthropic.com/research/building-effective-agents",
111+
request="Print the first two paragraphs of https://modelcontextprotocol.io/introduction",
112112
top_k=1,
113113
)
114114
logger.info("Router Results:", data=results)

pyproject.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcp-agent"
3-
version = "0.0.10"
3+
version = "0.0.11"
44
description = "Build effective agents with Model Context Protocol (MCP) using simple, composable patterns."
55
readme = "README.md"
66
license = { file = "LICENSE" }
@@ -15,7 +15,7 @@ classifiers = [
1515
requires-python = ">=3.10"
1616
dependencies = [
1717
"fastapi>=0.115.6",
18-
"instructor>=1.7.0",
18+
"instructor>=1.7.7",
1919
"mcp>=1.2.1",
2020
"opentelemetry-distro>=0.50b0",
2121
"opentelemetry-exporter-otlp-proto-http>=1.29.0",
@@ -33,7 +33,7 @@ temporal = [
3333
"temporalio>=1.8.0",
3434
]
3535
anthropic = [
36-
"anthropic>=0.42.0",
36+
"anthropic>=0.48.0",
3737
"instructor[anthropic]>=1.7.2",
3838
]
3939
openai = [
@@ -67,7 +67,4 @@ silsila = "mcp_agent.cli.__main__:app"
6767
include = ["mcp-agent"]
6868

6969
[tool.setuptools.package-data]
70-
mcp-agent = ["data/*.json"]
71-
72-
[tool.uv.workspace]
73-
members = ["examples/streamlit_mcp_basic_agent"]
70+
mcp-agent = ["data/*.json"]

src/mcp_agent/mcp/mcp_aggregator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@ async def call_tool(
268268

269269
if SEP in name: # Namespaced tool name
270270
parts = name.split(SEP)
271-
271+
272272
for i in range(len(parts) - 1, 0, -1):
273273
potential_server_name = SEP.join(parts[:i])
274274
if potential_server_name in self.server_names:
275275
server_name = potential_server_name
276276
local_tool_name = SEP.join(parts[i:])
277277
break
278-
278+
279279
if server_name is None:
280280
server_name, local_tool_name = name.split(SEP, 1)
281281
else:

src/mcp_agent/workflows/llm/augmented_llm_anthropic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from pydantic import BaseModel
55

6-
import instructor
76
from anthropic import Anthropic
87
from anthropic.types import (
98
ContentBlock,
@@ -271,6 +270,8 @@ async def generate_structured(
271270
# We need to do this in a two-step process because Instructor doesn't
272271
# know how to invoke MCP tools via call_tool, so we'll handle all the
273272
# processing first and then pass the final response through Instructor
273+
import instructor
274+
274275
response = await self.generate_str(
275276
message=message,
276277
request_params=request_params,

src/mcp_agent/workflows/llm/augmented_llm_openai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
from typing import Iterable, List, Type
33

4-
import instructor
54
from openai import OpenAI
65
from openai.types.chat import (
76
ChatCompletionAssistantMessageParam,
@@ -291,6 +290,8 @@ async def generate_structured(
291290
# We need to do this in a two-step process because Instructor doesn't
292291
# know how to invoke MCP tools via call_tool, so we'll handle all the
293292
# processing first and then pass the final response through Instructor
293+
import instructor
294+
294295
response = await self.generate_str(
295296
message=message,
296297
request_params=request_params,

uv.lock

Lines changed: 8 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)