This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain.agents.middleware import dynamic_prompt | |
| from langchain.agents import create_agent | |
| from langchain_chroma import Chroma | |
| from langchain_openai import ChatOpenAI, OpenAIEmbeddings | |
| def main(): | |
| embeddings = OpenAIEmbeddings( | |
| model="Qwen/Qwen3-Embedding-0.6B", | |
| openai_api_base="http://localhost:8000/v1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain.agents.middleware import dynamic_prompt | |
| from langchain_anthropic import ChatAnthropic | |
| from langchain.agents import create_agent | |
| from langchain_chroma import Chroma | |
| from langchain_openai import OpenAIEmbeddings | |
| def main(): | |
| embeddings = OpenAIEmbeddings( | |
| model="Qwen/Qwen3-Embedding-0.6B", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_anthropic import ChatAnthropic | |
| from langchain.agents import create_agent | |
| from langchain.tools import tool | |
| from langchain_chroma import Chroma | |
| from langchain_openai import OpenAIEmbeddings | |
| def main(): | |
| embeddings = OpenAIEmbeddings( | |
| model="Qwen/Qwen3-Embedding-0.6B", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_community.document_loaders import DirectoryLoader, TextLoader | |
| from langchain_chroma import Chroma | |
| from langchain_openai import OpenAIEmbeddings | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| def main(): | |
| loader = DirectoryLoader("./data/", glob="**/*.txt", loader_cls=TextLoader) | |
| documents = loader.load() | |
| text_splitter = RecursiveCharacterTextSplitter( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain.agents.middleware import dynamic_prompt | |
| from langchain_anthropic import ChatAnthropic | |
| from langchain.agents import create_agent | |
| from langchain_chroma import Chroma | |
| from langchain_ollama import OllamaEmbeddings | |
| def main(): | |
| embeddings = OllamaEmbeddings(model="llama3") | |
| vector_store = Chroma( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_anthropic import ChatAnthropic | |
| from langchain.agents import create_agent | |
| from langchain.tools import tool | |
| from langchain_chroma import Chroma | |
| from langchain_ollama import OllamaEmbeddings | |
| def main(): | |
| embeddings = OllamaEmbeddings(model="llama3") | |
| vector_store = Chroma( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_community.document_loaders import DirectoryLoader, TextLoader | |
| from langchain_chroma import Chroma | |
| from langchain_ollama import OllamaEmbeddings | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| def main(): | |
| loader = DirectoryLoader("./data/", glob="**/*.txt", loader_cls=TextLoader) | |
| documents = loader.load() | |
| text_splitter = RecursiveCharacterTextSplitter( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_community.document_loaders import DirectoryLoader, TextLoader | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| def main(): | |
| loader = DirectoryLoader("./data/", glob="**/*.txt", loader_cls=TextLoader) | |
| documents = loader.load() | |
| text_splitter = RecursiveCharacterTextSplitter( | |
| chunk_size=1000, | |
| chunk_overlap=200, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_community.document_loaders import DirectoryLoader, TextLoader | |
| def main(): | |
| loader = DirectoryLoader("./data/", glob="**/*.txt", loader_cls=TextLoader) | |
| documents = loader.load() | |
| print(f"Total characters: {len(documents[0].page_content)}") | |
| print(documents[0].page_content[:500]) | |
| if __name__ == "__main__": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from langchain_anthropic import ChatAnthropic | |
| from langchain.agents import create_agent | |
| from langchain.tools import tool | |
| @tool | |
| def get_weather(city: str) -> str: | |
| """Get weather for a given city. | |
| Args: |
NewerOlder