<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rokas - Sr. C# Software Engineer &amp; Lecturer on Medium]]></title>
        <description><![CDATA[Stories by Rokas - Sr. C# Software Engineer &amp; Lecturer on Medium]]></description>
        <link>https://medium.com/@majestcb?source=rss-eff47c686ded------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OXJEZY_DPIjoOIoyctaQ9g.jpeg</url>
            <title>Stories by Rokas - Sr. C# Software Engineer &amp;amp; Lecturer on Medium</title>
            <link>https://medium.com/@majestcb?source=rss-eff47c686ded------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:35:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@majestcb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TrendCheck: Configurable Financial Sentiment in .NET]]></title>
            <link>https://majestcb.medium.com/trendcheck-configurable-financial-sentiment-in-net-1e547fe79ac8?source=rss-eff47c686ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e547fe79ac8</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[azure-ai]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[net-9]]></category>
            <dc:creator><![CDATA[Rokas - Sr. C# Software Engineer & Lecturer]]></dc:creator>
            <pubDate>Fri, 03 Oct 2025 14:50:36 GMT</pubDate>
            <atom:updated>2025-10-03T15:23:15.122Z</atom:updated>
            <content:encoded><![CDATA[<h3>TrendCheck: Configurable Financial Sentiment in .NET 9 Using Regex-Based Ticker Extraction, Weighted Phrase Scoring, Azure Entities+Sentiment, and a Throttled Queue</h3><h3><strong>Github Repository:</strong> <a href="https://github.com/RokasMarcinkevicius/TrendCheck-Custom-adjustable-sentiment-Analysis-with-Optional-Azure-AI-integration">https://github.com/RokasMarcinkevicius/TrendCheck-Custom-adjustable-sentiment-Analysis-with-Optional-Azure-AI-integration</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfoL7rvrlejuuvzGZGBmPw.png" /><figcaption>Example result from different engines</figcaption></figure><p>This article walks through TrendCheck’s <strong>analysis</strong> internals exactly as implemented in the repository: ticker extraction via compiled regexes, a <strong>weighted lexicon</strong> for finance cues (beats, upgrades, recalls, guidance changes), and a <strong>score→direction/magnitude</strong> mapper with neutral bands and caps. It also details the Azure engine: entity recognition + sentiment from Text Analytics, best-sentence evidence selection, optional <strong>LT translation</strong>, and a Channel&lt;T&gt;-backed <strong>throttled queue</strong> that spaces calls. The result is a configurable, reproducible sentiment layer where Local and Azure produce the same contract for clients.</p><p>TrendCheck’s analysis layer is built so you can switch engines without changing your client code. Under a single contract (submit → status → result), it offers two implementations:</p><ul><li><strong>Local</strong> — a deterministic, offline analyzer that:</li></ul><ol><li>extracts the company/ticker from text,</li><li>scores the text with a finance-tuned lexicon,</li><li>maps the score to <strong>Direction</strong> (Up/Down/Neutral) and <strong>Magnitude</strong> (0–1).</li></ol><p><strong>Azure</strong> — the same output contract, but backed by <strong>Azure AI Text Analytics</strong> for entity recognition &amp; sentiment, with <strong>optional translation</strong>, and a <strong>throttled queue</strong> to enforce a minimum inter-call delay.</p><p>Because both engines produce the same shape, you can A/B them, run one in CI and another in prod, or flip per source — no downstream changes.</p><h3>Architecture at a glance</h3><pre>Transport (HTTP / gRPC)<br>        │<br>        ▼<br>Application (ports/use-cases)<br>  └─ IArticleAnalyzer<br>        │<br>        ▼<br>Infrastructure (engines &amp; plumbing)<br>  ├─ Nlp/LocalArticleAnalyzer      ← deterministic rules<br>  ├─ Azure/AzureArticleAnalyzer    ← cloud NLP + throttling (+ optional Translator)<br>  └─ Azure/AzureThrottledQueue     ← min interval between Azure calls</pre><p>The <strong>Domain</strong> project holds light domain records. For example, Domain/Entities/Article.cs defines a record with:</p><ul><li>Id (stable hash, e.g., URL + published), Title, Source, PublishedAt</li><li>Summary?</li><li>Tickers? (extracted/assigned symbols)</li><li>Sentiment? (optional, if provider supplies)</li></ul><p>This keeps the type system honest across engines without bloating the domain.</p><h3>The API contract (submit → status → result)</h3><p>The HTTP tests in tests/ show how the service is meant to be consumed:</p><ol><li><strong>Submit</strong> an analysis job with body { text, engine } (engine is &quot;local&quot; or &quot;azure&quot;).</li><li><strong>Poll status</strong> until the job is Completed (or Failed).</li><li><strong>Get result</strong> which always includes:</li></ol><ul><li><strong>Company</strong>: name and/or ticker (resolved from directory or entities)</li><li><strong>Direction</strong>: Up | Down | Neutral</li><li><strong>Magnitude</strong>: 0.00–1.00</li><li><strong>Evidence</strong>: best sentence or phrase (and optional <strong>Translation</strong> when Azure translation is enabled)</li></ul><p>Because both engines write the same structure, your consumers don’t care which engine ran.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGmAOhcchwlsctfBo_SQVQ.png" /><figcaption>Sending requests</figcaption></figure><h3>Dependency Injection wiring (how engines are enabled)</h3><p>Infrastructure/Azure/ServiceCollectionExtensions.cs registers analyzers:</p><ul><li><strong>Always</strong> registers LocalArticleAnalyzer, so &quot;local&quot; is available even if Azure isn’t configured.</li><li>If Azure:TextAnalytics:Endpoint and Azure:TextAnalytics:Key exist, it registers AzureArticleAnalyzer with:</li><li>TextAnalyticsClient (entities + sentiment)</li><li>Optional TextTranslationClient (if Translator Key + Region are set)</li><li>A <strong>min inter-call spacing</strong> (Processing:MinSecondsBetweenAzureCalls, default <strong>30s</strong>) used by the throttled queue.</li></ul><p>That means: drop Azure keys into appsettings.json and &quot;azure&quot; becomes available; remove them and only &quot;local&quot; runs—no code changes.</p><h3>Local engine (Infrastructure/Nlp/LocalArticleAnalyzer.cs)</h3><h3>1) Ticker &amp; company extraction</h3><p>The local engine is deterministic: it does <strong>patterned extraction</strong> + <strong>dictionary resolution</strong>. You’ll see four compiled regexes up top:</p><ul><li><strong>TickerRegex</strong> — matches tickers like $AAPL or AAPL (word-bounded, 1–5 capital letters).</li><li><strong>ParentTicker</strong> — matches parenthesized tickers like (AAPL).</li><li><strong>MarketPrefix</strong> — matches tickers qualified by exchange prefixes like NASDAQ:AAPL, NYSE:MSFT, LSE:..., etc.</li><li><strong>SentenceSplit</strong> — conservative splitter to keep sentence scoring localized.</li></ul><p>Extraction flow (simplified):</p><ol><li>Look for explicit markers (parenthetical or market-prefix).</li><li>Fall back to raw ticker matches.</li><li>Resolve to a <strong>company</strong> via CompanyDirectory.</li><li>Produce a short <strong>snip</strong> around the first match for evidence if needed.</li></ol><blockquote><em>Tip: seed the </em><em>CompanyDirectory with your target watchlist. In the sample seed (e.g., in </em><em>GrpcService/Program.cs), Apple/Microsoft/NVIDIA/Tesla are included so you immediately get resolution without external lookups.</em></blockquote><h3>2) Finance-tuned lexicons (Pos/Neg with weights)</h3><p>Two static arrays define the signal:</p><ul><li><strong>PosLex</strong> includes phrases like:<br> beat (0.35), outperform (0.40), upgrade (0.35),<br> bullish (0.40), soar (0.55), surge (0.55), growth (0.20),<br> raised guidance (0.35), exceed (0.25), strong (0.20), robust (0.20) …</li><li><strong>NegLex</strong> includes:<br> miss (-0.35), underperform (-0.40), downgrade (-0.35),<br> bearish (-0.40), plunges (-0.60), tumble (-0.55), falls (-0.45),<br> profit warning (-0.50), cut guidance (-0.40), loss (-0.30),<br> lawsuit (-0.25), recall (-0.30), delay (-0.20) …</li></ul><p>A small <strong>negations</strong> list (&quot;no&quot;, &quot;not&quot;, &quot;never&quot;, &quot;without&quot;, …) prevents false positives like “<em>not bullish</em>”.</p><p><strong>Scoring</strong> is simply: sum matched weights (considering negations). This yields a <strong>raw score</strong> which can be positive, negative, or close to zero.</p><h3>3) Mapping raw score → Direction &amp; Magnitude</h3><p>The mapping logic is explicit (and adjustable by constants in the file):</p><ul><li>Let abs = |score|.</li><li><strong>Neutral band</strong>: if abs &lt; 0.10 → direction = Neutral, and magnitude = abs * 0.5 (keep tiny signals tiny).</li><li><strong>Directional</strong>: otherwise direction = (score &gt; 0 ? Up : Down).</li><li>For smallish signals: if abs &lt; 0.35 → magnitude = abs.</li><li>For stronger signals: magnitude = min(1.0, abs * 1.2) (grow faster but cap at 1).</li></ul><p>This keeps weak hints from dominating, while allowing clusters of strong phrases to ramp magnitude quickly (yet bounded).</p><h3>4) Evidence and (optional) translation</h3><p>The local engine returns an <strong>evidence</strong> string — a best sentence or snip that justifies the score. If the request asks for translation (translate=true in the API) but you’re on the local engine, it simply prefixes the evidence with &quot;[lt] &quot; to make the contract shape consistent; actual translation is only done by the Azure engine’s Translator.</p><h3>Why the local engine matters</h3><ul><li><strong>Deterministic</strong> and <strong>fast</strong> (no network).</li><li>Perfect for <strong>CI/regression</strong> and <strong>explainability</strong> (you know which phrases fired and with what weights).</li><li>A strong baseline you can tune for your domain by editing the lexicons and thresholds directly in code.</li></ul><h3>Azure engine (Infrastructure/Azure/AzureArticleAnalyzer.cs)</h3><p>The Azure engine implements the same interface but defers NLP to the cloud, then <strong>maps the cloud scores back</strong> into the same direction/magnitude space.</p><h3>1) Throttled queue (AzureThrottledQueue.cs)</h3><p>Every request to Azure goes through a <strong>generic queue</strong> with this behavior:</p><ul><li>Uses Channel&lt;T&gt; as a buffer.</li><li>A background RunAsync loop calls WaitToReadAsync(); when an item is available, it:</li></ul><ol><li><strong>handles</strong> the item (your async handler),</li><li><strong>awaits the configured minimum interval</strong> before processing the next item.</li></ol><p>This enforces a <strong>time gap</strong> between API calls (default <strong>30s</strong>, configurable), protecting you from rate limits and smoothing bursts.</p><h3>2) HandleAsync: entity + sentiment</h3><p>For each job:</p><ol><li><strong>Entity Recognition</strong>: calls RecognizeEntitiesAsync(document) and picks the first Organization as the <strong>company name</strong> candidate.</li><li><strong>Sentiment</strong>: calls AnalyzeSentimentAsync(document) and reads the <strong>document-level</strong> confidence scores:<br> positive, neutral, negative.</li><li><strong>Scoring &amp; Mapping</strong>: computes overallScore = positive - negative, then reuses the <strong>same mapping</strong> style as local:</li></ol><ul><li>abs = |overallScore|</li><li>Neutral if abs &lt; 0.10 (magnitude scaled down)</li><li>Else Up/Down based on sign; magnitude min(1.0, abs * 1.2)</li></ul><ol><li><strong>Best sentence</strong>: picks the sentence with the largest |pos - neg| (most “decisive”) as <strong>evidence</strong>. If none, falls back to a short prefix of the document (e.g., first 160 chars).</li><li><strong>Optional translation</strong>: if the request asked for translation and a Translator client is configured, it translates the <strong>best sentence</strong> to <strong>Lithuanian (</strong><strong>&quot;lt&quot;)</strong> and includes it in the result.</li><li><strong>Company resolution</strong>: looks up the recognized organization in CompanyDirectory to produce (CompanyName, Ticker); if it can’t resolve, you still get a company name and “Unknown” ticker.</li></ol><h3>Trade-offs vs local</h3><ul><li><strong>Pros</strong>: multilingual support, robust entity recognition, sentence-level confidences.</li><li><strong>Cons</strong>: network latency, service cost (quite expensive), and <strong>non-determinism</strong> over time (cloud models evolve).</li><li><strong>Mitigation</strong>: the <strong>throttled queue</strong> smooths traffic; the <strong>shared mapper</strong> keeps outputs consistent with your local engine.</li></ul><h3>End-to-end flow (Azure path)</h3><pre>Client submits (engine = &quot;azure&quot;, text, translate?)<br>        │<br>        ▼<br>Api stores job → AzureThrottledQueue.Enqueue<br>        │<br>        ▼<br>Queue worker (RunAsync)<br>  → RecognizeEntitiesAsync<br>  → AnalyzeSentimentAsync<br>  → map to Direction/Magnitude<br>  → (optional) Translate best sentence to &quot;lt&quot;<br>  → resolve company via CompanyDirectory<br>  → complete job with ArticleAnalysisResult<br>        │<br>        ▼<br>Client polls /status → Completed → /result</pre><p>The <strong>local</strong> path is identical minus network calls and translation; scoring is pure in-process.</p><h3>What you get back (both engines)</h3><pre>{<br>  &quot;company&quot;: &quot;Apple Inc.&quot;,<br>  &quot;ticker&quot;: &quot;AAPL&quot;,<br>  &quot;direction&quot;: &quot;Up&quot;,<br>  &quot;magnitude&quot;: 0.78,<br>  &quot;score&quot;: 0.65,               // engine-specific underlying score (rounded)<br>  &quot;evidence&quot;: &quot;…raises guidance following a beat…&quot;,<br>  &quot;translation&quot;: &quot;… (if azure &amp; translate=true) …&quot;<br>}</pre><p>Fields may include additional engine-specific details (e.g., Azure’s rounded score is the pos–neg delta; local’s is the lexicon sum), but <strong>Direction</strong> and <strong>Magnitude</strong> are the stable currency your clients consume.</p><h3>Tuning guide (concrete levers that actually exist in code)</h3><p><strong>Local analyzer</strong></p><ul><li><strong>Lexicon weights</strong>: adjust PosLex/NegLex to your domain. Make “guidance raise” worth more than generic adjectives; penalize “recall”, “probe”, “lawsuit” more in regulatory-heavy sectors.</li><li><strong>Neutral band</strong>: change the 0.10 cutoff for neutrality to be more/less conservative.</li><li><strong>Slope/cap</strong>: tweak the 0.35 boundary and the ×1.2 growth vs min(1.0, …) cap to control how quickly magnitude ramps on strong clusters.</li><li><strong>Extraction patterns</strong>: extend MarketPrefix and TickerRegex if your feeds use different formats.</li><li><strong>CompanyDirectory</strong>: seed with names/aliases → tickers for higher coverage (you already have Apple/Microsoft/NVIDIA/Tesla seeded in your sample).</li></ul><p><strong>Azure analyzer</strong></p><ul><li><strong>MinSecondsBetweenAzureCalls</strong>: raise it when ingesting bursts; lower it for low-volume pipelines.</li><li><strong>Translate?</strong>: set translate=true only when you need a Lithuanian evidence string; otherwise keep it off to save latency/cost.</li><li><strong>Result parity</strong>: you can bias toward stricter neutrality by raising the 0.10 band to make Azure outputs “feel” closer to your local engine in choppy text.</li></ul><h3>.NET 9 notes (practical bits you’re already using)</h3><ul><li><strong>Async all the way</strong> (async/await), including IAsyncDisposable on the Azure analyzer to correctly dispose the queue’s background runner.</li><li><strong>System.Threading.Channels</strong> for the throttled queue (a sturdy, low-overhead pattern for producer/consumer).</li><li><strong>Minimal DI</strong> registration via a single extension that conditionally wires Azure, always wiring Local.</li><li><strong>Fast in-proc path</strong> for Local (no allocations beyond normal regex/iteration and a couple of arrays), which is exactly what you want for CI and regression runs.</li></ul><h3>Why this split is the right abstraction</h3><ul><li><strong>One contract, two behaviors</strong>: local for reproducibility and explainability; Azure for language breadth and confidence signals.</li><li><strong>No consumer churn</strong>: Direction/Magnitude are stable across engines.</li><li><strong>Operational safety</strong>: throttling puts a governor in front of external APIs.</li><li><strong>Evolvability</strong>: you can keep refining the local lexicon and thresholds while independently evolving Azure usage (e.g., enable opinion mining later, or add per-sentence proximity to named entities) with zero changes to clients.</li></ul><h3>Quick start (from the repo)</h3><ul><li>Run API: dotnet run --project Api/Api.csproj → open Swagger.</li><li>Use tests/analyze.http → POST /api/analyze/submit with engine=&quot;local&quot; (or &quot;azure&quot; when keys exist), then poll status, then result.</li><li>To enable Azure, add in appsettings.json:</li><li>{ &quot;Processing&quot;: { &quot;MinSecondsBetweenAzureCalls&quot;: 30 }, &quot;Azure&quot;: { &quot;TextAnalytics&quot;: { &quot;Endpoint&quot;: &quot;https://&lt;your&gt;.cognitiveservices.azure.com/&quot;, &quot;Key&quot;: &quot;&lt;key&gt;&quot; }, &quot;Translator&quot;: { &quot;Key&quot;: &quot;&lt;key&gt;&quot;, &quot;Region&quot;: &quot;&lt;region&gt;&quot; } } }</li></ul><h3>Appendix A — Key code facts (grounded in the repo)</h3><ul><li><strong>Local scoring</strong> uses <strong>weighted lexicons</strong> (PosLex, NegLex) and a <strong>Negations</strong> array.</li><li><strong>Local mapping</strong> thresholds: abs &lt; 0.10 → Neutral; else Up/Down; magnitude uses abs, a 0.35 hinge, and ×1.2 growth capped at 1.0.</li><li><strong>Azure overall score</strong> = PositiveConfidence – NegativeConfidence; <strong>same</strong> neutral band &amp; growth logic.</li><li><strong>Best sentence</strong> (Azure) = highest |pos – neg|; fallback to first ~160 chars.</li><li><strong>Translator</strong> (Azure) translates the <strong>best sentence</strong> to &quot;lt&quot; when enabled.</li><li><strong>Throttling</strong> implemented via Channel&lt;T&gt; with a <strong>mandatory delay</strong> between jobs.</li><li><strong>DI</strong>: Local always available; Azure conditionally added when Endpoint + Key are present; <strong>min seconds</strong> read from Processing:MinSecondsBetweenAzureCalls (default <strong>30</strong>).</li></ul><p>Example output json:</p><pre>[<br>  {<br>    &quot;requestId&quot;: &quot;5545cfab327d482b93db0cfd0020f3dc&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;local&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:34.84212+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Tesla, Inc.&quot;,<br>      &quot;ticker&quot;: &quot;TSLA&quot;,<br>      &quot;direction&quot;: &quot;Down&quot;,<br>      &quot;magnitude&quot;: 0.333,<br>      &quot;sentimentScore&quot;: -0.333,<br>      &quot;evidenceSnippet&quot;: &quot;Tesla (TSLA) issues profit warning and recalls vehicles; misses expectations as regulators probe safety issues.&quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;be62f4392675473b80c0b01d42c20345&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;azure&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:34.902308+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Tesla&quot;,<br>      &quot;ticker&quot;: &quot;TSLA&quot;,<br>      &quot;direction&quot;: &quot;Down&quot;,<br>      &quot;magnitude&quot;: 1,<br>      &quot;sentimentScore&quot;: -0.9,<br>      &quot;evidenceSnippet&quot;: &quot;misses expectations as regulators probe safety issues.&quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;9e18c5fb58ba40f8ba1951c003aa066c&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;local&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.063302+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;NVIDIA Corporation&quot;,<br>      &quot;ticker&quot;: &quot;NVDA&quot;,<br>      &quot;direction&quot;: &quot;Up&quot;,<br>      &quot;magnitude&quot;: 0.233,<br>      &quot;sentimentScore&quot;: 0.233,<br>      &quot;evidenceSnippet&quot;: &quot;NVIDIA (NVDA) posts record profits and strong AI chip demand, but shares slip on export restrictions and rising AMD competition.&quot;,<br>      &quot;translation&quot;: &quot;[lt] NVIDIA (NVDA) posts record profits and strong AI chip demand, but shares slip on export restrictions and rising AMD competition.&quot;<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;3f381ab790b54cbbbc8215c9644f3083&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;local&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:34.447122+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Apple Inc.&quot;,<br>      &quot;ticker&quot;: &quot;AAPL&quot;,<br>      &quot;direction&quot;: &quot;Up&quot;,<br>      &quot;magnitude&quot;: 0.233,<br>      &quot;sentimentScore&quot;: 0.233,<br>      &quot;evidenceSnippet&quot;: &quot;Apple (AAPL) beats revenue and EPS, raises guidance; analysts lift targets and call for upside momentum.&quot;,<br>      &quot;translation&quot;: &quot;[lt] Apple (AAPL) beats revenue and EPS, raises guidance; analysts lift targets and call for upside momentum.&quot;<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;d8cad6e84515499da0ed8e10ac910153&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;local&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.568112+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Apple Inc.&quot;,<br>      &quot;ticker&quot;: &quot;AAPL&quot;,<br>      &quot;direction&quot;: &quot;Up&quot;,<br>      &quot;magnitude&quot;: 0.117,<br>      &quot;sentimentScore&quot;: 0.117,<br>      &quot;evidenceSnippet&quot;: &quot;Apple (AAPL) did not miss expectations and hardly disappointed; the company never fails to deliver solid results and shares barely decline with no warnings.&quot;,<br>      &quot;translation&quot;: &quot;[lt] Apple (AAPL) did not miss expectations and hardly disappointed; the company never fails to deliver solid results and shares barely decline with no warnings.&quot;<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;d167708bce964e8893108c5cc5e29a7a&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;local&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.380917+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Apple Inc.&quot;,<br>      &quot;ticker&quot;: &quot;AAPL&quot;,<br>      &quot;direction&quot;: &quot;Up&quot;,<br>      &quot;magnitude&quot;: 0.117,<br>      &quot;sentimentScore&quot;: 0.117,<br>      &quot;evidenceSnippet&quot;: &quot;Apple (AAPL) rallies into iPhone 16 launch; strong pre-orders and new AI features fuel upgrade cycle, though China demand and supply-chain delays are risks.&quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;fefe51ece30041178e5ff774ccd9a57a&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;azure&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:34.629272+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Apple&quot;,<br>      &quot;ticker&quot;: &quot;AAPL&quot;,<br>      &quot;direction&quot;: &quot;Up&quot;,<br>      &quot;magnitude&quot;: 0.672,<br>      &quot;sentimentScore&quot;: 0.56,<br>      &quot;evidenceSnippet&quot;: &quot;Apple (AAPL) beats revenue and EPS, raises guidance; &quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;2e1d602818a24a20bb0d39d43105710d&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;azure&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.426481+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;Apple&quot;,<br>      &quot;ticker&quot;: &quot;AAPL&quot;,<br>      &quot;direction&quot;: &quot;Down&quot;,<br>      &quot;magnitude&quot;: 0.588,<br>      &quot;sentimentScore&quot;: -0.49,<br>      &quot;evidenceSnippet&quot;: &quot;strong pre-orders and new AI features fuel upgrade cycle, though China demand and supply-chain delays are risks.&quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;01e0635f954044fa8e917fe86388b64e&quot;,<br>    &quot;status&quot;: &quot;Pending&quot;,<br>    &quot;engine&quot;: &quot;azure&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.613538+00:00&quot;,<br>    &quot;result&quot;: null,<br>    &quot;error&quot;: null<br>  },<br>  {<br>    &quot;requestId&quot;: &quot;59b2c62291b24fd09adfa8d5bb0ca964&quot;,<br>    &quot;status&quot;: &quot;Completed&quot;,<br>    &quot;engine&quot;: &quot;azure&quot;,<br>    &quot;createdAt&quot;: &quot;2025-10-03T14:41:35.132411+00:00&quot;,<br>    &quot;result&quot;: {<br>      &quot;company&quot;: &quot;NVIDIA&quot;,<br>      &quot;ticker&quot;: &quot;NVDA&quot;,<br>      &quot;direction&quot;: &quot;Neutral&quot;,<br>      &quot;magnitude&quot;: 0.012,<br>      &quot;sentimentScore&quot;: 0.01,<br>      &quot;evidenceSnippet&quot;: &quot;NVIDIA (NVDA) posts record profits and strong AI chip demand, but shares slip on export restrictions and rising AMD competition.&quot;,<br>      &quot;translation&quot;: null<br>    },<br>    &quot;error&quot;: null<br>  }<br>]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnVO9SLnOm65s8ZTo8xtyA.png" /><figcaption>Different engine results</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e547fe79ac8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Chat GPT to your .NET 7 application]]></title>
            <link>https://majestcb.medium.com/adding-chat-gpt-to-your-net-7-application-d73f07a9045?source=rss-eff47c686ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/d73f07a9045</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Rokas - Sr. C# Software Engineer & Lecturer]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 17:54:43 GMT</pubDate>
            <atom:updated>2023-01-17T17:54:43.513Z</atom:updated>
            <content:encoded><![CDATA[<h3>Adding Chat GPT to your .NET 7 application</h3><p>Prerequisites: VSCode and .Net 7 installed. Don&#39;t need to copy the code, GitHub Link provided in the end.</p><p>Open up a terminal in VSCode or any IDE of your choice, run</p><blockquote>dotnet new console</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IMWfh6dZ95mYpHiYasnpaQ.png" /></figure><p>2 files will appear, default Program.cs and .csproj named according to your folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*S8JJku17_t344VXvs1AXEg.png" /></figure><p>Now let&#39;s create a file called OpenAIResponse.cs and start filling in the objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*SqDEdRQnTi_F0VGlurVVJQ.png" /><figcaption>Main response object</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*HMppm2ddbgHPLOMtUimh0g.png" /><figcaption>Text response and usage objects</figcaption></figure><p>We will use these objects to translate the open AI response to C# object oriented language.</p><p>Time to call the API!</p><p>Get your API Key from <a href="https://beta.openai.com/account/api-keys">https://beta.openai.com/account/api-keys</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0bycUugp0YZ5nKVBajqrg.png" /></figure><p>Create new secret key, copy &amp; paste it into the project.</p><p>Now let&#39;s set up the main function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISoTUPv6PqQnzNlR4SXB-w.png" /><figcaption>The entire function to call Open AI</figcaption></figure><p>Let&#39;s go through each part, firstly lets look at the function signature:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oiew3bC4WzyJ2ZyAxk4YNg.png" /><figcaption>Function signature</figcaption></figure><p>Open AI requires a fairly large amount of settings to be specified in order to provide us with the expected result, we are passing them through the function signature, the comments explain each individual parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ChJxUh6xowLw7Ozz2JvqJw.png" /><figcaption>Setup for the request</figcaption></figure><p>Then we have the setup for the request, essentially the request requires:</p><ul><li>The API Key (used for authorization)</li><li>The Call URL (used to direct the request)</li><li>The Content (used to setup the parameters of the request)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pRLuNKzuPkLsZ5SrTILlNA.png" /><figcaption>Parse the response</figcaption></figure><p>After the setup we just send the request and read it into our prepared class.</p><p>Alright, everything is set up, let&#39;s call it! (Don&#39;t forget to set the API Key to yours)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KD5yihE-IXuVxcwFztFFRg.png" /><figcaption>the default playground settings</figcaption></figure><p>Now in your terminal just run:</p><blockquote>dotnet run</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*qppLcm6s1SWhCfYWV3R1DA.png" /></figure><p>And after inputting a question you should receive an answer.</p><p>You can find all the source files here: <a href="https://github.com/RokasMarcinkevicius/ChatGPT">https://github.com/RokasMarcinkevicius/ChatGPT</a></p><p>Let me know what other integrations you&#39;d like to see!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d73f07a9045" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>