Skip to content

Commit

Permalink
Merge pull request #33 from OutpostHQ/feat/stream-typo
Browse files Browse the repository at this point in the history
Feat/stream typo
  • Loading branch information
aj-ya authored Sep 29, 2023
2 parents 0b37296 + 6bd248b commit b0fc73a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-frogs-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'outpostkit': patch
---

Bug Fixes
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { Inference } from './inference';
export { Comet } from './comet';
export { APIError } from './error';
export * from './utils/inference';
export * from './types';
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './comet';
export * from './inference';
5 changes: 3 additions & 2 deletions src/utils/inference/vllm-stream.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventStreamContentType, fetchEventSource } from '@microsoft/fetch-event-source';
import { APIError } from 'error';
import { VLLMPromptParameters } from 'types/inference';
import { VLLMOpenAICompletionsOutputType, VLLMPromptParameters } from 'types/inference';

export const streamGenericInferenceServer = (
domain: string,
Expand Down Expand Up @@ -96,7 +96,7 @@ export const streamOpenAIInferenceServer = async (
): Promise<string> => {
try {
let finalResponse: string;
await fetchEventSource(`${domain}/v1/${type === 'chat' ? 'chat/' : ''}completions`, {
await fetchEventSource(`${domain}/v1/${type === 'chat' ? 'chat/completions' : 'completions'}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -123,6 +123,7 @@ export const streamOpenAIInferenceServer = async (
// if the server emits an error message, throw an exception
// so it gets handled by the onerror callback below:
if (msg.event === 'data') {
// const chunk = JSON.parse(msg.data) as VLLMOpenAICompletionsOutputType;
finalResponse += msg.data;
handleNewChunk(msg.data);
} else if (msg.event === 'error') {
Expand Down

0 comments on commit b0fc73a

Please sign in to comment.