dspy 0.22.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e148ea7f8b9d9239489008409167bce63fce8bbb51798837573a93cc82bd73
4
- data.tar.gz: 69304272af26457e557189b743c59bcddb25f9d05ba485e5fec1e61cee5be4ad
3
+ metadata.gz: e8fb5750b0bc898e3bfb2b64305e5b7eb186c494aba525fd8b739822385e7129
4
+ data.tar.gz: 530f9d8163c914845a2b472cdacce848ba187b9e69f9304d8743966b744ddf9f
5
5
  SHA512:
6
- metadata.gz: 998377fc4c8d444029e83e9b01f5e65efd28df06abc07a8b120258a91ef6894c6a0b75ffa398526c305894fe9b5a22eb389b0e9646a1f26d341af6aea736101b
7
- data.tar.gz: 77e0ccd6a18fd3495bd785acfc0d45555f7632b895bb9dbe583e1b42622270f9fb9f9f242cac43f01259971829decb7e8306ad070a2fe9e2a4a9c655bbeb675b
6
+ metadata.gz: 9f8e5fa70b1be656f174e5370f529086cb6c836030382c04fd1392e79998c43e93b71db7dbc47ec3cf424254cbd42343ac6f1447f800185d6ce499204dec05f2
7
+ data.tar.gz: 95971087479ca0efa66da1bb6084e94a6cb2120203721c2a949c6fc002d152da9f4587061e8e67c246760dbee5167718f8a6f067024e61106d9fa94c1bd0cd55
data/README.md CHANGED
@@ -5,16 +5,15 @@
5
5
  [![Build Status](https://img.shields.io/github/actions/workflow/status/vicentereig/dspy.rb/ruby.yml?branch=main&label=build)](https://github.com/vicentereig/dspy.rb/actions/workflows/ruby.yml)
6
6
  [![Documentation](https://img.shields.io/badge/docs-vicentereig.github.io%2Fdspy.rb-blue)](https://vicentereig.github.io/dspy.rb/)
7
7
 
8
- **Build reliable LLM applications in Ruby using composable, type-safe modules.**
8
+ **Build reliable LLM applications in idiomatic Ruby using composable, type-safe modules.**
9
9
 
10
- DSPy.rb brings structured LLM programming to Ruby developers. Instead of wrestling with prompt strings and parsing
11
- responses, you define typed signatures and compose them into pipelines that just work.
10
+ The Ruby framework for programming with large language models. DSPy.rb brings structured LLM programming to Ruby developers. Instead of wrestling with prompt strings and parsing responses, you define typed signatures using idiomatic Ruby to compose and decompose AI Worklows and AI Agents.
12
11
 
13
- Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you
12
+ **Prompts are the just Functions.** Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you
14
13
  the programming approach pioneered by [dspy.ai](https://dspy.ai/): instead of crafting fragile prompts, you define modular
15
14
  signatures and let the framework handle the messy details.
16
15
 
17
- DSPy.rb is an idiomatic Ruby port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). While implementing
16
+ DSPy.rb is an idiomatic Ruby surgical port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). While implementing
18
17
  the core concepts of signatures, predictors, and optimization from the original Python library, DSPy.rb embraces Ruby
19
18
  conventions and adds Ruby-specific innovations like CodeAct agents and enhanced production instrumentation.
20
19
 
@@ -53,22 +53,9 @@ module DSPy
53
53
  def embed_batch(texts)
54
54
  ensure_ready!
55
55
 
56
- # Preprocess all texts
57
- cleaned_texts = texts.map { |text| preprocess_text(text) }
58
-
59
- # Generate embeddings in batch
60
- results = @model.call(cleaned_texts)
61
-
62
- # Extract and normalize embeddings
63
- results.map do |result|
64
- # Handle both single embeddings and batch results
65
- embedding = case result
66
- when Array
67
- result.flatten # Flatten in case of nested arrays
68
- else
69
- result.to_a.flatten
70
- end
71
- normalize_vector(embedding)
56
+ # Generate embeddings one by one (informers doesn't support true batch processing)
57
+ texts.map do |text|
58
+ embed(text)
72
59
  end
73
60
  end
74
61
 
@@ -54,7 +54,7 @@ module DSPy
54
54
 
55
55
  sig { returns(T::Hash[Symbol, T.untyped]) }
56
56
  def to_h
57
- @_struct.to_h
57
+ @_struct.serialize
58
58
  end
59
59
 
60
60
  private