{"id":"6b08c24c38c84264c2027478","slug":"ai-in-python","title":"AI w Pythonie: Anthropic SDK, Pydantic, LangChain, LlamaIndex i FastAPI w praktyce","summary":"Mapa najbogatszego ekosystemu AI – kiedy wystarczy SDK dostawcy z Pydantic, kiedy LangChain lub LlamaIndex – oraz strumieniowanie, narzędzia, RAG z sentence-transformers i Qdrant, serwer MCP i endpoint FastAPI z testami.","servedLang":"pl","availableLangs":["pl","en"],"topics":["ai-in-python","rag","tool-use","embeddings-vector-db"],"techs":["python"],"tags":["python","anthropic-sdk","pydantic","langchain","langgraph","llamaindex","sentence-transformers","qdrant","fastapi","mcp","claude"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":16,"stats":{"views":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:35:40.912Z","updatedAt":"2026-11-27T10:04:55.427Z","requestedLang":"pl","theme":{"hero":"classic","heroMedia":null,"accent":"rose","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"AI w Pythonie: Anthropic SDK (stream, messages.parse, tool runner), Pydantic, LangChain create_agent, LlamaIndex, sentence-transformers, Qdrant, MCP i FastAPI SSE z testami.","wordCount":3192,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Python jest domem uczenia maszynowego, więc nic dziwnego, że to w nim powstaje najwięcej bibliotek AI: oficjalne SDK dostawców, "},{"type":"text","text":"LangChain","marks":[{"type":"bold"}]},{"type":"text","text":" i "},{"type":"text","text":"LangGraph","marks":[{"type":"bold"}]},{"type":"text","text":", "},{"type":"text","text":"LlamaIndex","marks":[{"type":"bold"}]},{"type":"text","text":", "},{"type":"text","text":"PydanticAI","marks":[{"type":"bold"}]},{"type":"text","text":", "},{"type":"text","text":"sentence-transformers","marks":[{"type":"code"}]},{"type":"text","text":", klienci wszystkich baz wektorowych. Ta obfitość ma cenę – łatwo zbudować prototyp z sześciu warstw abstrakcji, którego nikt nie umie debugować. Ten przewodnik pokazuje, jak z tego ekosystemu wybrać tyle, ile trzeba, i jak przenieść kod z notatnika do usługi produkcyjnej."}]},{"type":"stats","attrs":{"items":[{"value":"1","label":"model Pydantic","hint":"opisuje strukturę odpowiedzi, argumenty narzędzi i kontrakt API"},{"value":"3","label":"poziomy abstrakcji","hint":"SDK dostawcy, frameworki (LangChain, LlamaIndex), agenci (LangGraph)"},{"value":"0","label":"blokujących wywołań w endpointach async","hint":"w FastAPI używaj AsyncAnthropic"}]}},{"type":"callout","attrs":{"variant":"info","title":"W skrócie"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"SDK dostawcy","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"anthropic","marks":[{"type":"code"}]},{"type":"text","text":") z "},{"type":"text","text":"Pydantic","marks":[{"type":"bold"}]},{"type":"text","text":" pokrywa większość potrzeb: strumieniowanie, ustrukturyzowane odpowiedzi ("},{"type":"text","text":"messages.parse","marks":[{"type":"code"}]},{"type":"text","text":") i narzędzia z tool runnerem."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"LangChain/LangGraph","marks":[{"type":"bold"}]},{"type":"text","text":" i "},{"type":"text","text":"LlamaIndex","marks":[{"type":"bold"}]},{"type":"text","text":" opłacają się przy agentach z wieloma integracjami i przy RAG na wielu źródłach – ale dokładają zależności, które trzeba przypinać i testować."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"W produkcji liczą się nudne rzeczy: klient asynchroniczny w FastAPI, limity czasu, logowanie "},{"type":"text","text":"usage","marks":[{"type":"code"}]},{"type":"text","text":", testy z atrapą klienta i "},{"type":"text","text":"ewaluacje","marks":[{"type":"link","attrs":{"href":"/pl/topics/evals"}}]},{"type":"text","text":" na prawdziwym modelu."}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"problem-notatnik-ktory-trafil-na-produkcje"},"content":[{"type":"text","text":"Problem: notatnik, który trafił na produkcję"}]},{"type":"paragraph","content":[{"type":"text","text":"Zespół danych Pierogarni Haliny przygotował w Jupyterze asystenta odpowiadającego na pytania o menu i zamówienia. Demo zachwyciło zarząd, więc kod przeniesiono do usługi FastAPI niemal bez zmian. Po tygodniu:"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"endpoint "},{"type":"text","text":"async","marks":[{"type":"code"}]},{"type":"text","text":" wołał synchroniczny klient, więc jedno długie pytanie blokowało pętlę zdarzeń i wszystkie inne żądania czekały,"}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"pip install","marks":[{"type":"code"}]},{"type":"text","text":" bez przypiętych wersji podniósł bibliotekę integracyjną i aplikacja przestała się uruchamiać,"}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"łańcuch sześciu wywołań frameworka zwracał tekst, który parsowano wyrażeniami regularnymi,"}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"nie było ani jednego testu – każdy uruchamiał prawdziwy model i kosztował."}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"Żaden z tych problemów nie wynika z Pythona. Wynika z braku decyzji, której warstwy ekosystemu użyć i jak ją zamknąć w kodzie produkcyjnym."}]},{"type":"heading","attrs":{"level":2,"id":"mapa-ekosystemu"},"content":[{"type":"text","text":"Mapa ekosystemu"}]},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Warstwa"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Biblioteki"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Do czego"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"SDK dostawców"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"anthropic","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"openai","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"pełne API: streaming, "},{"type":"text","text":"messages.parse","marks":[{"type":"code"}]},{"type":"text","text":", tool runner, cache promptów, batch, pliki"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Struktury danych"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"pydantic","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"schematy odpowiedzi i narzędzi, walidacja, kontrakty FastAPI"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Frameworki aplikacji LLM"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"langchain","marks":[{"type":"code"}]},{"type":"text","text":" + "},{"type":"text","text":"langchain-anthropic","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"llama-index","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"agenci, integracje (loadery, bazy wektorowe), gotowe potoki RAG"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Agenci i przepływy"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"langgraph","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"pydantic-ai","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"przepływy jako grafy ze stanem, punkty kontrolne, human-in-the-loop"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Embeddingi i wektory"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"sentence-transformers","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"qdrant-client","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"pgvector","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"chromadb","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"lokalne embeddingi, wyszukiwanie wektorowe – patrz "},{"type":"text","text":"embeddingi i bazy wektorowe","marks":[{"type":"link","attrs":{"href":"/pl/topics/embeddings-vector-db"}}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Modele lokalne"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ollama","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"vllm","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"transformers","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"otwarte modele na własnym sprzęcie – patrz "},{"type":"text","text":"lokalne modele","marks":[{"type":"link","attrs":{"href":"/pl/topics/local-llms"}}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Protokół"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"mcp","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"serwery i klienci "},{"type":"text","text":"MCP","marks":[{"type":"link","attrs":{"href":"/pl/topics/mcp"}}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Ewaluacja i obserwowalność"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"pytest","marks":[{"type":"code"}]},{"type":"text","text":", promptfoo, Langfuse, OpenTelemetry"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"testy, ewaluacje, śledzenie kosztów i opóźnień"}]}]}]}]},{"type":"packageCard","attrs":{"eco":"pypi","name":"anthropic"}},{"type":"packageCard","attrs":{"eco":"pypi","name":"pydantic"}},{"type":"paragraph","content":[{"type":"text","text":"Zanim sięgniesz po framework, odpowiedz sobie na kilka pytań:"}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart TB\n  A[\"Nowa funkcja AI\"] --> B([\"Jedno wywołanie modelu<br/>lub prosta pętla narzędzi?\"])\n  B -->|\"tak\"| C[\"anthropic + Pydantic\"]\n  B -->|\"nie\"| D([\"Przepływ ze stanem,<br/>rozgałęzieniami, akceptacją człowieka?\"])\n  D -->|\"tak\"| E[\"LangGraph<br/>(lub własna maszyna stanów)\"]\n  D -->|\"nie\"| F([\"RAG na wielu źródłach<br/>i formatach dokumentów?\"])\n  F -->|\"tak\"| G[\"LlamaIndex<br/>lub LangChain + baza wektorowa\"]\n  F -->|\"nie\"| H([\"Agent z wieloma<br/>gotowymi integracjami?\"])\n  H -->|\"tak\"| I[\"LangChain create_agent\"]\n  H -->|\"nie\"| C","caption":"SDK dostawcy czy framework? Zacznij od najprostszej warstwy, która rozwiązuje problem"}},{"type":"section","attrs":{"background":"tint","width":"wide","padding":"m"},"content":[{"type":"heading","attrs":{"level":2,"id":"jak-urosl-ten-ekosystem"},"content":[{"type":"text","text":"Jak urósł ten ekosystem"}]},{"type":"columns","attrs":{"layout":"1-1","valign":"top"},"content":[{"type":"column","content":[{"type":"paragraph","content":[{"type":"text","text":"Większość bibliotek z mapy powstała w ciągu kilku lat i wciąż szybko się zmienia. To dobra wiadomość – problemy z 2023 roku (parsowanie odpowiedzi, ręczne pętle narzędzi) mają dziś gotowe rozwiązania w SDK. I zła – tutoriale sprzed roku często pokazują API, którego już nie ma."}]},{"type":"paragraph","content":[{"type":"text","text":"Dlatego w tym artykule kod opiera się na wersjach aktualnych w listopadzie 2026: "},{"type":"text","text":"anthropic","marks":[{"type":"code"}]},{"type":"text","text":" 2.x, "},{"type":"text","text":"langchain","marks":[{"type":"code"}]},{"type":"text","text":" 1.x, "},{"type":"text","text":"llama-index-core","marks":[{"type":"code"}]},{"type":"text","text":" 0.14, "},{"type":"text","text":"mcp","marks":[{"type":"code"}]},{"type":"text","text":" 2.x, "},{"type":"text","text":"sentence-transformers","marks":[{"type":"code"}]},{"type":"text","text":" 6.x. Zanim skopiujesz przykład z internetu, sprawdź, dla jakiej wersji powstał."}]}]},{"type":"column","content":[{"type":"timeline","attrs":{"items":[{"date":"2019","title":"Transformers i Sentence-BERT","text":"Hugging Face porządkuje modele w bibliotece transformers; praca o Sentence-BERT daje początek sentence-transformers."},{"date":"2022","title":"LangChain i GPT Index","text":"Harrison Chase publikuje LangChain, Jerry Liu – GPT Index, późniejszy LlamaIndex."},{"date":"2023","title":"SDK dostawców","text":"oficjalne SDK Pythona stają się podstawowym sposobem wywoływania modeli."},{"date":"2024","title":"LangGraph, MCP, PydanticAI","text":"przepływy agentów jako grafy, protokół MCP z SDK dla Pythona i agenci w stylu Pydantic."},{"date":"2025","title":"LangChain 1.0","text":"stabilne API z create_agent zbudowanym na LangGraph."},{"date":"2026","title":"mcp 2.0 i anthropic 2.0","text":"lipiec i październik: nowe główne wersje SDK – i integracje, które muszą za nimi nadążyć."}]}}]}]}]},{"type":"heading","attrs":{"level":2,"id":"sdk-dostawcy-strumieniowanie-i-ustrukturyzowane-odpowiedzi"},"content":[{"type":"text","text":"SDK dostawcy: strumieniowanie i ustrukturyzowane odpowiedzi"}]},{"type":"paragraph","content":[{"type":"text","text":"Oficjalne SDK daje dwie rzeczy, których potrzebuje prawie każda funkcja: "},{"type":"text","text":"strumieniowanie","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"messages.stream","marks":[{"type":"code"}]},{"type":"text","text":") i "},{"type":"text","text":"ustrukturyzowane odpowiedzi","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"messages.parse","marks":[{"type":"code"}]},{"type":"text","text":"). Ta druga przyjmuje klasę Pydantic, wysyła jej schemat jako format odpowiedzi, a wynik zwraca jako zwalidowany obiekt w "},{"type":"text","text":"parsed_output","marks":[{"type":"code"}]},{"type":"text","text":". Koniec z wyrażeniami regularnymi na „2x ruskie i jedne z kapustą”."}]},{"type":"codeGroup","attrs":{"title":"Strumieniowanie i ekstrakcja zamówienia z Pydantic"},"content":[{"type":"codeBlock","attrs":{"language":"python","filename":"stream_chat.py"},"content":[{"type":"text","text":"import anthropic\n\nclient = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY from the environment\n\nSYSTEM = \"You are the support assistant of Halina's Pierogi. Answer briefly and politely.\"\n\n\ndef ask(question: str) -> str:\n    with client.messages.stream(\n        model=\"claude-opus-5-5\",\n        max_tokens=64000,\n        output_config={\"effort\": \"low\"},  # FAQ answers need little reasoning\n        system=SYSTEM,\n        messages=[{\"role\": \"user\", \"content\": question}],\n    ) as stream:\n        for text in stream.text_stream:  # print tokens as they arrive\n            print(text, end=\"\", flush=True)\n        final = stream.get_final_message()\n\n    print(f\"\\n[{final.stop_reason}] in={final.usage.input_tokens} out={final.usage.output_tokens}\")\n    return \"\".join(b.text for b in final.content if b.type == \"text\")\n\n\nif __name__ == \"__main__\":\n    ask(\"How long do you cook frozen pierogi?\")"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"extract_order.py"},"content":[{"type":"text","text":"from typing import Literal\n\nimport anthropic\nfrom pydantic import BaseModel, Field\n\nclient = anthropic.Anthropic()\n\n\nclass OrderLine(BaseModel):\n    dish: Literal[\"ruskie\", \"cabbage\", \"meat\", \"spinach\"]\n    quantity: int = Field(ge=1, le=20)\n\n\nclass OrderDraft(BaseModel):\n    lines: list[OrderLine]\n    pickup_time: str | None = Field(description=\"HH:MM, or null when not given\")\n    notes: str | None\n\n\ndef extract(text: str) -> OrderDraft:\n    # parse() sends the Pydantic schema as a structured-output format\n    # and validates the JSON the model returns.\n    response = client.messages.parse(\n        model=\"claude-opus-5-5\",\n        max_tokens=16000,\n        system=\"Turn the customer's message into an order draft. Do not invent dishes.\",\n        messages=[{\"role\": \"user\", \"content\": text}],\n        output_format=OrderDraft,\n    )\n    if response.stop_reason != \"end_turn\":\n        raise RuntimeError(f\"Unexpected stop reason: {response.stop_reason}\")\n    return response.parsed_output\n\n\nif __name__ == \"__main__\":\n    draft = extract(\"2x ruskie and one cabbage for 18:30, no onion please\")\n    print(draft.model_dump_json(indent=2))"}]}]},{"type":"paragraph","content":[{"type":"text","text":"Kilka szczegółów, które łatwo przeoczyć:"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Nie każde ograniczenie Pydantic trafia do modelu.","marks":[{"type":"bold"}]},{"type":"text","text":" Structured outputs obsługują podzbiór JSON Schema; SDK przenosi nieobsługiwane ograniczenia (np. "},{"type":"text","text":"ge","marks":[{"type":"code"}]},{"type":"text","text":"/"},{"type":"text","text":"le","marks":[{"type":"code"}]},{"type":"text","text":" przy liczbach) do opisu pola i sprawdza je po stronie klienta przy walidacji. Błędy walidacji obsłuż tak samo jak każde inne."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Pola opcjonalne opisuj jako ","marks":[{"type":"bold"}]},{"type":"text","text":"str | None","marks":[{"type":"code"}]},{"type":"text","text":" bez wartości domyślnej","marks":[{"type":"bold"}]},{"type":"text","text":", jeśli model ma zawsze je zwrócić (choćby jako "},{"type":"text","text":"null","marks":[{"type":"code"}]},{"type":"text","text":") – wtedy schemat jest jednoznaczny."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Sprawdzaj ","marks":[{"type":"bold"}]},{"type":"text","text":"stop_reason","marks":[{"type":"code"}]},{"type":"text","text":".","marks":[{"type":"bold"}]},{"type":"text","text":" Odpowiedź ucięta przez "},{"type":"text","text":"max_tokens","marks":[{"type":"code"}]},{"type":"text","text":" nie przejdzie walidacji; lepiej zareagować wprost niż łapać wyjątek parsera."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"effort","marks":[{"type":"code"}]},{"type":"text","text":" zamiast temperatury.","marks":[{"type":"bold"}]},{"type":"text","text":" Aktualne modele Claude nie przyjmują parametrów próbkowania; głębokość rozumowania ustawiasz w "},{"type":"text","text":"output_config","marks":[{"type":"code"}]},{"type":"text","text":". Wyjaśnienie w "},{"type":"text","text":"podstawach LLM","marks":[{"type":"link","attrs":{"href":"/pl/topics/llm-fundamentals"}}]},{"type":"text","text":"."}]}]}]},{"type":"resourceRef","attrs":{"resourceId":"6b0854b31a40d7e6c24ca5f2"}},{"type":"heading","attrs":{"level":2,"id":"narzedzia-tool-runner-z-dekoratorem"},"content":[{"type":"text","text":"Narzędzia: tool runner z dekoratorem"}]},{"type":"paragraph","content":[{"type":"text","text":"Pętlę "},{"type":"text","text":"tool use","marks":[{"type":"link","attrs":{"href":"/pl/topics/tool-use"}}]},{"type":"text","text":" możesz napisać ręcznie, ale SDK Pythona ma "},{"type":"text","text":"tool runner","marks":[{"type":"bold"}]},{"type":"text","text":" (w wersji beta): dekorator "},{"type":"text","text":"@beta_tool","marks":[{"type":"code"}]},{"type":"text","text":" buduje schemat narzędzia z sygnatury funkcji i docstringu, a runner wywołuje narzędzia i odsyła wyniki do modelu, aż ten skończy. Docstring jest tu częścią kontraktu – to z niego model dowiaduje się, "},{"type":"text","text":"kiedy","marks":[{"type":"bold"}]},{"type":"text","text":" użyć narzędzia."}]}]},"toc":[{"id":"problem-notatnik-ktory-trafil-na-produkcje","text":"Problem: notatnik, który trafił na produkcję","level":2,"locked":false},{"id":"mapa-ekosystemu","text":"Mapa ekosystemu","level":2,"locked":false},{"id":"jak-urosl-ten-ekosystem","text":"Jak urósł ten ekosystem","level":2,"locked":false},{"id":"sdk-dostawcy-strumieniowanie-i-ustrukturyzowane-odpowiedzi","text":"SDK dostawcy: strumieniowanie i ustrukturyzowane odpowiedzi","level":2,"locked":false},{"id":"narzedzia-tool-runner-z-dekoratorem","text":"Narzędzia: tool runner z dekoratorem","level":2,"locked":false},{"id":"rag-sentence-transformers-qdrant-i-claude","text":"RAG: sentence-transformers, Qdrant i Claude","level":2,"locked":true},{"id":"frameworki-langchain-i-llamaindex","text":"Frameworki: LangChain i LlamaIndex","level":2,"locked":true},{"id":"mcp-udostepnij-narzedzia-innym-aplikacjom","text":"MCP: udostępnij narzędzia innym aplikacjom","level":2,"locked":true},{"id":"produkcja-fastapi-strumien-sse-i-testy-bez-api","text":"Produkcja: FastAPI, strumień SSE i testy bez API","level":2,"locked":true},{"id":"sdk-czy-framework","text":"SDK czy framework?","level":2,"locked":true},{"id":"lista-kontrolna","text":"Lista kontrolna","level":2,"locked":true},{"id":"sprawdz-sie","text":"Sprawdź się","level":2,"locked":true},{"id":"co-dalej","text":"Co dalej","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":63,"visibleBlocks":22,"resources":[{"id":"6b0857bf3c96f2d34d0b42c9","type":"article","provider":"web","url":"https://python.langchain.com/docs/introduction","embedUrl":null,"title":"LangChain overview - Docs by LangChain","description":"LangChain provides create_agent: a minimal, highly configurable agent harness. Compose exactly the agent your use case needs from model, tools, prompt, and middleware.","author":"LangChain","thumbnailUrl":"https://langchain-5e9cc07a.mintlify.site/_mintlify/api/og/v2?division=Documentation&title=LangChain+overview&description=LangChain+provides+create_agent%3A+a+minimal%2C+highly+configurable+agent+harness.+Compose+exactly+the+agent+your+use+case+needs+from+model%2C+tools%2C+prompt%2C+and+midd&theme=f35197f94eda06999e44c5f5&signature=aa3d25aa184031869d94ffb8625b9b112c7e5f1558c6bf00a55e53e896be40b5","durationSec":null,"lang":"en","topics":["ai-in-python"],"techs":["python"],"tags":["ai"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":60,"verifiedAt":"2026-11-26T11:25:52.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857a93c96f2d34d0b3246","type":"repo","provider":"github","url":"https://github.com/run-llama/llama_index","embedUrl":null,"title":"run-llama/llama_index","description":"LlamaIndex is the document processing platform for AI","author":"run-llama","thumbnailUrl":"https://opengraph.githubassets.com/1/run-llama/llama_index","durationSec":null,"lang":"en","topics":["rag","ai-in-python"],"techs":["python"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"seed","publishedAt":null,"popularity":94,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:40.963Z","updatedAt":"2026-11-26T16:00:40.963Z"},{"id":"6b0857b23c96f2d34d0b343a","type":"repo","provider":"github","url":"https://github.com/pydantic/pydantic-ai","embedUrl":null,"title":"pydantic/pydantic-ai","description":"How Python does AI. Agents, realtime voice, image generation, embeddings. Every model, every interface, typed end to end.","author":"pydantic","thumbnailUrl":"https://opengraph.githubassets.com/1/pydantic/pydantic-ai","durationSec":null,"lang":"en","topics":["ai-agents","ai-in-python","embeddings-vector-db"],"techs":["python"],"tags":["agent-framework","pydantic","python","genai","llm","harness","ai","harness-engineering"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2024-06-21T15:55:04.000Z","popularity":84,"verifiedAt":"2026-11-26T10:56:00.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:49.541Z","updatedAt":"2026-11-26T16:00:49.541Z"},{"id":"6b0857b53c96f2d34d0b3970","type":"article","provider":"web","url":"https://www.sbert.net/index.html","embedUrl":null,"title":"SentenceTransformers: Python framework for sentence, text and image embeddings","description":"","author":"sbert.net","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["embeddings-vector-db","ai-in-python"],"techs":["python"],"tags":["ai","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2024-04-07T10:23:51.000Z","popularity":67,"verifiedAt":"2026-11-26T11:18:31.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:52.228Z","updatedAt":"2026-11-26T16:00:52.228Z"},{"id":"6b0857a93c96f2d34d0b324b","type":"repo","provider":"github","url":"https://github.com/anthropics/claude-cookbooks","embedUrl":null,"title":"anthropics/claude-cookbooks","description":"A collection of notebooks/recipes showcasing some fun and effective ways of using Claude.","author":"anthropics","thumbnailUrl":"https://opengraph.githubassets.com/1/anthropics/claude-cookbooks","durationSec":null,"lang":"en","topics":["prompt-engineering","tool-use","rag"],"techs":["python"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"seed","publishedAt":null,"popularity":95,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:41.389Z","updatedAt":"2026-11-26T16:00:41.389Z"},{"id":"6b0857a83c96f2d34d0b323b","type":"course","provider":"huggingface","url":"https://huggingface.co/learn/llm-course","embedUrl":null,"title":"LLM Course","description":"Free course on large language models with the Hugging Face ecosystem: transformers, datasets, tokenizers, fine-tuning and building LLM applications.","author":"Hugging Face","thumbnailUrl":"https://cdn-thumbnails.huggingface.co/social-thumbnails/learn/llm-course/chapter1/1.png","durationSec":null,"lang":"en","topics":["llm-fundamentals","fine-tuning","ai-in-python"],"techs":["python"],"tags":[],"price":"free","featured":true,"featuredOrder":1,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:40.075Z","updatedAt":"2026-11-26T16:00:40.075Z"}],"challenges":[],"attachments":[],"hasCode":true,"repoUrl":null,"series":[],"prev":null,"next":null,"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Autorytet","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Autorytet","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Autorytet","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Autorytet","articles":38}]}}