@@ -14,11 +14,11 @@ The following examples are for reference only. Prefer docs for the latest inform
1414
1515## Features
1616
17- - 🚀 ** Simple and intuitive API** - Get started in minutes
18- - 🔄 ** Streaming support** - Real-time text generation with typed events
19- - 🛠️ ** Type safety** - Full type hints for better IDE support
20- - 📦 ** Minimal dependencies** - Only what you need
21- - 🐍 ** Python 3.7+** - Support for modern Python versions
17+ - ** Simple and intuitive API** - Get started in minutes
18+ - ** Streaming support** - Real-time text generation with typed events
19+ - ** Type safety** - Full type hints for better IDE support
20+ - ** Minimal dependencies** - Only what you need
21+ - ** Python 3.7+** - Support for modern Python versions
2222
2323## Installation
2424
@@ -53,14 +53,14 @@ langbase_api_key = os.getenv("LANGBASE_API_KEY")
5353llm_api_key = os.getenv(" LLM_API_KEY" )
5454
5555# Initialize the client
56- lb = Langbase(api_key = langbase_api_key)
56+ langbase = Langbase(api_key = langbase_api_key)
5757```
5858
5959### 3. Generate text
6060
6161``` python
6262# Simple generation
63- response = lb .agent.run(
63+ response = langbase .agent.run(
6464 input = [{" role" : " user" , " content" : " Tell me about AI" }],
6565 model = " openai:gpt-4.1-mini" ,
6666 api_key = llm_api_key,
@@ -90,7 +90,7 @@ for content in runner.text_generator():
9090 print (content, end = " " , flush = True )
9191```
9292
93- ### 5. Stream with typed events (Advanced) 🆕
93+ ### 5. Stream with typed events (Advanced)
9494
9595``` python
9696from langbase import StreamEventType, get_typed_runner
@@ -144,51 +144,51 @@ runner.process()
144144
145145## Core Features
146146
147- ### 🔄 Pipes - AI Pipeline Execution
147+ ### Pipes - AI Pipeline Execution
148148
149149``` python
150150# List all pipes
151- pipes = lb .pipes.list()
151+ pipes = langbase .pipes.list()
152152
153153# Run a pipe
154- response = lb .pipes.run(
154+ response = langbase .pipes.run(
155155 name = " ai-agent" ,
156156 messages = [{" role" : " user" , " content" : " Hello!" }],
157157 variables = {" style" : " friendly" }, # Optional variables
158158 stream = True , # Enable streaming
159159)
160160```
161161
162- ### 🧠 Memory - Persistent Context Storage
162+ ### Memory - Persistent Context Storage
163163
164164``` python
165165# Create a memory
166- memory = lb .memories.create(
166+ memory = langbase .memories.create(
167167 name = " product-docs" ,
168168 description = " Product documentation" ,
169169)
170170
171171# Upload documents
172- lb .memories.documents.upload(
172+ langbase .memories.documents.upload(
173173 memory_name = " product-docs" ,
174174 document_name = " guide.pdf" ,
175175 document = open (" guide.pdf" , " rb" ),
176176 content_type = " application/pdf" ,
177177)
178178
179179# Retrieve relevant context
180- results = lb .memories.retrieve(
180+ results = langbase .memories.retrieve(
181181 query = " How do I get started?" ,
182182 memory = [{" name" : " product-docs" }],
183183 top_k = 3 ,
184184)
185185```
186186
187- ### 🤖 Agent - LLM Agent Execution
187+ ### Agent - LLM Agent Execution
188188
189189``` python
190190# Run an agent with tools
191- response = lb .agent.run(
191+ response = langbase .agent.run(
192192 model = " openai:gpt-4" ,
193193 messages = [{" role" : " user" , " content" : " Search for AI news" }],
194194 tools = [{" type" : " function" , " function" : {... }}],
@@ -198,24 +198,24 @@ response = lb.agent.run(
198198)
199199```
200200
201- ### 🔧 Tools - Built-in Utilities
201+ ### Tools - Built-in Utilities
202202
203203``` python
204204# Chunk text for processing
205- chunks = lb .chunker(
205+ chunks = langbase .chunker(
206206 content = " Long text to split..." ,
207207 chunk_max_length = 1024 ,
208208 chunk_overlap = 256 ,
209209)
210210
211211# Generate embeddings
212- embeddings = lb .embed(
212+ embeddings = langbase .embed(
213213 chunks = [" Text 1" , " Text 2" ],
214214 embedding_model = " openai:text-embedding-3-small" ,
215215)
216216
217217# Parse documents
218- content = lb .parser(
218+ content = langbase .parser(
219219 document = open (" document.pdf" , " rb" ),
220220 document_name = " document.pdf" ,
221221 content_type = " application/pdf" ,
@@ -226,10 +226,9 @@ content = lb.parser(
226226
227227Explore the [ examples] ( ./examples ) directory for complete working examples:
228228
229- - [ Generate text] ( ./examples/pipes/pipes.run.py )
230- - [ Stream text with events] ( ./examples/pipes/pipes.run.typed-stream.py )
231- - [ Work with memory] ( ./examples/memory/ )
232229- [ Agent with tools] ( ./examples/agent/ )
230+ - [ Work with memory] ( ./examples/memory/ )
231+ - [ Generate text] ( ./examples/pipes/pipes.run.py )
233232- [ Document processing] ( ./examples/parser/ )
234233- [ Workflow automation] ( ./examples/workflow/ )
235234
@@ -243,9 +242,9 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
243242
244243## Support
245244
246- - 📚 [ Documentation] ( https://langbase.com/docs )
247- - 💬 [ Discord Community] ( https://langbase.com/discord )
248- - 🐛 [ Issue Tracker] ( https://github.com/LangbaseInc/langbase-python-sdk/issues )
245+ - [ Documentation] ( https://langbase.com/docs )
246+ - [ Discord Community] ( https://langbase.com/discord )
247+ - [ Issue Tracker] ( https://github.com/LangbaseInc/langbase-python-sdk/issues )
249248
250249## License
251250
0 commit comments